1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API and implementation
11 ******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.trace
;
17 import org
.eclipse
.core
.resources
.IProject
;
18 import org
.eclipse
.core
.resources
.IResource
;
19 import org
.eclipse
.core
.runtime
.CoreException
;
20 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.core
.stateprovider
.CtfKernelStateInput
;
21 import org
.eclipse
.linuxtools
.tmf
.core
.TmfCommonConstants
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
.CtfTmfTrace
;
23 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
24 import org
.eclipse
.linuxtools
.tmf
.core
.statesystem
.IStateChangeInput
;
25 import org
.eclipse
.linuxtools
.tmf
.core
.statesystem
.StateSystemManager
;
28 * This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
29 * traces. It uses the CtfKernelStateInput to generate the state history.
34 public class CtfKernelTrace
extends CtfTmfTrace
{
37 * The file name of the History Tree
39 public final static String HISTORY_TREE_FILE_NAME
= "stateHistory.ht"; //$NON-NLS-1$
44 public CtfKernelTrace() {
49 public boolean validate(final IProject project
, final String path
) {
50 if (!super.validate(project
, path
)) {
53 /* Add extra checks specific to kernel traces here */
58 protected void buildStateSystem() throws TmfTraceException
{
59 /* Set up the path to the history tree file we'll use */
60 IResource resource
= this.getResource();
61 String supplDirectory
= null;
64 // get the directory where the history file will be stored.
65 supplDirectory
= resource
.getPersistentProperty(TmfCommonConstants
.TRACE_SUPPLEMENTARY_FOLDER
);
66 } catch (CoreException e
) {
67 throw new TmfTraceException(e
.toString(), e
);
70 final File htFile
= new File(supplDirectory
+ File
.separator
+ HISTORY_TREE_FILE_NAME
);
71 final IStateChangeInput htInput
= new CtfKernelStateInput(this);
73 this.ss
= StateSystemManager
.loadStateHistory(htFile
, htInput
, false);