From b12f4544be4e2d30855e57604ae847e523537d0f Mon Sep 17 00:00:00 2001 From: Francois Chouinard Date: Tue, 23 Nov 2010 22:08:20 +0000 Subject: [PATCH] 2010-11-23 Francois Chouinard Contribution for Bug325661 Providing int IDs for the Stats HashMaps * src/org/eclipse/linuxtools/lttng/LttngConstants.java: * src/org/eclipse/linuxtools/lttng/event/LttngEvent.java: * src/org/eclipse/linuxtools/lttng/event/LttngEventType.java: * src/org/eclipse/linuxtools/lttng/model/LTTngTreeNodeGeneric.java: * src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java: * src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java: * src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java: * src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java: * src/org/eclipse/linuxtools/lttng/state/model/LttngTraceState.java: * src/org/eclipse/linuxtools/lttng/state/resource/ILttngStateContext.java: * src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java: * src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java: Adjusted buffering between checkpoints * src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java: Ditto * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java: Ditto Adjusted tests to new API * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java: * src/org/eclipse/linuxtools/lttng/state/resource/LTTngStateResourceTest.java: * src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTest.java: * src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTypeTest.java: * src/org/eclipse/linuxtools/lttng/tests/state/handlers/after/StateAfterUpdateHandlers.java: * src/org/eclipse/linuxtools/lttng/tests/state/handlers/before/StateBeforeUpdateHandlers.java: * src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java: Adjusted background request block size * src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java: Adjusted buffering between checkpoints --- org.eclipse.linuxtools.lttng.tests/ChangeLog | 9 + .../StateExperimentManagerTextTest.java | 3 +- .../resource/LTTngStateResourceTest.java | 5 + .../lttng/tests/event/LttngEventTest.java | 4 +- .../lttng/tests/event/LttngEventTypeTest.java | 4 +- .../after/StateAfterUpdateHandlers.java | 6 +- .../before/StateBeforeUpdateHandlers.java | 6 +- .../linuxtools/lttng/ui/TraceDebug.java | 420 ++++--- .../ui/views/common/AbsTimeUpdateView.java | 2 +- .../ui/views/controlflow/ControlFlowView.java | 2 +- .../ui/views/statistics/StatisticsView.java | 52 +- .../ui/views/statistics/model/FixedArray.java | 154 +-- .../model/KernelStatisticsData.java | 1057 +++++++++++++---- .../statistics/model/StatisticsData.java | 201 ++-- .../statistics/model/StatisticsTreeNode.java | 74 +- org.eclipse.linuxtools.lttng/ChangeLog | 18 + .../linuxtools/lttng/LttngConstants.java | 72 ++ .../linuxtools/lttng/event/LttngEvent.java | 9 + .../lttng/event/LttngEventType.java | 11 +- .../lttng/model/LTTngTreeNodeGeneric.java | 7 +- .../evProcessor/state/AbsStateUpdate.java | 4 +- .../state/StateUpdateHandlers.java | 66 +- .../state/model/LttngExecutionState.java | 32 +- .../lttng/state/model/LttngProcessState.java | 13 +- .../lttng/state/model/LttngTraceState.java | 102 +- .../state/resource/ILttngStateContext.java | 6 + .../lttng/state/trace/StateTraceManager.java | 11 +- .../lttng/trace/LTTngExperiment.java | 2 +- .../lttng/trace/LTTngTextTrace.java | 2 +- .../linuxtools/lttng/trace/LTTngTrace.java | 8 +- org.eclipse.linuxtools.tmf/ChangeLog | 5 + .../tmf/component/TmfDataProvider.java | 2 +- .../linuxtools/tmf/trace/TmfTrace.java | 2 +- 33 files changed, 1529 insertions(+), 842 deletions(-) create mode 100644 org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/LttngConstants.java diff --git a/org.eclipse.linuxtools.lttng.tests/ChangeLog b/org.eclipse.linuxtools.lttng.tests/ChangeLog index 33abc0f178..5177c70e13 100644 --- a/org.eclipse.linuxtools.lttng.tests/ChangeLog +++ b/org.eclipse.linuxtools.lttng.tests/ChangeLog @@ -1,3 +1,12 @@ +2010-11-23 Francois Chouinard Adjusted tests to new API + + * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java: + * src/org/eclipse/linuxtools/lttng/state/resource/LTTngStateResourceTest.java: + * src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTest.java: + * src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTypeTest.java: + * src/org/eclipse/linuxtools/lttng/tests/state/handlers/after/StateAfterUpdateHandlers.java: + * src/org/eclipse/linuxtools/lttng/tests/state/handlers/before/StateBeforeUpdateHandlers.java: + 2010-11-10 Francois Chouinard * src/org/eclipse/linuxxtools/lttng/tests/headless/JniTraceTest.java: New file. diff --git a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java index 814c94ffea..2c1d6fa2c1 100644 --- a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java +++ b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.linuxtools.lttng.state.experiment; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.LttngTestPreparation; import org.eclipse.linuxtools.lttng.event.LttngEvent; import org.eclipse.linuxtools.lttng.model.LTTngTreeNode; @@ -80,7 +81,7 @@ public class StateExperimentManagerTextTest extends LttngTestPreparation { // access to the context tree LTTngTreeNode experimentNode = expManager.getSelectedExperiment(); StateTraceManager traceManager = (StateTraceManager) experimentNode - .getChildById(0L); + .getChildById(1L | LttngConstants.STATS_TRACE_NAME_ID); // validate int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length; diff --git a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/resource/LTTngStateResourceTest.java b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/resource/LTTngStateResourceTest.java index 686188c180..a2ee59b89c 100644 --- a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/resource/LTTngStateResourceTest.java +++ b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/resource/LTTngStateResourceTest.java @@ -126,6 +126,11 @@ public class LTTngStateResourceTest extends TestCase { public String getExperimentName() { return "Test Experiment"; } + + @Override + public long getIdentifier() { + return 0; + } }; } diff --git a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTest.java b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTest.java index 3ce3e99abe..f713dcf887 100644 --- a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTest.java +++ b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTest.java @@ -111,7 +111,7 @@ public class LttngEventTest extends TestCase { testEvent = null; testTime = new LttngTimestamp(0L); testSource = new TmfEventSource("test"); - testType = new LttngEventType("test", 0L, "test", testMarkerFields); + testType = new LttngEventType("test", 0L, "test", 0, testMarkerFields); testContent = new LttngEventContent(testEvent); testReference = new LttngEventReference("test", "test"); } @@ -180,7 +180,7 @@ public class LttngEventTest extends TestCase { JniEvent testJniEvent = null; String[] testMarkerFields = new String[1]; - testType = new LttngEventType("test", 0L, "test", testMarkerFields); + testType = new LttngEventType("test", 0L, "test", 0, testMarkerFields); testContent = new LttngEventContent(testEvent); try { diff --git a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTypeTest.java b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTypeTest.java index c55ce5da56..8adcb3ef3f 100644 --- a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTypeTest.java +++ b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/event/LttngEventTypeTest.java @@ -84,7 +84,7 @@ public class LttngEventTypeTest extends TestCase { // Default construction with good arguments try { - tmpEventType = new LttngEventType("test", 0L, "test", new String[1]); + tmpEventType = new LttngEventType("test", 0L, "test", 0, new String[1]); } catch( Exception e) { fail("Construction failed!"); @@ -92,7 +92,7 @@ public class LttngEventTypeTest extends TestCase { // Copy constructor try { - tmpEventType = new LttngEventType("test", 0L, "test", new String[1]); + tmpEventType = new LttngEventType("test", 0L, "test", 0, new String[1]); tmpEventType2 = new LttngEventType(tmpEventType); } catch( Exception e) { diff --git a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/after/StateAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/after/StateAfterUpdateHandlers.java index 01c6ea67f2..efaa02d6b1 100644 --- a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/after/StateAfterUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/after/StateAfterUpdateHandlers.java @@ -42,8 +42,7 @@ class StateAfterUpdateHandlers { Long cpu = trcEvent.getCpuId(); // No syscall_entry update for initialization process - LttngProcessState process = traceSt.getRunning_process().get( - cpu); + LttngProcessState process = traceSt.getRunning_process().get(cpu); if (pid != process.getPid()) { TraceDebug @@ -92,8 +91,7 @@ class StateAfterUpdateHandlers { // TraceDebug.debug("Syscall Exit After event called"); Long cpu = trcEvent.getCpuId(); - LttngProcessState process = traceSt.getRunning_process().get( - cpu); + LttngProcessState process = traceSt.getRunning_process().get(cpu); /* There can be no system call from PID 0 : unknown state */ if (process.getPid() == 0L) { diff --git a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/before/StateBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/before/StateBeforeUpdateHandlers.java index efa9ed37a9..b1139e9911 100644 --- a/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/before/StateBeforeUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/state/handlers/before/StateBeforeUpdateHandlers.java @@ -42,8 +42,7 @@ class StateBeforeUpdateHandlers { Long cpu = trcEvent.getCpuId(); // No syscall_entry update for initialization process - LttngProcessState process = traceSt.getRunning_process().get( - cpu); + LttngProcessState process = traceSt.getRunning_process().get(cpu); pid = process.getPid(); if (pid == 0L) { @@ -88,8 +87,7 @@ class StateBeforeUpdateHandlers { public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { Long cpu = trcEvent.getCpuId(); - LttngProcessState process = traceSt.getRunning_process().get( - cpu); + LttngProcessState process = traceSt.getRunning_process().get(cpu); /* There can be no system call from PID 0 : unknown state */ pid = process.getPid(); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java index 47b77aa972..0e451cfe79 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java @@ -1,5 +1,6 @@ package org.eclipse.linuxtools.lttng.ui; + import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; @@ -14,218 +15,213 @@ import org.eclipse.core.runtime.Status; @SuppressWarnings("nls") public class TraceDebug { - static boolean DEBUG = false; - static boolean INFO = false; - static boolean WARN = false; - - static boolean CFV = false; - static boolean RV = false; - static boolean SV = false; - - private static Plugin plugin = LTTngUiPlugin.getDefault(); - private static String pluginID = LTTngUiPlugin.PLUGIN_ID; - private static SimpleDateFormat stimeformat = new SimpleDateFormat("HH:mm:ss:SSS"); - - // Note: files are created in $HOME - static private PrintWriter fCFVfile = null; - static private PrintWriter fRVfile = null; - static private PrintWriter fSVfile = null; - - - public static void init() { - // Update Trace configuration options - String debugTrace = Platform.getDebugOption(pluginID + "/debug"); - String infoTrace = Platform.getDebugOption(pluginID + "/info"); - String warnTrace = Platform.getDebugOption(pluginID + "/warn"); - - if (debugTrace != null) { - DEBUG = (new Boolean(debugTrace)).booleanValue(); - } - - if (infoTrace != null) { - INFO = (new Boolean(infoTrace)).booleanValue(); - } - - if (warnTrace != null) { - WARN = (new Boolean(warnTrace)).booleanValue(); - } - - String cfvTrace = Platform.getDebugOption(pluginID + "/cfv"); - if (cfvTrace != null) { - CFV = (new Boolean(cfvTrace)).booleanValue(); - if (CFV) { - try { - fCFVfile = new PrintWriter(new FileWriter("CFVTrace.txt")); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - String rvTrace = Platform.getDebugOption(pluginID + "/rv"); - if (rvTrace != null) { - RV = (new Boolean(rvTrace)).booleanValue(); - if (RV) { - try { - fRVfile = new PrintWriter(new FileWriter("RVTrace.txt")); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - String svTrace = Platform.getDebugOption(pluginID + "/sv"); - if (svTrace != null) { - SV = (new Boolean(svTrace)).booleanValue(); - if (SV) { - try { - fSVfile = new PrintWriter(new FileWriter("SVTrace.txt")); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - public static void stop() { - if (fCFVfile != null) { - fCFVfile.close(); - fCFVfile = null; - } - - if (fRVfile != null) { - fRVfile.close(); - fRVfile = null; - } - - if (fSVfile != null) { - fSVfile.close(); - fSVfile = null; - } - } - - public static void traceCFV(String trace) { - if (CFV && fCFVfile != null) { - fCFVfile.println(trace); - fCFVfile.flush(); - } - } - - public static void traceRV(String trace) { - if (RV && fRVfile != null) { - fRVfile.println(trace); - fRVfile.flush(); - } - } - - public static void traceSV(String trace) { - if (SV && fSVfile != null) { - fSVfile.println(trace); - fSVfile.flush(); - } - } - - public static void info(String message) { - if (INFO) { - ILog logger = plugin.getLog(); - logger.log(new Status(IStatus.INFO, LTTngUiPlugin.PLUGIN_ID, - IStatus.OK, message, null)); - } - } - - public static void warn(String message) { - if (WARN) { - ILog logger = plugin.getLog(); - logger.log(new Status(IStatus.WARNING, LTTngUiPlugin.PLUGIN_ID, - IStatus.WARNING, message, null)); - } - } - - public static void debug(String message) { - if (DEBUG) { - String location = getCallingLocation(); - System.out.println(location + "\n\t-> " + message); - - } - } - - public static void debug(String message, int additionalStackLines) { - if (DEBUG) { - String location = getCallingLocation(additionalStackLines); - System.out.println(location + "\n\t-> " + message); - } - } - - public static void throwException(String message) { - if (DEBUG) { - try { - triggerException(message); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - private static void triggerException(String message) throws Exception { - throw new Exception(message); - } - - private static String getCallingLocation() { - StringBuilder sb = new StringBuilder(); - sb.append(trace(Thread.currentThread().getStackTrace(), 4)); - sb.append("\n" + trace(Thread.currentThread().getStackTrace(), 3)); - return sb.toString(); - } - - private static String getCallingLocation(int numOfStackLines) { - int stackCalledFromIdx = 3; - int earliestRequested = numOfStackLines > 0 ? stackCalledFromIdx - + numOfStackLines : stackCalledFromIdx; - StringBuilder sb = new StringBuilder(); - for (int i = earliestRequested; i >= stackCalledFromIdx; i--) { - sb.append(trace(Thread.currentThread().getStackTrace(), i) + "\n"); - } - return sb.toString(); - } - - private static String trace(StackTraceElement e[], int level) { - if (e != null) { - level = level >= e.length ? e.length - 1 : level; - StackTraceElement s = e[level]; - if (s != null) { - String simpleClassName = s.getClassName(); - String[] clsNameSegs = simpleClassName.split("\\."); - if (clsNameSegs.length > 0) - simpleClassName = clsNameSegs[clsNameSegs.length - 1]; - return stimeformat.format(new Date()) + " " + simpleClassName - + "." + s.getLineNumber() + "." + s.getMethodName(); - } - } - - return null; - } - - public static boolean isDEBUG() { - return DEBUG; - } - - public static boolean isINFO() { - return INFO; - } - - public static boolean isWARN() { - return WARN; - } - - public static boolean isCFV() { - return CFV; - } - - public static boolean isRV() { - return RV; - } - - public static boolean isSV() { + static boolean DEBUG = false; + static boolean INFO = false; + static boolean WARN = false; + + static boolean CFV = false; + static boolean RV = false; + static boolean SV = false; + + private static Plugin plugin = LTTngUiPlugin.getDefault(); + private static String pluginID = LTTngUiPlugin.PLUGIN_ID; + private static SimpleDateFormat stimeformat = new SimpleDateFormat("HH:mm:ss:SSS"); + + // Note: files are created in $HOME + static private PrintWriter fCFVfile = null; + static private PrintWriter fRVfile = null; + static private PrintWriter fSVfile = null; + + public static void init() { + // Update Trace configuration options + String debugTrace = Platform.getDebugOption(pluginID + "/debug"); + String infoTrace = Platform.getDebugOption(pluginID + "/info"); + String warnTrace = Platform.getDebugOption(pluginID + "/warn"); + + if (debugTrace != null) { + DEBUG = (new Boolean(debugTrace)).booleanValue(); + } + + if (infoTrace != null) { + INFO = (new Boolean(infoTrace)).booleanValue(); + } + + if (warnTrace != null) { + WARN = (new Boolean(warnTrace)).booleanValue(); + } + + String cfvTrace = Platform.getDebugOption(pluginID + "/cfv"); + if (cfvTrace != null) { + CFV = (new Boolean(cfvTrace)).booleanValue(); + if (CFV) { + try { + fCFVfile = new PrintWriter(new FileWriter("CFVTrace.txt")); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + String rvTrace = Platform.getDebugOption(pluginID + "/rv"); + if (rvTrace != null) { + RV = (new Boolean(rvTrace)).booleanValue(); + if (RV) { + try { + fRVfile = new PrintWriter(new FileWriter("RVTrace.txt")); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + String svTrace = Platform.getDebugOption(pluginID + "/sv"); + if (svTrace != null) { + SV = (new Boolean(svTrace)).booleanValue(); + if (SV) { + try { + fSVfile = new PrintWriter(new FileWriter("SVTrace.txt")); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + public static void stop() { + if (fCFVfile != null) { + fCFVfile.close(); + fCFVfile = null; + } + + if (fRVfile != null) { + fRVfile.close(); + fRVfile = null; + } + + if (fSVfile != null) { + fSVfile.close(); + fSVfile = null; + } + } + + public static void traceCFV(String trace) { + if (CFV && fCFVfile != null) { + fCFVfile.println(trace); + fCFVfile.flush(); + } + } + + public static void traceRV(String trace) { + if (RV && fRVfile != null) { + fRVfile.println(trace); + fRVfile.flush(); + } + } + + public static void traceSV(String trace) { + if (SV && fSVfile != null) { + fSVfile.println(trace); + fSVfile.flush(); + } + } + + public static void info(String message) { + if (INFO) { + ILog logger = plugin.getLog(); + logger.log(new Status(IStatus.INFO, LTTngUiPlugin.PLUGIN_ID, IStatus.OK, message, null)); + } + } + + public static void warn(String message) { + if (WARN) { + ILog logger = plugin.getLog(); + logger.log(new Status(IStatus.WARNING, LTTngUiPlugin.PLUGIN_ID, IStatus.WARNING, message, null)); + } + } + + public static void debug(String message) { + if (DEBUG) { + String location = getCallingLocation(); + System.out.println(location + "\n\t-> " + message); + + } + } + + public static void debug(String message, int additionalStackLines) { + if (DEBUG) { + String location = getCallingLocation(additionalStackLines); + System.out.println(location + "\n\t-> " + message); + } + } + + public static void throwException(String message) { + if (DEBUG) { + try { + triggerException(message); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + private static void triggerException(String message) throws Exception { + throw new Exception(message); + } + + private static String getCallingLocation() { + StringBuilder sb = new StringBuilder(); + sb.append(trace(Thread.currentThread().getStackTrace(), 4)); + sb.append("\n" + trace(Thread.currentThread().getStackTrace(), 3)); + return sb.toString(); + } + + private static String getCallingLocation(int numOfStackLines) { + int stackCalledFromIdx = 3; + int earliestRequested = numOfStackLines > 0 ? stackCalledFromIdx + numOfStackLines : stackCalledFromIdx; + StringBuilder sb = new StringBuilder(); + for (int i = earliestRequested; i >= stackCalledFromIdx; i--) { + sb.append(trace(Thread.currentThread().getStackTrace(), i) + "\n"); + } + return sb.toString(); + } + + private static String trace(StackTraceElement e[], int level) { + if (e != null) { + level = level >= e.length ? e.length - 1 : level; + StackTraceElement s = e[level]; + if (s != null) { + String simpleClassName = s.getClassName(); + String[] clsNameSegs = simpleClassName.split("\\."); + if (clsNameSegs.length > 0) + simpleClassName = clsNameSegs[clsNameSegs.length - 1]; + return stimeformat.format(new Date()) + " " + simpleClassName + "." + s.getLineNumber() + "." + s.getMethodName(); + } + } + + return null; + } + + public static boolean isDEBUG() { + return DEBUG; + } + + public static boolean isINFO() { + return INFO; + } + + public static boolean isWARN() { + return WARN; + } + + public static boolean isCFV() { + return CFV; + } + + public static boolean isRV() { + return RV; + } + + public static boolean isSV() { return SV; } } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java index 3b52200aa9..6b2d79ef73 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java @@ -69,7 +69,7 @@ public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatu /** * Number of events before a GUI refresh */ - protected static final Long INPUT_CHANGED_REFRESH = 20000L; + protected static final Long INPUT_CHANGED_REFRESH = 75000L; private static final long DEFAULT_OFFSET = 0L; private static final int DEFAULT_CHUNK = 1; diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java index 08fb940b0e..7b1ef43cfb 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java @@ -935,7 +935,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements tableViewer.getTable().getDisplay().asyncExec(new Runnable() { @Override public void run() { - if ((scrollFrame != null) && (!scrollFrame.getDisplay().isDisposed())) { + if ((scrollFrame != null) && (!scrollFrame.isDisposed())) { updateScrolls(scrollFrame); } } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java index 6691b98d77..809e87a6ab 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java @@ -28,13 +28,16 @@ import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.linuxtools.lttng.control.LttngCoreProviderFactory; +import org.eclipse.linuxtools.lttng.model.LTTngTreeNode; import org.eclipse.linuxtools.lttng.request.ILttngSyntEventRequest; import org.eclipse.linuxtools.lttng.state.evProcessor.AbsEventToHandlerResolver; +import org.eclipse.linuxtools.lttng.state.experiment.StateManagerFactory; import org.eclipse.linuxtools.lttng.ui.TraceDebug; import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer; import org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView; import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater; import org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor.StatsTimeCountHandlerFactory; +import org.eclipse.linuxtools.lttng.ui.views.statistics.model.KernelStatisticsData; import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeNode; import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeRootFactory; import org.eclipse.linuxtools.tmf.event.TmfEvent; @@ -88,14 +91,20 @@ public class StatisticsView extends AbsTimeUpdateView { private final String ELAPSED_TIME_COLUMN_TIP = Messages.StatisticsView_ElapsedTimeTip; // Level for which statistics should not be displayed. - private Set folderLevels = new HashSet(Arrays.asList( - new String[] { "Event Types", "Modes", "Submodes", "CPUs", "Processes", "Functions" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + private Set folderLevels = new HashSet(Arrays + .asList(new Integer[] { KernelStatisticsData.HEADER_CPUS_INT, + KernelStatisticsData.HEADER_EVENT_TYPES_INT, + KernelStatisticsData.HEADER_FUNCTIONS_INT, + KernelStatisticsData.HEADER_MODES_INT, + KernelStatisticsData.HEADER_PROCESSES_INT, + KernelStatisticsData.HEADER_SUBMODES_INT })); // Levels for which sub-levels should not contain time-related statistics. - private Set levelsWithEmptyTime = new HashSet(Arrays.asList( - new String[] { "Event Types" })); //$NON-NLS-1$ + private Set levelsWithEmptyTime = new HashSet(Arrays + .asList(new Integer[] { KernelStatisticsData.HEADER_EVENT_TYPES_INT })); private DecimalFormat decimalFormat = new DecimalFormat("0.#########"); //$NON-NLS-1$ + private Cursor fwaitCursor = null; private static final Long STATS_INPUT_CHANGED_REFRESH = 5000L; @@ -144,7 +153,12 @@ public class StatisticsView extends AbsTimeUpdateView { new ColumnLabelProvider() { @Override public String getText(Object element) { - return ((StatisticsTreeNode) element).getKey(); + StatisticsTreeNode node = (StatisticsTreeNode) element; + if (folderLevels.contains(node.getKey())) { + return (KernelStatisticsData.getCategoryFromId(node.getKey().intValue())); + } else { + return node.getName(); + } } @Override @@ -165,8 +179,9 @@ public class StatisticsView extends AbsTimeUpdateView { public int compare(Viewer viewer, Object e1, Object e2) { StatisticsTreeNode n1 = (StatisticsTreeNode) e1; StatisticsTreeNode n2 = (StatisticsTreeNode) e2; - - return n1.getKey().compareTo(n2.getKey()); + +// return n1.getKey().compareTo(n2.getKey()); + return n1.compareTo(n2); } }, null), new ColumnData(EVENTS_COUNT_COLUMN, 125, SWT.LEFT, @@ -560,7 +575,7 @@ public class StatisticsView extends AbsTimeUpdateView { public void modelInputChanged(ILttngSyntEventRequest request, boolean complete) { // Ignore update if disposed if (treeViewer.getTree().isDisposed()) return; - + if(TraceDebug.isSV() && complete) { // print results @@ -569,7 +584,7 @@ public class StatisticsView extends AbsTimeUpdateView { StatisticsTreeNode node = StatisticsTreeRootFactory.getStatTreeRoot(experiment.getName()); printRecursively(node); - } + } } treeViewer.getTree().getDisplay().asyncExec(new Runnable() { @@ -581,17 +596,19 @@ public class StatisticsView extends AbsTimeUpdateView { } }); } + private static int level = 0; - private void printRecursively(StatisticsTreeNode node) { - String tab = ""; //$NON-NLS-1$ - for (int i = 0; i < level; i++) { + private void printRecursively(StatisticsTreeNode node) { + String tab = ""; //$NON-NLS-1$ + for (int i = 0; i < level; i++) { tab += "\t"; //$NON-NLS-1$ } - level++; + level++; TraceDebug.traceSV(tab + node.getContent()); if (node.hasChildren()) { LinkedList childreen = (LinkedList)node.getChildren(); Collections.sort(childreen); + for (Iterator iterator = childreen.iterator(); iterator.hasNext();) { StatisticsTreeNode statisticsTreeNode = (StatisticsTreeNode) iterator.next(); printRecursively(statisticsTreeNode); @@ -632,7 +649,9 @@ public class StatisticsView extends AbsTimeUpdateView { StatisticsTreeNode experimentTreeNode = StatisticsTreeRootFactory.getStatTreeRoot(experimentName); ITmfTrace[] traces = experiment.getTraces(); - + + LTTngTreeNode expNode = StateManagerFactory.getExperimentManager().getSelectedExperiment(); + // check if there is partial data loaded in the experiment int numTraces = experiment.getTraces().length; int numNodeTraces = experimentTreeNode.getNbChildren(); @@ -643,7 +662,8 @@ public class StatisticsView extends AbsTimeUpdateView { // previously selected for (int i = 0; i < numTraces; i++) { String traceName = traces[i].getName(); - if (!experimentTreeNode.containsChild(traceName)) { + LTTngTreeNode child = expNode.getChildByName(traceName); + if ((child == null) || (!experimentTreeNode.containsChild(child.getId().intValue()))) { same = false; break; } @@ -726,4 +746,4 @@ public class StatisticsView extends AbsTimeUpdateView { protected int getProviderId() { return LttngCoreProviderFactory.STATISTICS_LTTNG_SYTH_EVENT_PROVIDER; } -} +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java index 8b310b6a0b..f09036e76b 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java @@ -12,10 +12,7 @@ package org.eclipse.linuxtools.lttng.ui.views.statistics.model; -import java.lang.reflect.Array; -import java.util.AbstractList; import java.util.Arrays; -import java.util.List; import java.util.RandomAccess; /** @@ -29,34 +26,19 @@ import java.util.RandomAccess; * * @param Type of the array content. */ -public final class FixedArray extends AbstractList implements RandomAccess { +public final class FixedArray implements RandomAccess { /** * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist in java 5. - * @param Content of the array. - * @param array Original array to copy from. - * @param newLength Length of the copy to be returned. - * @return A new array consisting of the elements specified. - */ - @SuppressWarnings("unchecked") - private static E[] copyOf(final E[] array, int newLength) { - E[] result = (E[])Array.newInstance(array.getClass().getComponentType(), newLength); // Is it useful to use newInstance? - System.arraycopy(array, 0, result, 0, Math.min(array.length, newLength)); - return result; - } - /** - * Replace {@link java.util.Arrays#copyOf(Object[], int, Class)} that do not exist in java 5. - * @param Content of the array. * @param array Original array to copy from. * @param newLength Length of the copy to be returned. - * @param newType Type of the array to be returned. * @return A new array consisting of the elements specified. */ - @SuppressWarnings("unchecked") - private static E[] copyOf(final U[] array, int newLength, Class newType) { - E[] result = (E[])Array.newInstance(newType.getComponentType(), newLength); + private static int[] copyOf(final int[] array, int newLength) { + int[] result = new int[newLength]; // Is it useful to use newInstance? System.arraycopy(array, 0, result, 0, Math.min(array.length, newLength)); return result; } + /** * Replace {@link java.util.Arrays#copyOfRange(Object[], int, int)} that do not exist in java 5. * @param Content of the array. @@ -65,21 +47,21 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param end Ending position of the range. * @return A new array consisting of the elements specified. */ - @SuppressWarnings("unchecked") - private static E[] copyOfRange(final E[] array, int start, int end) { - E[] result = (E[])Array.newInstance(array.getClass().getComponentType(), end - start); + private static int[] copyOfRange(final int[] array, int start, int end) { + int[] result = new int[end - start]; System.arraycopy(array, start, result, 0, end - start); return result; } /** * The array. */ - private final T[] fArray; + private final int[] fArray; + /** * Constructor. * @param array Array to use. WILL NOT BE COPIED. */ - public FixedArray(final T... array) { + public FixedArray(final int... array) { fArray = array; } /** @@ -87,8 +69,8 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param value The FixedArray to append. * @return A new FixedArray with the elements of the two FixedArray. */ - public FixedArray append(final FixedArray value) { - FixedArray result = new FixedArray(copyOf(fArray, fArray.length + value.size())); + public FixedArray append(final FixedArray value) { + FixedArray result = new FixedArray(copyOf(fArray, fArray.length + value.size())); System.arraycopy(value.fArray, 0, result.fArray, fArray.length, value.fArray.length); return result; } @@ -97,13 +79,13 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param values The FixedArrays to append. * @return A new FixedArray with the element of all the FixedArray. */ - public FixedArray append(final FixedArray... values) { + public FixedArray append(final FixedArray... values) { int newLength = 0; - for(FixedArray value : values) + for(FixedArray value : values) newLength += value.size(); - FixedArray result = new FixedArray(copyOf(fArray, fArray.length + newLength)); + FixedArray result = new FixedArray(copyOf(fArray, fArray.length + newLength)); newLength = fArray.length; - for(FixedArray value : values) + for(FixedArray value : values) { System.arraycopy(value.fArray, 0, result.fArray, newLength, value.fArray.length); newLength += value.fArray.length; @@ -115,9 +97,9 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param value Element to append. * @return A new FixedArray with the element appended. */ - public FixedArray append(final T value) { - FixedArray result = new FixedArray(copyOf(fArray, fArray.length + 1)); - result.set(fArray.length, value); + public FixedArray append(final int value) { + FixedArray result = new FixedArray(copyOf(fArray, fArray.length + 1)); + result.fArray[fArray.length] = value; return result; } /** @@ -125,10 +107,10 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param values Elements array to append. * @return A new FixedArray with the elements appended. */ - public FixedArray append(final T... values) { - FixedArray result = new FixedArray(copyOf(fArray, fArray.length + values.length)); + public FixedArray append(final int... values) { + FixedArray result = new FixedArray(copyOf(fArray, fArray.length + values.length)); for(int i = 0; i < values.length; ++i) - result.set(fArray.length + i, values[i]); + result.fArray[fArray.length + i] = values[i]; return result; } /* @@ -136,31 +118,23 @@ public final class FixedArray extends AbstractList implements RandomAccess * @see java.lang.Object#clone() */ @Override - public Object clone() - { - return new FixedArray(copyOf(fArray, fArray.length)); + public Object clone() { + return new FixedArray(copyOf(fArray, fArray.length)); } /* * (non-Javadoc) - * @see java.util.AbstractList#equals(java.lang.Object) + * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { - if(o instanceof FixedArray) - return Arrays.equals(fArray, ((FixedArray)o).fArray); - if(!(o instanceof List)) - return false; - for(int i = 0; i < fArray.length; ++i) - if(!fArray[i].equals((List)o)) - return false; - return true; + return Arrays.equals(fArray, ((FixedArray)o).fArray); } - /* - * (non-Javadoc) - * @see java.util.AbstractList#get(int) + /** + * Gets value of given index. + * @param index + * @return Value of given index */ - @Override - public T get(int index) { + public int get(int index) { return fArray[index]; } /** @@ -168,32 +142,36 @@ public final class FixedArray extends AbstractList implements RandomAccess * @return The array reference. * @see #toArray FixedArray.toArray() to get a copy of the array. */ - public T[] getArray() { + public int[] getArray() { return fArray; } /* * (non-Javadoc) - * @see java.util.AbstractList#hashCode() + * @see java.lang.Object#hashCode() */ @Override public int hashCode() { - return Arrays.hashCode(fArray); + int hash = 1; + for (int i = 0; i < fArray.length; ++i) { + hash = hash ^ fArray[i]; + } + return hash; } - /* - * (non-Javadoc) - * @see java.util.AbstractList#set(int, java.lang.Object) - */ - @Override - public T set(int index, T element) { - T temp = fArray[index]; - fArray[index] = element; + /** + * Sets value at given index. + * @param index + * @param value + * @return returns old value. + */ + public int set(int index, int value) { + int temp = fArray[index]; + fArray[index] = value; return temp; } - /* - * (non-Javadoc) - * @see java.util.AbstractCollection#size() + /** + * Gets the size of the array. + * @return Size of the array. */ - @Override public int size() { return fArray.length; } @@ -202,8 +180,8 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param start Starting position of the new array. * @return A new array covering the elements specified. */ - public FixedArray subArray(int start) { - return new FixedArray(copyOfRange(fArray, start, fArray.length - 1)); + public FixedArray subArray(int start) { + return new FixedArray(copyOfRange(fArray, start, fArray.length - 1)); } /** * Get a array covering only a part of the array. @@ -211,36 +189,12 @@ public final class FixedArray extends AbstractList implements RandomAccess * @param length Number of element to include in the new array. * @return A new array covering the elements specified. */ - public FixedArray subArray(int start, int length) { - return new FixedArray(copyOfRange(fArray, start, length + start)); - } - /* - * (non-Javadoc) - * @see java.util.AbstractCollection#toArray() - */ - @Override - public T[] toArray() - { - return copyOf(fArray, fArray.length); - } - /* - * (non-Javadoc) - * @see java.util.AbstractCollection#toArray(T[]) - */ - @Override - @SuppressWarnings("unchecked") - public E[] toArray(E[] array) - { - if(array.length < fArray.length) - return copyOf(fArray, fArray.length,(Class)array.getClass()); - System.arraycopy(fArray, 0, array, 0, fArray.length); - if(array.length > fArray.length) - array[fArray.length] = null; - return array; + public FixedArray subArray(int start, int length) { + return new FixedArray(copyOfRange(fArray, start, length + start)); } /* * (non-Javadoc) - * @see java.util.AbstractCollection#toString() + * @see java.lang.Object#toString() */ @Override public String toString() { diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java index fc173c585d..dcb6280b50 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java @@ -13,11 +13,13 @@ package org.eclipse.linuxtools.lttng.ui.views.statistics.model; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Set; import java.util.Map; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.event.LttngEvent; import org.eclipse.linuxtools.lttng.state.StateStrings.ExecutionMode; import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus; @@ -29,29 +31,96 @@ import org.eclipse.linuxtools.lttng.state.model.LttngTraceState; */ public class KernelStatisticsData extends StatisticsData { /** - *

Header for the mode categories.

+ *

Header for the CPU categories.

*/ - private static final String HEADER_CPUS = Messages.KernelStatisticsData_CPUs; + public static final String HEADER_CPUS = Messages.KernelStatisticsData_CPUs; + public static final int HEADER_CPUS_INT = 256 | LttngConstants.STATS_CATEGORY_ID; /** *

Header for the event types categories.

*/ - private static final String HEADER_EVENT_TYPES = Messages.KernelStatisticsData_EventTypes; + public static final String HEADER_EVENT_TYPES = Messages.KernelStatisticsData_EventTypes; + public static final int HEADER_EVENT_TYPES_INT = (HEADER_CPUS_INT + 1) | LttngConstants.STATS_CATEGORY_ID; /** *

Header for the function categories.

*/ - private static final String HEADER_FUNCTIONS = Messages.KernelStatisticsData_Functions; + public static final String HEADER_FUNCTIONS = Messages.KernelStatisticsData_Functions; + public static final int HEADER_FUNCTIONS_INT = (HEADER_EVENT_TYPES_INT + 1) | LttngConstants.STATS_CATEGORY_ID; /** *

Header for the mode categories.

*/ - private static final String HEADER_MODES = Messages.KernelStatisticsData_Modes; + public static final String HEADER_MODES = Messages.KernelStatisticsData_Modes; + public static final int HEADER_MODES_INT = (HEADER_FUNCTIONS_INT + 1) | LttngConstants.STATS_CATEGORY_ID; /** *

Header for the processes categories.

*/ - private static final String HEADER_PROCESSES = Messages.KernelStatisticsData_Processes; + public static final String HEADER_PROCESSES = Messages.KernelStatisticsData_Processes; + public static final int HEADER_PROCESSES_INT = (HEADER_MODES_INT + 1) | LttngConstants.STATS_CATEGORY_ID; /** *

Header for the submode categories.

*/ - private static final String HEADER_SUBMODES = Messages.KernelStatisticsData_SubModes; + public static final String HEADER_SUBMODES = Messages.KernelStatisticsData_SubModes; + public static final int HEADER_SUBMODES_INT = (HEADER_PROCESSES_INT + 1) | LttngConstants.STATS_CATEGORY_ID; + + /** + *

Class to generate unique IDs for processes.

+ */ + private KeyProvider fPidKeys = new KeyProvider(LttngConstants.STATS_PROCESS_ID); + + /** + *

Class to generate unique Ids for event types.

+ */ + private KeyProvider fTypeKeys = new KeyProvider(LttngConstants.STATS_TYPE_ID); + /** + *

Class to generate unique Ids for subModes.

+ */ + private KeyProvider fSubModeKeys = new KeyProvider(); + + /** + *

Place Holder in path.

+ */ + private static final int PLACE_HOLDER = 0; + + /** + * For performance reason the following algorithm is applied to the paths: + * + * Each array entry has to be unique to form a unique path. To generate + * unique entries a bit mask is used, where the bit mask is applied to the + * upper N bits of an integer value. It is assumed, that each value that + * will be filled in the place holder below is smaller than 2 ^ (32 - N). + */ + + /** + *

Pre-created paths for type statistics, which will be filled for each + * relevant event.

+ */ + private final FixedArray[] fTypedPaths = { new FixedArray(PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), }; + /** + *

Pre-created paths for other statistics, which will be filled for each + * relevant event.

+ */ + final FixedArray[] fNormalPaths = { new FixedArray(PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), + new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), }; + /** *

Indicate that it's a value.

*

@@ -61,8 +130,8 @@ public class KernelStatisticsData extends StatisticsData { * It differentiate a category of a value by being appended to a value. *

*/ - private static final String NODE = "z"; //$NON-NLS-1$ - private static final String ROOT_NODE_KEY = mergeString(ROOT.get(0), NODE); + private static final Integer NODE = -1; + private static final Integer ROOT_NODE_KEY = -2; /** *

Constructor.

@@ -70,59 +139,60 @@ public class KernelStatisticsData extends StatisticsData { * @param traceName */ public KernelStatisticsData(String traceName) { - super(); - Map> keys = getKeys(); - - // //////////// Adding category sets - keys.put(HEADER_PROCESSES, new HashSet()); - keys.put(HEADER_MODES, new HashSet()); - keys.put(HEADER_CPUS, new HashSet(4)); // Over 4 CPUs is not - // common - keys.put(HEADER_SUBMODES, new HashSet()); - keys.put(HEADER_EVENT_TYPES, new HashSet()); - keys.put(HEADER_FUNCTIONS, new HashSet(4)); // Seems to be - // always one. - - // /////////// Adding value sets - // Under a trace - Set temp = new HashSet(8); - temp.add(HEADER_PROCESSES); - temp.add(HEADER_MODES); - temp.add(HEADER_CPUS); - temp.add(HEADER_EVENT_TYPES); - keys.put(ROOT_NODE_KEY, temp); - // Under a process - temp = new HashSet(4); - temp.add(HEADER_MODES); - temp.add(HEADER_CPUS); - temp.add(HEADER_EVENT_TYPES); - keys.put(mergeString(HEADER_PROCESSES, NODE), temp); - // Under a CPUs : Functions is a special case - temp = new HashSet(4); - temp.add(HEADER_MODES); - temp.add(HEADER_EVENT_TYPES); - keys.put(mergeString(HEADER_CPUS, NODE), temp); - // Under a functions - temp = new HashSet(4); - temp.add(HEADER_MODES); - temp.add(HEADER_EVENT_TYPES); - keys.put(mergeString(HEADER_FUNCTIONS, NODE), temp); - // Under a mode - temp = new HashSet(4); - temp.add(HEADER_SUBMODES); - temp.add(HEADER_EVENT_TYPES); - keys.put(mergeString(HEADER_MODES, NODE), temp); - // Under a submodes - temp = new HashSet(2); - temp.add(HEADER_EVENT_TYPES); - keys.put(mergeString(HEADER_SUBMODES, NODE), temp); - // Under an event type - temp = new HashSet(16); - keys.put(mergeString(HEADER_EVENT_TYPES, NODE), temp); - - // //////////// CREATE root - keys.put(ROOT.get(0), new HashSet(2)); // 1 trace at the time - getOrCreate(ROOT); + super(); + Map> keys = getKeys(); + + // //////////// Adding category sets + keys.put(HEADER_PROCESSES_INT, new HashSet()); + keys.put(HEADER_MODES_INT, new HashSet()); + keys.put(HEADER_CPUS_INT, new HashSet(4)); // Over 4 CPUs is + // not common + keys.put(HEADER_SUBMODES_INT, new HashSet()); + keys.put(HEADER_EVENT_TYPES_INT, new HashSet()); + keys.put(HEADER_FUNCTIONS_INT, new HashSet(4)); // Seems to be + // always one. + + // /////////// Adding value sets + // Under a trace + Set temp = new HashSet(8); + temp.add(HEADER_PROCESSES_INT); + temp.add(HEADER_MODES_INT); + temp.add(HEADER_CPUS_INT); + temp.add(HEADER_EVENT_TYPES_INT); + keys.put(ROOT_NODE_KEY, temp); + // Under a process + temp = new HashSet(4); + temp.add(HEADER_MODES_INT); + temp.add(HEADER_CPUS_INT); + temp.add(HEADER_EVENT_TYPES_INT); + keys.put(HEADER_PROCESSES_INT * NODE, temp); + // Under a CPUs : Functions is a special case + temp = new HashSet(4); + temp.add(HEADER_MODES_INT); + temp.add(HEADER_EVENT_TYPES_INT); + keys.put(HEADER_CPUS_INT * NODE, temp); + // Under a functions + temp = new HashSet(4); + temp.add(HEADER_MODES_INT); + temp.add(HEADER_EVENT_TYPES_INT); + keys.put(HEADER_FUNCTIONS_INT * NODE, temp); + // Under a mode + temp = new HashSet(4); + temp.add(HEADER_SUBMODES_INT); + temp.add(HEADER_EVENT_TYPES_INT); + keys.put(HEADER_MODES_INT * NODE, temp); + // Under a submodes + temp = new HashSet(2); + temp.add(HEADER_EVENT_TYPES_INT); + keys.put(HEADER_SUBMODES_INT * NODE, temp); + // Under an event type + temp = new HashSet(16); + keys.put(HEADER_EVENT_TYPES_INT * NODE, temp); + + // //////////// CREATE root + keys.put(ROOT.get(0), new HashSet(2)); // 1 trace at the time + StatisticsTreeNode node = getOrCreate(ROOT); + node.setName("root"); //$NON-NLS-1$ } /* @@ -135,24 +205,24 @@ public class KernelStatisticsData extends StatisticsData { */ @Override public void endTraceset(LttngEvent event, LttngTraceState traceState) { - // TODO Should we uncomment the rest? - // It include in the cpu time the time between the last event of each - // cpu and the time of the last global event. - // Because we know that there won't be a change of mode or process - // between those time. - /* - * if(last_ == null) return; - * - * LttngProcessState process = traceState.getRunning_process().get(0L); - * System.out.println(process.getState().getChange_LttTime()); for(long - * cpu : traceState.getRunning_process().keySet()) { LttngEventType - * newType = new LttngEventType(last_.getType().getTracefileName(), cpu, - * last_.getType().getMarkerName(), last_.getType().getLabels()); - * last_.setType(newType); increase(last_, traceState, Values.CPU_TIME | - * Values.CUMULATIVE_CPU_TIME | Values.ELAPSED_TIME | - * Values.STATE_CUMULATIVE_CPU_TIME); // TODO Are all those values - * required? } - */ + // TODO Should we uncomment the rest? + // It include in the cpu time the time between the last event of each + // cpu and the time of the last global event. + // Because we know that there won't be a change of mode or process + // between those time. + /* + * if(last_ == null) return; + * + * LttngProcessState process = traceState.getRunning_process().get(0L); + * System.out.println(process.getState().getChange_LttTime()); for(long + * cpu : traceState.getRunning_process().keySet()) { LttngEventType + * newType = new LttngEventType(last_.getType().getTracefileName(), cpu, + * last_.getType().getMarkerName(), last_.getType().getLabels()); + * last_.setType(newType); increase(last_, traceState, Values.CPU_TIME | + * Values.CUMULATIVE_CPU_TIME | Values.ELAPSED_TIME | + * Values.STATE_CUMULATIVE_CPU_TIME); // TODO Are all those values + * required? } + */ } /* @@ -164,45 +234,59 @@ public class KernelStatisticsData extends StatisticsData { * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray) */ @Override - public Collection getChildren(final FixedArray path) { - LinkedList result = new LinkedList(); - - if (path.size() % 2 == 0) { // if we are at a Category - StatisticsTreeNode current = null; - for (String value : getKeys().get(path.get(path.size() - 1))) { - current = get(path.append(value)); - if (current != null && current.getValue().nbEvents != 0) - result.add(current); - } - } else if (path.size() == 1) { // Special case. - if (path.equals(ROOT)) // Asking for the root. - for (String value : getKeys().get(ROOT.get(0))) - result.add(getOrCreate(new FixedArray(value))); - else - // Get value under the root - for (String value : getKeys().get(ROOT_NODE_KEY)) - result.add(getOrCreate(path.append(value))); - } else {// If we are at a value - for (String value : getKeys().get(mergeString(path.get(path.size() - 2), NODE))) - // Search the parent name + NODE - result.add(getOrCreate(path.append(value))); - - if (path.size() == 5 && path.get(3).equals(HEADER_CPUS)) // Special - // the - // Functions - // is just - // there. - // We want - // the - // fourth - // element - // but it - // start at - // 0. So #3 - result.add(getOrCreate(path.append(HEADER_FUNCTIONS))); - } - - return result; + public Collection getChildren(final FixedArray path) { + LinkedList result = new LinkedList(); + + if (path.size() % 2 == 0) { // if we are at a Category + StatisticsTreeNode current = null; + for (int value : getKeys().get(path.get(path.size() - 1))) { + current = get(path.append(value)); + if (current != null && current.getValue().nbEvents != 0) + result.add(current); + } + } else if (path.size() == 1) { // Special case. + if (path.equals(ROOT)) // Asking for the root. + for (int value : getKeys().get(ROOT.get(0))) + result.add(getOrCreate(new FixedArray(value))); + else + // Get value under the root + for (int value : getKeys().get(ROOT_NODE_KEY)) { + StatisticsTreeNode node = getOrCreate(path.append(value)); + node.setName(getCategoryFromId(value)); + result.add(node); + } + } else {// If we are at a value + for (int value : getKeys().get((path.get(path.size() - 2) * NODE))) { // Search + // the + // parent + // name + // + + // NODE + StatisticsTreeNode node = getOrCreate(path.append(value)); + node.setName(getCategoryFromId(value)); + result.add(node); + } + + if (path.size() == 5 && path.get(3) == HEADER_CPUS_INT) { // Special + // the + // Functions + // is just + // there. + // We want + // the + // fourth + // element + // but it + // start + // at 0. + // So #3 + StatisticsTreeNode node = getOrCreate(path.append(HEADER_FUNCTIONS_INT)); + node.setName(getCategoryFromId(HEADER_FUNCTIONS_INT)); + result.add(node); + } + } + + return result; } /** @@ -214,29 +298,110 @@ public class KernelStatisticsData extends StatisticsData { * State of the trace for this event. * @return Array of FixedArray representing the paths. */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private FixedArray[] getNormalPaths(LttngEvent event, LttngTraceState traceState) { - String trace = traceState.getContext().getTraceId(); - Long cpu = event.getCpuId(); - String cpus = String.valueOf(cpu); - LttngProcessState process = traceState.getRunning_process().get(cpu); - String processName = getProcessName(process); - String mode = process.getState().getExec_mode().getInName(); - String submode = process.getState().getExec_submode(); - String function = process.getCurrent_function().toString(); - - FixedArray[] paths = { new FixedArray(trace), new FixedArray(trace, HEADER_MODES, mode), new FixedArray(trace, HEADER_MODES, mode, HEADER_SUBMODES, submode), - new FixedArray(trace, HEADER_PROCESSES, processName), new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode, HEADER_SUBMODES, submode), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode, HEADER_SUBMODES, submode), new FixedArray(trace, HEADER_CPUS, cpus), - new FixedArray(trace, HEADER_CPUS, cpus, HEADER_MODES, mode), new FixedArray(trace, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode), }; - - return paths; + private FixedArray[] getNormalPaths(LttngEvent event, LttngTraceState traceState) { + int trace = (int) traceState.getContext().getIdentifier(); // No need + // for the + // identifier + // (already + // applied) + Long cpu = event.getCpuId(); + int cpus = cpu.intValue() | LttngConstants.STATS_CPU_ID; + LttngProcessState process = traceState.getRunning_process().get(cpu); + int processName = fPidKeys.getUniqueId(process.getPid().intValue(), process.getName()); + int mode = process.getState().getExec_mode().ordinal() | LttngConstants.STATS_MODE_ID; + int submode = fSubModeKeys.getUniqueId(process.getState().getExec_submode_id(), process.getState().getExec_submode()); + int function = process.getCurrent_function().intValue() | LttngConstants.STATS_FUNCTION_ID; + + /* + * Note that it's faster to re-use the path object, set the relevant + * fields and clone the path later when it's time to add to the map + */ + + // FixedArray(trace) + fNormalPaths[0].set(0, trace); + + // FixedArray(trace,HEADER_MODES_INT,mode) + fNormalPaths[1].set(0, trace); + fNormalPaths[1].set(2, mode); + + // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode) + fNormalPaths[2].set(0, trace); + fNormalPaths[2].set(2, mode); + fNormalPaths[2].set(4, submode); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName) + fNormalPaths[3].set(0, trace); + fNormalPaths[3].set(2, processName); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus) + fNormalPaths[4].set(0, trace); + fNormalPaths[4].set(2, processName); + fNormalPaths[4].set(4, cpus); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function) + fNormalPaths[5].set(0, trace); + fNormalPaths[5].set(2, processName); + fNormalPaths[5].set(4, cpus); + fNormalPaths[5].set(6, function); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function, + // HEADER_MODES_INT, mode) + fNormalPaths[6].set(0, trace); + fNormalPaths[6].set(2, processName); + fNormalPaths[6].set(4, cpus); + fNormalPaths[6].set(6, function); + fNormalPaths[6].set(8, mode); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function, + // HEADER_MODES_INT, mode, HEADER_SUBMODES_INT, submode) + fNormalPaths[7].set(0, trace); + fNormalPaths[7].set(2, processName); + fNormalPaths[7].set(4, cpus); + fNormalPaths[7].set(6, function); + fNormalPaths[7].set(8, mode); + fNormalPaths[7].set(10, submode); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode) + fNormalPaths[8].set(0, trace); + fNormalPaths[8].set(2, processName); + fNormalPaths[8].set(4, cpus); + fNormalPaths[8].set(6, mode); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode) + fNormalPaths[9].set(0, trace); + fNormalPaths[9].set(2, processName); + fNormalPaths[9].set(4, cpus); + fNormalPaths[9].set(6, mode); + fNormalPaths[9].set(8, submode); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode) + fNormalPaths[10].set(0, trace); + fNormalPaths[10].set(2, processName); + fNormalPaths[10].set(4, mode); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode) + fNormalPaths[11].set(0, trace); + fNormalPaths[11].set(2, processName); + fNormalPaths[11].set(4, mode); + fNormalPaths[11].set(6, submode); + + // FixedArray(trace,HEADER_CPUS_INT,cpus) + fNormalPaths[12].set(0, trace); + fNormalPaths[12].set(2, cpus); + + // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode) + fNormalPaths[13].set(0, trace); + fNormalPaths[13].set(2, cpus); + fNormalPaths[13].set(4, mode); + + // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode) + fNormalPaths[14].set(0, trace); + fNormalPaths[14].set(2, cpus); + fNormalPaths[14].set(4, mode); + fNormalPaths[14].set(6, submode); + + return fNormalPaths; + } /** @@ -248,35 +413,124 @@ public class KernelStatisticsData extends StatisticsData { * State of the trace for this event. * @return Array of FixedArray representing the paths. */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private FixedArray[] getTypePaths(LttngEvent event, LttngTraceState traceState) { - String trace = traceState.getContext().getTraceId(); - Long cpu = event.getCpuId(); - String cpus = String.valueOf(cpu); - LttngProcessState process = traceState.getRunning_process().get(cpu); - String processName = getProcessName(process); - String mode = process.getState().getExec_mode().getInName(); - String submode = process.getState().getExec_submode(); - String function = process.getCurrent_function().toString(); - // String type = event.getType().getTypeId(); // Add too much - // informations - String type = event.getMarkerName(); - - FixedArray[] paths = { new FixedArray(trace, HEADER_EVENT_TYPES, type), new FixedArray(trace, HEADER_MODES, mode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_FUNCTIONS, function, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_PROCESSES, processName, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_CPUS, cpus, HEADER_EVENT_TYPES, type), new FixedArray(trace, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_EVENT_TYPES, type), - new FixedArray(trace, HEADER_CPUS, cpus, HEADER_MODES, mode, HEADER_SUBMODES, submode, HEADER_EVENT_TYPES, type), }; - - return paths; + private FixedArray[] getTypePaths(LttngEvent event, LttngTraceState traceState) { + int trace = (int) traceState.getContext().getIdentifier(); // No need + // for the + // identifier + // (already + // applied) + Long cpu = event.getCpuId(); + int cpus = cpu.intValue() | LttngConstants.STATS_CPU_ID; + LttngProcessState process = traceState.getRunning_process().get(cpu); + int processName = fPidKeys.getUniqueId(process.getPid().intValue(), process.getName()); + int mode = process.getState().getExec_mode().ordinal() | LttngConstants.STATS_MODE_ID; + int submode = fSubModeKeys.getUniqueId(process.getState().getExec_submode_id(), process.getState().getExec_submode()); + int function = process.getCurrent_function().intValue() | LttngConstants.STATS_FUNCTION_ID; + int type = fTypeKeys.getUniqueId(event.getMarkerId(), event.getMarkerName()); + + /* + * Note that it's faster to re-use the path object, set the relevant + * fields and clone the path later when it's time to add to the map + */ + + // FixedArray(trace,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[0].set(0, trace); + fTypedPaths[0].set(2, type); + + // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[1].set(0, trace); + fTypedPaths[1].set(2, mode); + fTypedPaths[1].set(4, type); + + // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[2].set(0, trace); + fTypedPaths[2].set(2, mode); + fTypedPaths[2].set(4, submode); + fTypedPaths[2].set(6, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[3].set(0, trace); + fTypedPaths[3].set(2, processName); + fTypedPaths[3].set(4, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[4].set(0, trace); + fTypedPaths[4].set(2, processName); + fTypedPaths[4].set(4, cpus); + fTypedPaths[4].set(6, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[5].set(0, trace); + fTypedPaths[5].set(2, processName); + fTypedPaths[5].set(4, cpus); + fTypedPaths[5].set(6, function); + fTypedPaths[5].set(8, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[6].set(0, trace); + fTypedPaths[6].set(2, processName); + fTypedPaths[6].set(4, cpus); + fTypedPaths[6].set(6, function); + fTypedPaths[6].set(8, mode); + fTypedPaths[6].set(10, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function, + // HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[7].set(0, trace); + fTypedPaths[7].set(2, processName); + fTypedPaths[7].set(4, cpus); + fTypedPaths[7].set(6, function); + fTypedPaths[7].set(8, mode); + fTypedPaths[7].set(10, submode); + fTypedPaths[7].set(12, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[8].set(0, trace); + fTypedPaths[8].set(2, processName); + fTypedPaths[8].set(4, cpus); + fTypedPaths[8].set(6, mode); + fTypedPaths[8].set(8, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[9].set(0, trace); + fTypedPaths[9].set(2, processName); + fTypedPaths[9].set(4, cpus); + fTypedPaths[9].set(6, mode); + fTypedPaths[9].set(8, submode); + fTypedPaths[9].set(10, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[10].set(0, trace); + fTypedPaths[10].set(2, processName); + fTypedPaths[10].set(4, mode); + fTypedPaths[10].set(6, type); + + // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[11].set(0, trace); + fTypedPaths[11].set(2, processName); + fTypedPaths[11].set(4, mode); + fTypedPaths[11].set(6, submode); + fTypedPaths[11].set(8, type); + + // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[12].set(0, trace); + fTypedPaths[12].set(2, cpus); + fTypedPaths[12].set(4, type); + + // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[13].set(0, trace); + fTypedPaths[13].set(2, cpus); + fTypedPaths[13].set(4, mode); + fTypedPaths[13].set(6, type); + + // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type) + fTypedPaths[14].set(0, trace); + fTypedPaths[14].set(2, cpus); + fTypedPaths[14].set(4, mode); + fTypedPaths[14].set(6, submode); + fTypedPaths[14].set(8, type); + + return fTypedPaths; } /* @@ -289,20 +543,19 @@ public class KernelStatisticsData extends StatisticsData { */ @Override public void process_exit(LttngEvent event, LttngTraceState traceState) { - FixedArray[] paths = getNormalPaths(event, traceState); - Long cpu = event.getCpuId(); - LttngProcessState process = traceState.getRunning_process().get(cpu); - - for (FixedArray path : paths) { - StatisticsTreeNode node = getOrCreate(path); + FixedArray[] paths = getNormalPaths(event, traceState); + Long cpu = event.getCpuId(); + LttngProcessState process = traceState.getRunning_process().get(cpu); - if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { - node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime(); - } - } + for (int j = 0; j < paths.length; ++j) { + StatisticsTreeNode node = getOrCreate(paths[j], event, traceState, j, false); - // TODO Unstacks cumulative CPU time - // TODO Elapsed time? + if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { + node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime(); + } + } + // TODO Unstacks cumulative CPU time + // TODO Elapsed time? } /* @@ -315,64 +568,64 @@ public class KernelStatisticsData extends StatisticsData { */ @Override public void increase(LttngEvent event, LttngTraceState traceState, int values) { - FixedArray[] paths = getNormalPaths(event, traceState); - Long cpu = event.getCpuId(); - LttngProcessState process = traceState.getRunning_process().get(cpu); - - for (FixedArray path : paths) { - StatisticsTreeNode node = getOrCreate(path); - - if ((values & Values.CPU_TIME) != 0) { - // TODO Uncomment if the event after process_exit need to be - // count. - if ((process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) /* - * || - * process - * . - * getState - * ( - * ) - * . - * getProc_status - * ( - * ) - * . - * equals - * ( - * ProcessStatus - * . - * LTTV_STATE_EXIT - * ) - */) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { - node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime(); - } - } - if ((values & Values.CUMULATIVE_CPU_TIME) != 0) { - if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { - long cumulativeCpuTime = process.getState().getCum_cpu_time(); - long delta = event.getTimestamp().getValue() - process.getState().getEntry_LttTime(); - process.getState().setCum_cpu_time(cumulativeCpuTime + delta); - node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time(); - } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { - long cumulativeCpuTime = process.getState().getCum_cpu_time(); - long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime(); - process.getState().setCum_cpu_time(cumulativeCpuTime + delta); - node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time(); - } - } - if ((values & Values.ELAPSED_TIME) != 0) { - if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { - node.getValue().elapsedTime += event.getTimestamp().getValue() - process.getState().getEntry_LttTime(); - } - } - if ((values & Values.STATE_CUMULATIVE_CPU_TIME) != 0) { - if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { - long cumulativeCpuTime = process.getState().getCum_cpu_time(); - long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime(); - process.getState().setCum_cpu_time(cumulativeCpuTime + delta); - } - } - } + FixedArray[] paths = getNormalPaths(event, traceState); + Long cpu = event.getCpuId(); + LttngProcessState process = traceState.getRunning_process().get(cpu); + + for (int j = 0; j < paths.length; ++j) { + StatisticsTreeNode node = getOrCreate(paths[j], event, traceState, j, false); + + if ((values & Values.CPU_TIME) != 0) { + // TODO Uncomment if the event after process_exit need to be + // count. + if ((process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) /* + * || + * process + * . + * getState + * ( + * ) + * . + * getProc_status + * ( + * ) + * . + * equals + * ( + * ProcessStatus + * . + * LTTV_STATE_EXIT + * ) + */) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { + node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime(); + } + } + if ((values & Values.CUMULATIVE_CPU_TIME) != 0) { + if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { + long cumulativeCpuTime = process.getState().getCum_cpu_time(); + long delta = event.getTimestamp().getValue() - process.getState().getEntry_LttTime(); + process.getState().setCum_cpu_time(cumulativeCpuTime + delta); + node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time(); + } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { + long cumulativeCpuTime = process.getState().getCum_cpu_time(); + long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime(); + process.getState().setCum_cpu_time(cumulativeCpuTime + delta); + node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time(); + } + } + if ((values & Values.ELAPSED_TIME) != 0) { + if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { + node.getValue().elapsedTime += event.getTimestamp().getValue() - process.getState().getEntry_LttTime(); + } + } + if ((values & Values.STATE_CUMULATIVE_CPU_TIME) != 0) { + if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) { + long cumulativeCpuTime = process.getState().getCum_cpu_time(); + long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime(); + process.getState().setCum_cpu_time(cumulativeCpuTime + delta); + } + } + } } /* @@ -385,15 +638,15 @@ public class KernelStatisticsData extends StatisticsData { */ @Override public void registerEvent(LttngEvent event, LttngTraceState traceState) { - FixedArray[] paths = getNormalPaths(event, traceState); - for (FixedArray path : paths) - ++(getOrCreate(path).getValue().nbEvents); + FixedArray[] paths = getNormalPaths(event, traceState); + for (int i = 0; i < paths.length; ++i) + ++(getOrCreate(paths[i], event, traceState, i, false).getValue().nbEvents); - paths = getTypePaths(event, traceState); - for (FixedArray path : paths) - ++(getOrCreate(path).getValue().nbEvents); + paths = getTypePaths(event, traceState); + for (int i = 0; i < paths.length; ++i) + ++(getOrCreate(paths[i], event, traceState, i, true).getValue().nbEvents); - // last_ = event; // TODO Used by endTraceset + // last_ = event; // TODO Used by endTraceset } /* @@ -405,12 +658,306 @@ public class KernelStatisticsData extends StatisticsData { * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray) */ @Override - protected void registerName(final FixedArray path) { - if (path.size() == 1) { - if (!path.equals(ROOT)) - getKeys().get(ROOT.get(0)).add(path.get(0)); - } else if (path.size() % 2 != 0) - getKeys().get(path.get(path.size() - 2)).add(path.get(path.size() - 1)); + protected void registerName(final FixedArray path) { + if (path.size() == 1) { + if (!path.equals(ROOT)) + getKeys().get(ROOT.get(0)).add(path.get(0)); + } else if (path.size() % 2 != 0) + getKeys().get(path.get(path.size() - 2)).add(path.get(path.size() - 1)); + } + + /** + *

Get or create a node.

+ * + * @param path + * Path to the node. + * @param event + * The current event + * @param traceState + * The current trace state + * @param index + * The corresponding index of the statistic + * @param isType + * The type of statistic (type or other) + * @return The node. + */ + public StatisticsTreeNode getOrCreate(final FixedArray path, LttngEvent event, LttngTraceState traceState, int index, boolean isType) { + StatisticsTreeNode current = get(path); + if (current == null) { + // We have to clone the path since the object for the path is + // re-used for performance reasons! + FixedArray newPath = (FixedArray) path.clone(); + + // Note that setting of the name is done here only when the node is + // created (for performance reasons). + String name = (isType) ? getTypeStatsName(event, traceState, index) : getOtherStatsName(event, traceState, index); + registerName(path); + current = new StatisticsTreeNode(newPath, this, name); + put(newPath, current); + } + return current; + } + + /** + *

Get the name to be displayed for other statistics than type + * statistics

+ * + * @param event + * The current event + * @param traceState + * The current trace state + * @param The + * corresponding index of the statistic + * @return The name + */ + private String getOtherStatsName(LttngEvent event, LttngTraceState traceState, int index) { + Long cpu = event.getCpuId(); + LttngProcessState process = traceState.getRunning_process().get(cpu); + + switch (index) { + case 0: + return traceState.getContext().getTraceId(); + case 1: + return process.getState().getExec_mode().getInName(); + case 2: + return process.getState().getExec_submode(); + case 3: + return getProcessName(process); + case 4: + return String.valueOf(cpu); + case 5: + return process.getCurrent_function().toString(); + case 6: + return process.getState().getExec_mode().getInName(); + case 7: + return process.getState().getExec_submode(); + case 8: + return process.getState().getExec_mode().getInName(); + case 9: + return process.getState().getExec_submode(); + case 10: + return process.getState().getExec_mode().getInName(); + case 11: + return process.getState().getExec_submode(); + case 12: + return String.valueOf(cpu); + case 13: + return process.getState().getExec_mode().getInName(); + case 14: + return process.getState().getExec_submode(); + default: + return ""; //$NON-NLS-1$ + } + } + + /** + *

Get the name to be displayed for type statistics

+ * + * @param event + * The current event + * @param traceState + * The current state + * @param index + * The corresponding index of the statistic + * @return The strings in a array + */ + private String getTypeStatsName(LttngEvent event, LttngTraceState traceState, int index) { + return event.getMarkerName(); + } + + /** + *

Get the name of a process.

+ * + * @param process + * The process. + * @return The name of the process. //TODO Adding the creation time of the + * process may be needed to differentiate two process. + */ + private String getProcessName(LttngProcessState process) { + if (process.getPid() == -1) + return Messages.StatisticsData_UnknowProcess; + if (process.getName() == null) + return mergeString(Messages.StatisticsData_UnknowProcess + " - ", String.valueOf(process.getPid())); //$NON-NLS-1$ + if (process.getName().equals("")) //$NON-NLS-1$ + return process.getPid().toString(); + else + return mergeString(process.getName(), " - ", String.valueOf(process.getPid())); //$NON-NLS-1$ + } + + /** + *

Converts the integer representation of the category to string.

+ * + * @param value + * Integer representation of the category. + * @return Category as string. + */ + public static String getCategoryFromId(int value) { + switch (value) { + case KernelStatisticsData.HEADER_CPUS_INT: + return KernelStatisticsData.HEADER_CPUS; + case KernelStatisticsData.HEADER_EVENT_TYPES_INT: + return KernelStatisticsData.HEADER_EVENT_TYPES; + case KernelStatisticsData.HEADER_FUNCTIONS_INT: + return KernelStatisticsData.HEADER_FUNCTIONS; + case KernelStatisticsData.HEADER_MODES_INT: + return KernelStatisticsData.HEADER_MODES; + case KernelStatisticsData.HEADER_PROCESSES_INT: + return KernelStatisticsData.HEADER_PROCESSES; + case KernelStatisticsData.HEADER_SUBMODES_INT: + return KernelStatisticsData.HEADER_SUBMODES; + } + return ""; //$NON-NLS-1$ } -} + /** + *

Provides unique keys for String - Integer pairs.

+ * + * @author eedbhu + * + */ + final private class KeyProvider { + + /** + *

Instance counter for unique ID generation.

+ */ + private int fCount = 0; + + /** + *

Attributes to generate unique IDs for processes.

+ */ + private HashMap fKeyMap = new HashMap(65535); + private final KeyHelper fHelper = new KeyHelper(); + + /** + *

Bit mask to apply for the key.

+ */ + private int fBitMask = 0; + + /** + * Constructor + * + * @param bitMask + *

Bit mask to apply for the key.

+ */ + KeyProvider(int bitMask) { + this.fBitMask = bitMask; + } + + /** + *

Standard Constructor

+ */ + KeyProvider() { + this(0); + } + + /** + *

Creates unique id for the given input data.

+ * + * @param value + * Integer value of the data the key is for + * @param name + * Name of the data the key is for + * @param helper + * Helper class instance for the data the key is for + * @param map + * The map the keys are tracked + * @param bitMask + * The bit mask to apply for the key + * + * @return Unique id + */ + public int getUniqueId(int value, String name) { + fHelper.setName(name); + fHelper.setValue(value); + + Integer returnKey = fKeyMap.get(fHelper); + if (returnKey == null) { + returnKey = Integer.valueOf((++fCount) | fBitMask); + KeyHelper newHelper = fHelper.clone(); + fKeyMap.put(newHelper, returnKey); + } + return returnKey.intValue(); + } + } + + /** + * Helper class that provides for keys for HashMaps depending on an integer + * - string -pair. It provides better performance than using a string as key + * only. However, for optimal performance the integer values should mostly + * unique. + * + * @author eedbhu + * + */ + private class KeyHelper implements Cloneable { + + // Short pre-fix + private final static String UNKNOWN_PREFIX = "P"; //$NON-NLS-1$ + + private String fName = UNKNOWN_PREFIX; + private int fValue = -1; + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return fValue; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object o) { + if (fValue == ((KeyHelper) o).fValue && fName.equals(((KeyHelper) o).fName)) { + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public KeyHelper clone() { + KeyHelper clone = null; + try { + clone = (KeyHelper) super.clone(); + clone.fName = fName; + clone.fValue = fValue; + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + return clone; + } + + /** + *

Set the name of the key.

+ * + * @param name + * The name to set. + */ + public void setName(String name) { + if (fName != null) + this.fName = name; + else + this.fName = UNKNOWN_PREFIX; + } + + /** + *

Set the value of the key.

+ * + * @param value + */ + public void setValue(int value) { + this.fValue = value; + } + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java index d2b6c7818c..7589782948 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java @@ -18,7 +18,6 @@ import java.util.Map; import java.util.Set; import org.eclipse.linuxtools.lttng.event.LttngEvent; -import org.eclipse.linuxtools.lttng.state.model.LttngProcessState; import org.eclipse.linuxtools.lttng.state.model.LttngTraceState; /** @@ -36,52 +35,52 @@ public abstract class StatisticsData { *

*/ public static class Values { - /** - *

Indicate the cpu time

- *

- * The actual time the cpu as passed in this state making calculations. - *

- */ - public static final int CPU_TIME = 1; - /** - *

Indicate the cumulative cpu time

- *

- * Include the time the cpu as passed in this state and substate. - *

- *

- * Example: - *

    - *
  • PID:1, Mode:USER_MODE
  • - *
      - *
    • PID:1, Mode:SYSCALL
    • - *
    - *
  • PID:2, Mode:USER_MODE
  • - *
- *

- *

- * In this example, the cumulative cpu time for "PID:1, Mode:USER_MODE" - * would be equal to its cpu time plus the cpu time of - * "PID:1, Mode:SYSCALL". - *

- * TODO Validate values. Not tested in LTTv. TODO Validate description. - */ - public static final int CUMULATIVE_CPU_TIME = 2; - /** - *

Elapsed time

- *

- * Description... - *

- * TODO Give a correct description. - */ - public static final int ELAPSED_TIME = 4; - /** - *

State cumulative cpu time

- *

- * Description... - *

- * TODO Give a correct description. - */ - public static final int STATE_CUMULATIVE_CPU_TIME = 8; + /** + *

Indicate the cpu time

+ *

+ * The actual time the cpu as passed in this state making calculations. + *

+ */ + public static final int CPU_TIME = 1; + /** + *

Indicate the cumulative cpu time

+ *

+ * Include the time the cpu as passed in this state and substate. + *

+ *

+ * Example: + *

    + *
  • PID:1, Mode:USER_MODE
  • + *
      + *
    • PID:1, Mode:SYSCALL
    • + *
    + *
  • PID:2, Mode:USER_MODE
  • + *
+ *

+ *

+ * In this example, the cumulative cpu time for "PID:1, Mode:USER_MODE" + * would be equal to its cpu time plus the cpu time of + * "PID:1, Mode:SYSCALL". + *

+ * TODO Validate values. Not tested in LTTv. TODO Validate description. + */ + public static final int CUMULATIVE_CPU_TIME = 2; + /** + *

Elapsed time

+ *

+ * Description... + *

+ * TODO Give a correct description. + */ + public static final int ELAPSED_TIME = 4; + /** + *

State cumulative cpu time

+ *

+ * Description... + *

+ * TODO Give a correct description. + */ + public static final int STATE_CUMULATIVE_CPU_TIME = 8; } /** @@ -91,7 +90,7 @@ public abstract class StatisticsData { /** *

Identification of the root.

*/ - public static final FixedArray ROOT = new FixedArray("root"); //$NON-NLS-1$ + public static final FixedArray ROOT = new FixedArray(-1); /** *

Function to merge many string with more efficacy.

@@ -101,10 +100,10 @@ public abstract class StatisticsData { * @return A new string containing all the strings. */ protected synchronized static String mergeString(String... strings) { - fBuilder.setLength(0); - for (String s : strings) - fBuilder.append(s); - return fBuilder.toString(); + fBuilder.setLength(0); + for (String s : strings) + fBuilder.append(s); + return fBuilder.toString(); } /** @@ -116,18 +115,18 @@ public abstract class StatisticsData { * HashSet are always faster than TreeSet. *

*/ - private Map> fKeys; + private Map> fKeys; /** *

The nodes in the tree. */ - private HashMap, StatisticsTreeNode> fNodes; + private HashMap fNodes; /** *

Constructor.

*/ public StatisticsData() { - fNodes = new HashMap, StatisticsTreeNode>(); - fKeys = new HashMap>(); + fNodes = new HashMap(); + fKeys = new HashMap>(); } /** @@ -150,8 +149,21 @@ public abstract class StatisticsData { * Path to the node. * @return The node or null. */ - public StatisticsTreeNode get(final FixedArray path) { - return fNodes.get(path); + public StatisticsTreeNode get(final FixedArray path) { + return fNodes.get(path); + } + + /** + *

Put a node.

+ * + * @param path + * Path to the node. + * @param node + * Node to put. + * @return node if replaced. + */ + public StatisticsTreeNode put(final FixedArray path, StatisticsTreeNode node) { + return fNodes.put(path, node); } /** @@ -161,15 +173,15 @@ public abstract class StatisticsData { * Path to the node. * @return Collection containing the children. */ - public abstract Collection getChildren(final FixedArray path); + public abstract Collection getChildren(final FixedArray path); /** *

Get the map of existing elements of path classified by parent.

* * @return The map. */ - protected Map> getKeys() { - return fKeys; + protected Map> getKeys() { + return fKeys; } /** @@ -179,14 +191,14 @@ public abstract class StatisticsData { * Path to the node. * @return The node. */ - public StatisticsTreeNode getOrCreate(final FixedArray path) { - StatisticsTreeNode current = fNodes.get(path); - if (current == null) { - registerName(path); - current = new StatisticsTreeNode(path, this); - fNodes.put(path, current); - } - return current; + public StatisticsTreeNode getOrCreate(final FixedArray path) { + StatisticsTreeNode current = fNodes.get(path); + if (current == null) { + registerName(path); + current = new StatisticsTreeNode(path, this); + fNodes.put(path, current); + } + return current; } /** @@ -196,34 +208,15 @@ public abstract class StatisticsData { * Path to the node. * @return Parent node or null. */ - public StatisticsTreeNode getParent(final FixedArray path) { - if (path.size() == 1) { - if (path.equals(ROOT)) - return null; - else - return get(ROOT); - } - // TODO Get or GetOrCreate? - return get(path.subArray(0, path.size() - 1)); - } - - /** - *

Get the name of a process.

- * - * @param process - * The process. - * @return The name of the process. //TODO Adding the creation time of the - * process may be needed to differentiate two process. - */ - protected String getProcessName(LttngProcessState process) { - if (process.getPid() == -1) - return Messages.StatisticsData_UnknowProcess; - if (process.getName() == null) - return mergeString(Messages.StatisticsData_UnknowProcess + " - ", String.valueOf(process.getPid())); //$NON-NLS-1$ - if (process.getName().equals("")) //$NON-NLS-1$ - return process.getPid().toString(); - else - return mergeString(process.getName(), " - ", String.valueOf(process.getPid())); //$NON-NLS-1$ + public StatisticsTreeNode getParent(final FixedArray path) { + if (path.size() == 1) { + if (path.equals(ROOT)) + return null; + else + return get(ROOT); + } + // TODO Get or GetOrCreate? + return get(path.subArray(0, path.size() - 1)); } /** @@ -266,7 +259,7 @@ public abstract class StatisticsData { * @param path * Path of the new node. */ - protected abstract void registerName(final FixedArray path); + protected abstract void registerName(final FixedArray path); /** *

Reset a node.

@@ -277,11 +270,11 @@ public abstract class StatisticsData { * @param path * Path to the node. */ - public void reset(final FixedArray path) { - for (StatisticsTreeNode node : getChildren(path)) { - reset(node.getPath()); - fNodes.remove(node.getPath()); - } + public void reset(final FixedArray path) { + for (StatisticsTreeNode node : getChildren(path)) { + reset(node.getPath()); + fNodes.remove(node.getPath()); + } } /** @@ -293,4 +286,4 @@ public abstract class StatisticsData { * State of the trace at that moment. */ public abstract void process_exit(LttngEvent event, LttngTraceState traceState); -} +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java index c6a3989fcc..a286abfe09 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java @@ -28,29 +28,45 @@ public class StatisticsTreeNode implements Comparable { /** *

Path of the node.

*/ - private FixedArray fPath; + private FixedArray fPath; /** *

Corresponding StatisticsData.

*/ private StatisticsData fNodes; /** + *

Name of the node.

+ */ + private String fName = ""; //$NON-NLS-1$ + /** *

Constructor.

* @param path Path to the node. * @param nodes Corresponding StatisticsData. */ - public StatisticsTreeNode(final FixedArray path, StatisticsData nodes) { - fPath = path; - fNodes = nodes; - fValue = new Statistics(); + public StatisticsTreeNode(final FixedArray path, StatisticsData nodes) { + this(path, nodes, ""); //$NON-NLS-1$ } + + /** + *

Constructor.

+ * @param path Path to the node. + * @param nodes Corresponding StatisticsData. + * @param name The name associated with this node. + */ + public StatisticsTreeNode(final FixedArray path, StatisticsData nodes, String name) { + fPath = path; + fNodes = nodes; + fName = name; + fValue = new Statistics(); + } + /** *

Test if a node contain the specified child.

* @param key Name of the child. * @return true: if child with given key is present, false: if no child exists with given key name */ - public boolean containsChild(String key) { - if(StatisticsData.ROOT.equals(fPath)) - return fNodes.get(new FixedArray(key)) != null; + public boolean containsChild(Integer key) { + if(StatisticsData.ROOT == fPath) + return fNodes.get(new FixedArray(key)) != null; return (fNodes.get(fPath.append(key)) != null); } /** @@ -64,7 +80,7 @@ public class StatisticsTreeNode implements Comparable { *

Get the key for this node.

* @return Key associated with this node. */ - public String getKey() { + public Integer getKey() { return fPath.get(fPath.size() - 1); } /** @@ -85,7 +101,7 @@ public class StatisticsTreeNode implements Comparable { *

Get the path of the node.

* @return The path of the node. */ - public FixedArray getPath() { + public FixedArray getPath() { return fPath; } /** @@ -110,23 +126,37 @@ public class StatisticsTreeNode implements Comparable { fValue = new Statistics(); fNodes.reset(fPath); } - - /** + + /** + *

Set the name of this node.

+ */ + public void setName (String name) { + fName = name; + } + /** + *

Get the name of this node.

+ * @return Name associated with this node. + */ + public String getName() { + return fName; + } + + /** *

Returns node content as string (full path is not included).

* @return Node content as string. */ - public String getContent() { - return getKey() + ": [nbEvents=" + fValue.nbEvents + //$NON-NLS-1$ - ", cpuTime=" + fValue.cpuTime + //$NON-NLS-1$ - ", cumulativeCpuTime=" + fValue.cumulativeCpuTime + //$NON-NLS-1$ - ", elapsedTime=" + fValue.elapsedTime + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + public String getContent() { + return fName + ": [nbEvents=" + fValue.nbEvents + //$NON-NLS-1$ + ", cpuTime=" + fValue.cpuTime + //$NON-NLS-1$ + ", cumulativeCpuTime=" + fValue.cumulativeCpuTime + //$NON-NLS-1$ + ", elapsedTime=" + fValue.elapsedTime + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } - /** - *

For sorting purposes (sorting by node name).

- */ - @Override + /** + *

For sorting purposes (sorting by node name).

+ */ + @Override public int compareTo(StatisticsTreeNode o) { - return getKey().compareTo(o.getKey()); + return fName.compareTo(o.fName); } } \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng/ChangeLog b/org.eclipse.linuxtools.lttng/ChangeLog index 91346bbac3..751f64ab68 100644 --- a/org.eclipse.linuxtools.lttng/ChangeLog +++ b/org.eclipse.linuxtools.lttng/ChangeLog @@ -1,3 +1,21 @@ +2010-11-23 Francois Chouinard Providing int IDs for the Stats HashMaps + + * src/org/eclipse/linuxtools/lttng/LttngConstants.java: + * src/org/eclipse/linuxtools/lttng/event/LttngEvent.java: + * src/org/eclipse/linuxtools/lttng/event/LttngEventType.java: + * src/org/eclipse/linuxtools/lttng/model/LTTngTreeNodeGeneric.java: + * src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java: + * src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java: + * src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java: + * src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java: + * src/org/eclipse/linuxtools/lttng/state/model/LttngTraceState.java: + * src/org/eclipse/linuxtools/lttng/state/resource/ILttngStateContext.java: + * src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java: + + * src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java: Adjusted buffering between checkpoints + * src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java: Ditto + * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java: Ditto + 2010-11-19 Francois Chouinard * build.properties: Cosmetic spacing diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/LttngConstants.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/LttngConstants.java new file mode 100644 index 0000000000..5d064830c3 --- /dev/null +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/LttngConstants.java @@ -0,0 +1,72 @@ +package org.eclipse.linuxtools.lttng; + +/** + * LTTng specific constants + * + * @author eedbhu + * + */ +public class LttngConstants { + + /** + *

Number of bits of an integer to be used for statistic node identifier.

+ */ + public static final int STATS_ID_SHIFT = 28; + /** + *

Maximum number of trace ids to be created, before wrapping around to 0.

+ * Note that there is a tight coupling to STATS_ID_SHIFT, because the trace id is + * also used for statistics node identification. + */ + public static final int MAX_NUMBER_OF_TRACES_ID = (1 << STATS_ID_SHIFT) - 1; + public static final int STATS_ID_MASK = MAX_NUMBER_OF_TRACES_ID; + + /** + *

Statistic node identifier for unknown/none kernel submode.

+ */ + public static final int STATS_NONE_ID = 0x1 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for IRQ kernel submodes.

+ */ + public static final int STATS_IRQ_NAME_ID = 0x2 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for soft IRQ kernel submodes.

+ */ + public static final int STATS_SOFT_IRQ_NAME_ID = 0x3 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for sys_call kernel submodes.

+ */ + public static final int STATS_SYS_CALL_NAME_ID = 0x4 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for trab kernel submodes.

+ */ + public static final int STATS_TRAP_NAME_ID = 0x5 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the trace.

+ */ + public static final int STATS_TRACE_NAME_ID = 0x6 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the CPU IDs.

+ */ + public static final int STATS_CPU_ID = 0x7 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the kernel modes.

+ */ + public static final int STATS_MODE_ID = 0x8 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the kernel function IDs.

+ */ + public static final int STATS_FUNCTION_ID = 0x9 << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the process IDs.

+ */ + public static final int STATS_PROCESS_ID = 0xA << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the event types.

+ */ + public static final int STATS_TYPE_ID = 0xB << STATS_ID_SHIFT; + /** + *

Statistic node identifier for the event types.

+ */ + public static final int STATS_CATEGORY_ID = 0xC << STATS_ID_SHIFT; + +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java index 3a85f0d7d0..ed73c7a2d0 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java @@ -110,6 +110,15 @@ public class LttngEvent extends TmfEvent { return ( (LttngEventType)this.getType() ).getMarkerName(); } + /** + * Marker id of this event.

+ * + * @return Marker id + */ + public int getMarkerId() { + return ( (LttngEventType)this.getType() ).getMarkerId(); + } + @Override public LttngEventContent getContent() { return (LttngEventContent)fContent; diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java index 2ec5eb6e97..6eb80fa729 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java @@ -26,6 +26,7 @@ public class LttngEventType extends TmfEventType { private String tracefileName = null; private Long cpuId = null; private String markerName = null; + private int markerId = -1; /** * Default Constructor.

@@ -42,12 +43,13 @@ public class LttngEventType extends TmfEventType { * @param thisMarkerName Marker name in LTT * @param thisMarkerfieldsName MarkerFields related to this marker */ - public LttngEventType(String thisTracefileName, Long thisCpuId, String thisMarkerName, String[] thisMarkerfieldsName) { + public LttngEventType(String thisTracefileName, Long thisCpuId, String thisMarkerName, int thisMarkerId, String[] thisMarkerfieldsName) { super( thisTracefileName + "/" + thisCpuId + "/" + thisMarkerName, thisMarkerfieldsName); //$NON-NLS-1$ //$NON-NLS-2$ tracefileName = thisTracefileName; cpuId = thisCpuId; markerName = thisMarkerName; + markerId = thisMarkerId; } /** @@ -56,7 +58,7 @@ public class LttngEventType extends TmfEventType { * @param oldType Type we want to copy from */ public LttngEventType(LttngEventType oldType) { - this(oldType.tracefileName, oldType.cpuId, oldType.markerName, oldType.getLabels()); + this(oldType.tracefileName, oldType.cpuId, oldType.markerName, oldType.markerId, oldType.getLabels()); } @@ -72,6 +74,10 @@ public class LttngEventType extends TmfEventType { return markerName; } + public int getMarkerId() { + return markerId; + } + /** * toString() method. * @@ -92,6 +98,7 @@ public class LttngEventType extends TmfEventType { clone.tracefileName = new String(tracefileName); clone.cpuId = new Long(cpuId); clone.markerName = new String(markerName); + clone.markerId = markerId; return clone; } diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/model/LTTngTreeNodeGeneric.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/model/LTTngTreeNodeGeneric.java index e48f655559..08755cabb0 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/model/LTTngTreeNodeGeneric.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/model/LTTngTreeNodeGeneric.java @@ -15,6 +15,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.TraceDebug; import org.eclipse.linuxtools.tmf.event.TmfData; @@ -313,7 +314,11 @@ public abstract class LTTngTreeNodeGeneric> */ @Override public synchronized Long getNextUniqueId() { - return idCount++; + ++idCount; + if (idCount > LttngConstants.MAX_NUMBER_OF_TRACES_ID) { + idCount = 0L; + } + return idCount | LttngConstants.STATS_TRACE_NAME_ID; } /* diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java index aa5caec3c8..31cf6cf4fb 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.eclipse.linuxtools.lttng.state.evProcessor.state; - import org.eclipse.linuxtools.lttng.TraceDebug; import org.eclipse.linuxtools.lttng.event.LttngEvent; import org.eclipse.linuxtools.lttng.state.StateStrings; @@ -39,12 +38,13 @@ public abstract class AbsStateUpdate extends AbsStateProcessing implements // push and pop from stack // ======================================================================= protected void push_state(Long cpu, StateStrings.ExecutionMode execMode, - String submode, TmfTimestamp eventTime, LttngTraceState traceSt) { + String submode, int subModeId, TmfTimestamp eventTime, LttngTraceState traceSt) { LttngProcessState process = traceSt.getRunning_process().get(cpu); LttngExecutionState exe_state = new LttngExecutionState(); exe_state.setExec_mode(execMode); exe_state.setExec_submode(submode); + exe_state.setExec_submode_id(subModeId); exe_state.setEntry_Time(eventTime.getValue()); exe_state.setChange_Time(eventTime.getValue()); exe_state.setCum_cpu_time(0L); diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java index 6044c8c891..f44e2c06e2 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java @@ -14,6 +14,7 @@ package org.eclipse.linuxtools.lttng.state.evProcessor.state; import java.util.Map; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.TraceDebug; import org.eclipse.linuxtools.lttng.event.LttngEvent; import org.eclipse.linuxtools.lttng.state.StateStrings; @@ -68,21 +69,25 @@ class StateUpdateHandlers { Fields.LTT_FIELD_SYSCALL_ID); String submode = null; + int submodeId = 0; if (syscall == null) { TraceDebug .debug("Syscall Field not found, traceVent time: " //$NON-NLS-1$ + trcEvent.getTimestamp()); } else { submode = traceSt.getSyscall_names().get(syscall); + // Note: For statistics performance improvement only the integer value of syscall is used + // as well as a bit mask is applied! + submodeId = syscall.intValue() | LttngConstants.STATS_SYS_CALL_NAME_ID; } if (submode == null) { - submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN - .getInName(); + submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.getInName(); + submodeId = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.ordinal() | LttngConstants.STATS_NONE_ID; } push_state(cpu, StateStrings.ExecutionMode.LTTV_STATE_SYSCALL, - submode, trcEvent.getTimestamp(), traceSt); + submode, submodeId, trcEvent.getTimestamp(), traceSt); return false; } }; @@ -139,15 +144,19 @@ class StateUpdateHandlers { // ready the trap submode name String submode = traceSt.getTrap_names().get(trap); + // Note: For statistics performance improvement only the integer value of trap is used + // as well as a bit mask is applied! + + int submodeId = trap.intValue() | LttngConstants.STATS_TRAP_NAME_ID; if (submode == null) { - submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN - .getInName(); + submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.getInName(); + submodeId = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.ordinal() | LttngConstants.STATS_NONE_ID; } /* update process state */ push_state(cpu, StateStrings.ExecutionMode.LTTV_STATE_TRAP, - submode, trcEvent.getTimestamp(), traceSt); + submode, submodeId, trcEvent.getTimestamp(), traceSt); /* update cpu status */ LTTngCPUState cpust = traceSt.getCpu_states().get(cpu); @@ -236,17 +245,20 @@ class StateUpdateHandlers { String submode; submode = traceSt.getIrq_names().get(irq); - + // Note: For statistics performance improvement only the integer value of irq is used + // as well as a bit mask is applied! + int submodeId = irq.intValue() | LttngConstants.STATS_IRQ_NAME_ID; + if (submode == null) { - submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN - .getInName(); + submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.getInName(); + submodeId = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.ordinal() | LttngConstants.STATS_NONE_ID; } /* * Do something with the info about being in user or system mode * when int? */ - push_state(cpu, ExecutionMode.LTTV_STATE_IRQ, submode, trcEvent + push_state(cpu, ExecutionMode.LTTV_STATE_IRQ, submode, submodeId, trcEvent .getTimestamp(), traceSt); /* update cpu state */ @@ -421,6 +433,10 @@ class StateUpdateHandlers { softIrqNames.put(softirq, submode); } + // Note: For statistics performance improvement only the integer value of softirq is used + // as well as a bit mask is applied! + int submodeId = softirq.intValue() | LttngConstants.STATS_SOFT_IRQ_NAME_ID; + /* update softirq status */ LttngSoftIRQState irqState = traceSt.getSoft_irq_states().get( softirq); @@ -438,7 +454,7 @@ class StateUpdateHandlers { cpu_push_mode(cpu_state, CpuMode.LTTV_CPU_SOFT_IRQ); /* update process execution mode state stack */ - push_state(cpu, ExecutionMode.LTTV_STATE_SOFT_IRQ, submode, + push_state(cpu, ExecutionMode.LTTV_STATE_SOFT_IRQ, submode, submodeId, trcEvent.getTimestamp(), traceSt); return false; @@ -1326,9 +1342,10 @@ class StateUpdateHandlers { if (es.getExec_mode() == ExecutionMode.LTTV_STATE_MODE_UNKNOWN) { es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); - es - .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE - .getInName()); + es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.ordinal() | LttngConstants.STATS_NONE_ID); es.setEntry_Time(timestamp.getValue()); es.setChange_Time(timestamp.getValue()); es.setCum_cpu_time(0L); @@ -1340,9 +1357,10 @@ class StateUpdateHandlers { es = process.getFirstElementFromExecutionStack(); if (es.getExec_mode() == ExecutionMode.LTTV_STATE_MODE_UNKNOWN) { es.setExec_mode(ExecutionMode.LTTV_STATE_USER_MODE); - es - .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE - .getInName()); + es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.ordinal() | LttngConstants.STATS_NONE_ID); es.setEntry_Time(timestamp.getValue()); es.setChange_Time(timestamp.getValue()); es.setCum_cpu_time(0L); @@ -1368,9 +1386,10 @@ class StateUpdateHandlers { // initialize values es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); - es - .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE - .getInName()); + es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.ordinal() | LttngConstants.STATS_NONE_ID); es.setEntry_Time(timestamp.getValue()); es.setChange_Time(timestamp.getValue()); es.setCum_cpu_time(0L); @@ -1515,9 +1534,12 @@ class StateUpdateHandlers { es = process.getState(); es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN); es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED); - es - .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN + es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN .getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.ordinal() | LttngConstants.STATS_NONE_ID); + // #if 0 // /* UNKNOWN STATE */ // { diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java index 1655e32872..7e6240329d 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.linuxtools.lttng.state.model; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.state.StateStrings; /** @@ -22,14 +23,18 @@ public class LttngExecutionState implements Cloneable { // ======================================================================== // Data // ======================================================================= - private Long entry_LttTime = null; + + private Long entry_LttTime = null; private Long change_LttTime = null; private Long cum_cpu_time_Timens = null; private StateStrings.ProcessStatus proc_status = StateStrings.ProcessStatus.LTTV_STATE_UNNAMED; private StateStrings.ExecutionMode exec_mode = StateStrings.ExecutionMode.LTTV_STATE_MODE_UNKNOWN; private String exec_submode = StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.getInName(); - + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + private int exec_submode_id = Integer.valueOf(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.ordinal() | LttngConstants.STATS_NONE_ID); + @Override public LttngExecutionState clone() { LttngExecutionState newState = null; @@ -43,6 +48,7 @@ public class LttngExecutionState implements Cloneable { // but we should ALWAYS use "new" or "clone()" on "non basic" type newState.cum_cpu_time_Timens = this.cum_cpu_time_Timens; newState.exec_submode = this.exec_submode; + newState.exec_submode_id = this.exec_submode_id; // ProcessStatus and ExecutionMode are enum, and so shouldn't be a problem to use their reference newState.proc_status = this.proc_status; @@ -146,10 +152,26 @@ public class LttngExecutionState implements Cloneable { * @param execSubmode * the exec_submode to set */ - public void setExec_submode(String execSubmode) { - exec_submode = execSubmode; - } + public void setExec_submode(String execSubmode) { + exec_submode = execSubmode; + } + + /** + * @return the exec_submode + */ + public int getExec_submode_id() { + return exec_submode_id; + } + + /** + * @param execSubmode + * the exec_submode id to set + */ + public void setExec_submode_id(int execSubmodeId) { + exec_submode_id = execSubmodeId; + } + @Override @SuppressWarnings("nls") public String toString() { diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java index 8d0e525573..052bdb740e 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java @@ -13,6 +13,7 @@ package org.eclipse.linuxtools.lttng.state.model; import java.util.Stack; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.TraceDebug; import org.eclipse.linuxtools.lttng.state.StateStrings; import org.eclipse.linuxtools.lttng.state.StateStrings.ExecutionMode; @@ -88,6 +89,10 @@ public class LttngProcessState implements Cloneable { LttngExecutionState es = new LttngExecutionState(); es.setExec_mode(ExecutionMode.LTTV_STATE_USER_MODE); es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.ordinal() | + LttngConstants.STATS_NONE_ID); es.setEntry_Time(this.insertion_time); es.setChange_Time(this.insertion_time); es.setCum_cpu_time(0L); @@ -97,9 +102,11 @@ public class LttngProcessState implements Cloneable { //This second entry is needed when processes are created via a Fork event. es = new LttngExecutionState(); es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); - es - .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE - .getInName()); + es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.ordinal() | + LttngConstants.STATS_NONE_ID); es.setEntry_Time(this.insertion_time); es.setChange_Time(this.insertion_time); es.setCum_cpu_time(0L); diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngTraceState.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngTraceState.java index e7ee408d1e..42dadead69 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngTraceState.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngTraceState.java @@ -15,6 +15,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.eclipse.linuxtools.lttng.LttngConstants; import org.eclipse.linuxtools.lttng.TraceDebug; import org.eclipse.linuxtools.lttng.state.LttngStateException; import org.eclipse.linuxtools.lttng.state.StateStrings; @@ -270,8 +271,10 @@ public class LttngTraceState implements Cloneable { LttngExecutionState es = process.getFirstElementFromExecutionStack(); process.setState(es); es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN); - es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE - .getInName()); + es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName()); + // Note: For statistics performance improvement a integer representation of the submode is used + // as well as a bit mask is applied! + es.setExec_submode_id(StateStrings.ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.ordinal() | LttngConstants.STATS_NONE_ID); es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED); // Reduce from default to only one execution state in the stack @@ -463,22 +466,22 @@ public class LttngTraceState implements Cloneable { return foundProcess; } - - } -class ProcessStateKey { - private LttngProcessState valueRef = null; +final class ProcessStateKey { + + private long pid; + private long cpuId; + private String traceId; - private Long pid = null; - private Long cpuId = null; - private String traceId = null; @SuppressWarnings("unused") private ProcessStateKey() { } public ProcessStateKey(LttngProcessState newRef) { - valueRef = newRef; + pid = newRef.getPid().longValue(); + cpuId = newRef.getCpu().longValue(); + traceId = newRef.getTrace_id(); } public ProcessStateKey(Long newPid, Long newCpuId, String newTraceId) { @@ -496,31 +499,18 @@ class ProcessStateKey { if ( obj instanceof ProcessStateKey ) { ProcessStateKey procKey = (ProcessStateKey) obj; - if (valueRef != null) { - if (!(procKey.getPid().equals(valueRef.getPid()))) { - return false; - } - - if (!procKey.getTraceId().equals(valueRef.getTrace_id())) { - return false; - } - - if (((procKey.getPid().longValue() == 0L) && !(procKey.getCpuId().equals(valueRef.getCpu())))) { - isSame = false; - } - } else { - if (!(procKey.getPid().equals(this.pid))) { - return false; - } - - if (!(procKey.getTraceId().equals(this.traceId))) { - return false; - } - - if (((procKey.getPid().longValue() == 0L) && !(procKey.getCpuId().equals(this.cpuId)))) { - return false; - } - } + if (procKey.pid != this.pid) { + return false; + } + + if (!(procKey.traceId.equals(this.traceId))) { + return false; + } + + if (((procKey.pid == 0L) && (procKey.cpuId != this.cpuId))) { + return false; + } + } else { TraceDebug @@ -532,53 +522,15 @@ class ProcessStateKey { return isSame; } - // *** WARNING : Everything in there work because the check "valueRef != null" is the same for ALL getter - // Do NOT change this check without checking. - public Long getPid() { - if ( valueRef != null ) { - return valueRef.getPid(); - } - else { - return pid; - } - } - - public Long getCpuId() { - if ( valueRef != null ) { - return valueRef.getCpu(); - } - else { - return cpuId; - } - } - - public String getTraceId() { - if ( valueRef != null ) { - return valueRef.getTrace_id(); - } - else { - return traceId; - } - } - @Override public int hashCode() { - return this.toString().hashCode(); + return (1 ^ (int)(pid ^ (pid >>> 32)) ^ traceId.hashCode()); } @Override @SuppressWarnings("nls") public String toString() { - if ( valueRef != null ) { - // return (valueRef.getPid().toString() + ":" + - // valueRef.getCpu().toString() + ":" + - // valueRef.getTrace_id().toString() ); - return (valueRef.getPid().toString() + ":" + valueRef.getTrace_id().toString()); - } - - // return (pid.toString() + ":" + cpuId.toString() + ":" + - // traceId.toString()); - return (pid.toString() + ":" + traceId.toString()); + return (String.valueOf(pid) + ":" + traceId); } } diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/resource/ILttngStateContext.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/resource/ILttngStateContext.java index b99d76b81f..2152f540f7 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/resource/ILttngStateContext.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/resource/ILttngStateContext.java @@ -68,4 +68,10 @@ public interface ILttngStateContext { */ public ITmfTrace getTraceIdRef(); + /** + * Returns Trace Identifier + * @return Trace Identifier + */ + public long getIdentifier(); + } diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java index 59c74eaab6..64cdddca53 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java @@ -48,7 +48,7 @@ public class StateTraceManager extends LTTngTreeNode implements IStateTraceManag private static final int DEFAULT_CHUNK = 1; // configurable check point interval - private static final long LTTNG_CHECK_POINT_INTERVAL = 15000L; + private static final long LTTNG_CHECK_POINT_INTERVAL = 50000L; private long fcheckPointInterval = LTTNG_CHECK_POINT_INTERVAL; private TmfExperiment fExperiment = null; @@ -538,4 +538,13 @@ public class StateTraceManager extends LTTngTreeNode implements IStateTraceManag return sb.toString(); } + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.state.resource.ILttngStateContext#getIdentifier() + */ + @Override + public long getIdentifier() { + return getId().longValue(); + } + } diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java index 186c04f4ac..4130b0669f 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java @@ -29,7 +29,7 @@ import org.eclipse.linuxtools.tmf.trace.TmfContext; */ public class LTTngExperiment extends TmfExperiment implements ITmfTrace { - private static final int DEFAULT_INDEX_PAGE_SIZE = 5000; + private static final int DEFAULT_INDEX_PAGE_SIZE = 50000; // ------------------------------------------------------------------------ // Constructors diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java index 6fe51f9f5b..955c34bfba 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java @@ -389,7 +389,7 @@ public class LTTngTextTrace extends TmfTrace implements ITmfTrace { // We now have what we need for the type String tmpTypeKey = tracefile + "/" + tmpCpu + "/" + marker; //$NON-NLS-1$ //$NON-NLS-2$ if ( traceTypes.get(tmpTypeKey) == null ) { - traceTypes.put(tmpTypeKey, new LttngEventType(tracefile, tmpCpu, marker, fieldsMap.keySet().toArray(new String[fieldsMap.size()] )) ); + traceTypes.put(tmpTypeKey, new LttngEventType(tracefile, tmpCpu, marker, 0, fieldsMap.keySet().toArray(new String[fieldsMap.size()] )) ); } currentLttngEvent.setContent(eventContent); diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java index cef4b7c0de..25c330ecf2 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java @@ -61,7 +61,7 @@ public class LTTngTrace extends TmfTrace { private final static boolean SHOW_LTT_DEBUG_DEFAULT = false; private final static boolean IS_PARSING_NEEDED_DEFAULT = !UniqueEvent; - private final static int CHECKPOINT_PAGE_SIZE = 1000; + private final static int CHECKPOINT_PAGE_SIZE = 50000; // Reference to our JNI trace private JniTrace currentJniTrace = null; @@ -301,6 +301,7 @@ public class LTTngTrace extends TmfTrace { // First, obtain an iterator on TRACEFILES of owned by the TRACE Iterator tracefileItr = trace.getTracefilesMap().keySet() .iterator(); + while (tracefileItr.hasNext()) { newTracefileKey = tracefileItr.next(); newTracefile = trace.getTracefilesMap().get(newTracefileKey); @@ -321,9 +322,10 @@ public class LTTngTrace extends TmfTrace { .toArray( new String[newMarker.getMarkerFieldsHashMap() .size()]); + tmpType = new LttngEventType(newTracefile.getTracefileName(), - newTracefile.getCpuNumber(), newMarker.getName(), - markerFieldsLabels); + newTracefile.getCpuNumber(), newMarker.getName(), + newMarkerKey.intValue(), markerFieldsLabels); // Add the type to the map/vector addEventTypeToMap(tmpType); diff --git a/org.eclipse.linuxtools.tmf/ChangeLog b/org.eclipse.linuxtools.tmf/ChangeLog index 649b42d8ee..c6f01bb26a 100644 --- a/org.eclipse.linuxtools.tmf/ChangeLog +++ b/org.eclipse.linuxtools.tmf/ChangeLog @@ -1,3 +1,8 @@ +2010-11-23 Francois Chouinard + + * src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java: Adjusted background request block size + * src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java: Adjusted buffering between checkpoints + 2010-11-10 Francois Chouinard Suppress warning for non-externalized strings diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java index fbe81839fa..7d24f5063a 100644 --- a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java @@ -59,7 +59,7 @@ public abstract class TmfDataProvider extends TmfComponent im final protected boolean fLogData; final protected boolean fLogError; - public static final int DEFAULT_BLOCK_SIZE = 5000; + public static final int DEFAULT_BLOCK_SIZE = 50000; public static final int DEFAULT_QUEUE_SIZE = 1000; protected final int fQueueSize; diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java index c91dfda144..f8910df53d 100644 --- a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java @@ -57,7 +57,7 @@ public abstract class TmfTrace extends TmfEventProvider i // The default number of events to cache // TODO: Make the DEFAULT_CACHE_SIZE a preference - public static final int DEFAULT_INDEX_PAGE_SIZE = 1000; + public static final int DEFAULT_INDEX_PAGE_SIZE = 50000; // ------------------------------------------------------------------------ // Attributes -- 2.34.1