mirror of
https://github.com/JakeHillion/scx.git
synced 2024-12-04 23:07:11 +00:00
cc3fede8e0
Add a set of ftrace helper scripts for making perfetto compatible ftrace scheduler profiles. Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
27 lines
603 B
Python
Executable File
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()
|