tmf: Provide a static method to retrieve state systems
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core / src / org / eclipse / linuxtools / lttng2 / kernel / core / cpuusage / LttngKernelCpuUsageAnalysis.java
index 0021d70819731d70c2e74c6f5a69218bc00700df..eb6da69f05380663c9d57b598aa6122ebc2eb055 100644 (file)
@@ -29,6 +29,7 @@ import org.eclipse.linuxtools.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 
 /**
  * This analysis module computes the CPU usage of a system from a kernel trace.
@@ -85,17 +86,12 @@ public class LttngKernelCpuUsageAnalysis extends TmfStateSystemAnalysisModule {
         Map<String, Long> map = new HashMap<>();
         Map<String, Long> totalMap = new HashMap<>();
 
+        ITmfTrace trace = getTrace();
         ITmfStateSystem cpuSs = getStateSystem();
-        if (cpuSs == null) {
+        if (trace == null || cpuSs == null) {
             return map;
         }
-        TmfStateSystemAnalysisModule module = getTrace().getAnalysisModuleOfClass(TmfStateSystemAnalysisModule.class, LttngKernelAnalysisModule.ID);
-        if (module == null) {
-            return map;
-        }
-        module.schedule();
-        module.waitForInitialization();
-        ITmfStateSystem kernelSs = module.getStateSystem();
+        ITmfStateSystem kernelSs = TmfStateSystemAnalysisModule.getStateSystem(trace, LttngKernelAnalysisModule.ID);
         if (kernelSs == null) {
             return map;
         }
This page took 0.024291 seconds and 5 git commands to generate.