summaryrefslogtreecommitdiff
path: root/atrace/generate_rc.py
blob: e18a734e07a1be402565463f2a5adcd4b7f249fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3

import argparse

parser = argparse.ArgumentParser("generate_rc.py", description="Generates an .rc files that fixes the permissions for all the ftrace events listed in the input atrace_categories.txt file")
parser.add_argument("filename", help="Path to the atrace_categories.txt file")

args = parser.parse_args()

print("# Sets permission for vendor ftrace events")
print("on late-init")

with open(args.filename, 'r') as f:
  for line in f:
    line = line.rstrip('\n')
    if line.startswith(' ') or line.startswith('\t'):
      path = line.lstrip(" \t")
      print("    chmod 0666 /sys/kernel/debug/tracing/events/{}/enable".format(path))
      print("    chmod 0666 /sys/kernel/tracing/events/{}/enable".format(path))
    else:
      print ("    # {} trace points".format(line))