Skip to content

Commit 9658573

Browse files
authored
Display number of slots in timeline visualization (#1154)
In eBPF-based timeline visualization, we add the number of slots and whether the workpacket is from roots as arguments of the `ProcessEdgesWork` work packets.
1 parent 3be73b8 commit 9658573

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

tools/tracing/timeline/visualize.py

+25-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self):
2424
self.type_id_name = {}
2525
self.results = []
2626
self.start_time = None
27+
self.tid_current_work_packet = {}
2728

2829
def process_line(self, line):
2930
if line.startswith("@type_name"):
@@ -81,8 +82,30 @@ def process_log_line(self, line):
8182
result["args"] = {
8283
"type_id": int(rest[0])
8384
}
84-
85-
self.results.append(result)
85+
match be:
86+
case "B":
87+
self.set_current_work_packet(tid, result)
88+
case "E":
89+
self.clear_current_work_packet(tid, result)
90+
91+
case "process_slots":
92+
current = self.get_current_work_packet(tid)
93+
# eBPF may drop events. Be conservative.
94+
if current is not None:
95+
current["args"]["num_slots"] = int(rest[0])
96+
current["args"]["is_roots"] = int(rest[1])
97+
98+
if be != "meta":
99+
self.results.append(result)
100+
101+
def set_current_work_packet(self, tid, result):
102+
self.tid_current_work_packet[tid] = result
103+
104+
def get_current_work_packet(self, tid):
105+
return self.tid_current_work_packet[tid]
106+
107+
def clear_current_work_packet(self, tid, result):
108+
self.tid_current_work_packet[tid] = None
86109

87110
def resolve_results(self):
88111
for result in self.results:

0 commit comments

Comments
 (0)