Skip to content

Commit c1556c2

Browse files
committed
Add support for tracking submitter thread IDs (st) in JFR timeline viewer and export logic
1 parent 1fdb8ab commit c1556c2

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

benchmark-runner/scripts/jfr/JfrToTimeline.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ private static void writeEventLine(LineWriter writer,
188188
writer.writeAscii(",\"th\":");
189189
writer.writeLong(event.getInt("tasksHandled"));
190190
}
191+
RecordedThread submitterThread = getThread(event, "submitterThread");
192+
if (submitterThread != null) {
193+
writer.writeAscii(",\"st\":");
194+
writer.writeLong(threadId(submitterThread));
195+
}
191196

192197
writer.writeAscii("}");
193198
writer.writeLineEnd();

benchmark-runner/scripts/jfr/timeline-viewer.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ <h1>Netty Loom Timeline Viewer</h1>
468468
thread.q1.push(obj.q1 ?? null);
469469
thread.io.push(obj.io ?? null);
470470
thread.th.push(obj.th ?? null);
471+
thread.st.push(obj.st ?? null);
471472
state.count += 1;
472473
if (!state.minMicros || start < state.minMicros) state.minMicros = start;
473474
const end = start + dur;
@@ -486,7 +487,7 @@ <h1>Netty Loom Timeline Viewer</h1>
486487
function getThread(tid) {
487488
let thread = state.threads.get(tid);
488489
if (!thread) {
489-
thread = { tid, name: `tid-${tid}`, s: [], d: [], n: [], v: [], p: [], el: [], im: [], b: [], te: [], q0: [], q1: [], io: [], th: [] };
490+
thread = { tid, name: `tid-${tid}`, s: [], d: [], n: [], v: [], p: [], el: [], im: [], b: [], te: [], q0: [], q1: [], io: [], th: [], st: [] };
490491
state.threads.set(tid, thread);
491492
}
492493
return thread;
@@ -514,6 +515,7 @@ <h1>Netty Loom Timeline Viewer</h1>
514515
thread.q1 = order.map(i => thread.q1[i]);
515516
thread.io = order.map(i => thread.io[i]);
516517
thread.th = order.map(i => thread.th[i]);
518+
thread.st = order.map(i => thread.st[i]);
517519
}
518520
state.viewStart = state.minMicros;
519521
state.viewEnd = state.maxMicros;
@@ -936,6 +938,7 @@ <h1>Netty Loom Timeline Viewer</h1>
936938
const queueDepthAfter = thread.q1[eventIdx];
937939
const ioEventsHandled = thread.io[eventIdx];
938940
const tasksHandled = thread.th[eventIdx];
941+
const submitterTid = thread.st[eventIdx];
939942

940943
// Build tooltip dynamically based on available fields
941944
let tooltipText =
@@ -973,6 +976,9 @@ <h1>Netty Loom Timeline Viewer</h1>
973976
if (tasksHandled != null) {
974977
tooltipText += `\nTasksHandled: ${tasksHandled}`;
975978
}
979+
if (submitterTid != null) {
980+
tooltipText += `\nSubmitterThreadId: ${submitterTid}`;
981+
}
976982

977983
tooltip.textContent = tooltipText;
978984
tooltip.style.left = `${event.clientX}px`;

0 commit comments

Comments
 (0)