Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display number of slots in timeline visualization #1154

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions tools/tracing/timeline/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self):
self.type_id_name = {}
self.results = []
self.start_time = None
self.tid_current_work_packet = {}

def process_line(self, line):
if line.startswith("@type_name"):
Expand Down Expand Up @@ -81,8 +82,30 @@ def process_log_line(self, line):
result["args"] = {
"type_id": int(rest[0])
}

self.results.append(result)
match be:
case "B":
self.set_current_work_packet(tid, result)
case "E":
self.clear_current_work_packet(tid, result)

case "process_slots":
current = self.get_current_work_packet(tid)
# eBPF may drop events. Be conservative.
if current is not None:
current["args"]["num_slots"] = int(rest[0])
current["args"]["is_roots"] = int(rest[1])

if be != "meta":
self.results.append(result)

def set_current_work_packet(self, tid, result):
self.tid_current_work_packet[tid] = result

def get_current_work_packet(self, tid):
return self.tid_current_work_packet[tid]

def clear_current_work_packet(self, tid, result):
self.tid_current_work_packet[tid] = None

def resolve_results(self):
for result in self.results:
Expand Down
Loading