Skip to content

Commit d5de0fe

Browse files
theibhirMatthewKhouzam
authored andcommitted
callstack: add handle instant event
Signed-off-by: Yassine Ibhir <[email protected]>
1 parent 9e5ae20 commit d5de0fe

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

tracetypes/org.eclipse.tracecompass.incubator.traceevent.core/src/org/eclipse/tracecompass/incubator/internal/traceevent/core/analysis/callstack/TraceEventCallStackProvider.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
public class TraceEventCallStackProvider extends CallStackStateProvider {
6262

6363
private static final String ASYNC_SUFFIX = "(async)"; //$NON-NLS-1$
64-
private static final int VERSION_NUMBER = 8;
64+
private static final int VERSION_NUMBER = 9;
6565
private static final int UNSET_ID = -1;
6666
static final String EDGES = "EDGES"; //$NON-NLS-1$
6767

@@ -266,6 +266,9 @@ protected void eventHandle(ITmfEvent event) {
266266
return;
267267
}
268268
switch (ph) {
269+
case TraceEventPhases.INSTANT:
270+
handleInstant(event, ss, timestamp, processName);
271+
break;
269272
case TraceEventPhases.NESTABLE_START:
270273
handleStart(event, ss, timestamp, processName + ASYNC_SUFFIX);
271274
break;
@@ -375,6 +378,31 @@ private void updateFLinks(ITmfEvent event, ITmfStateSystemBuilder ss, long ts, S
375378
}
376379
}
377380

381+
private void handleInstant(@NonNull ITmfEvent event, ITmfStateSystemBuilder ss, long timestamp, String processName) {
382+
super.addMarker(event);
383+
Map<String, Object> map = TraceEventAspects.ARGS_ASPECT.resolve(event);
384+
String toStore ="null";
385+
if (map != null) {
386+
toStore = map.toString();
387+
}
388+
if (toStore != null) {
389+
int processQuark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName);
390+
int pid = getProcessId(event);
391+
ss.modifyAttribute(timestamp, pid, processQuark);
392+
393+
String threadName = getThreadName(event);
394+
long threadId = getThreadId(event);
395+
if (threadName == null) {
396+
threadName = Long.toString(threadId);
397+
}
398+
int threadQuark = ss.getQuarkRelativeAndAdd(processQuark, threadName);
399+
ss.modifyAttribute(timestamp, threadId, threadQuark);
400+
401+
int callStackQuark = ss.getQuarkRelativeAndAdd(threadQuark, InstrumentedCallStackAnalysis.ANNOTATIONS);
402+
ss.modifyAttribute(timestamp, toStore, callStackQuark);
403+
}
404+
}
405+
378406
private void updateTLinks(@NonNull ITmfEvent event, ITmfStateSystemBuilder ss, long ts, String processName) {
379407
EventTreeKey key = getEventTreeKey(event);
380408

tracetypes/org.eclipse.tracecompass.incubator.traceevent.core/src/org/eclipse/tracecompass/incubator/internal/traceevent/core/event/TraceEventPhases.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ private TraceEventPhases() {
3232

3333
public static final String DURATION = "X"; //$NON-NLS-1$
3434

35+
public static final String INSTANT = "i"; //$NON-NLS-1$
36+
3537
public static final String COUNTER = "C"; //$NON-NLS-1$
3638

3739
public static final String NESTABLE_START = "b"; //$NON-NLS-1$

0 commit comments

Comments
 (0)