scx/scripts/ftrace_trim
Daniel Hodges cc3fede8e0
scripts: Add ftrace helper scripts
Add a set of ftrace helper scripts for making perfetto compatible ftrace
scheduler profiles.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-10-13 09:00:07 -04:00

27 lines
603 B
Python
Executable File

#!/usr/bin/env python3
import sys
HEADER = "TASK-PID"
BUFF_STARTED = "buffer started ###"
def main():
nproc = int(sys.argv[2]) - 1
seen_header = False
proc_buffer_started = 0
with open(sys.argv[1]) as f:
for line in f:
l = line.replace("\n", "")
if HEADER in l:
seen_header = True
print(l)
if BUFF_STARTED in line:
proc_buffer_started += 1
continue
if proc_buffer_started == nproc or not seen_header:
print(l)
if __name__=="__main__":
main()