• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2
3import argparse
4
5parser = 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")
6parser.add_argument("filename", help="Path to the atrace_categories.txt file")
7
8args = parser.parse_args()
9
10on_boot_events = ["mali/", "power/gpu_work_period", "power/gpu_frequency"]
11
12print("# Sets permission for vendor ftrace events on late-init")
13print("on late-init")
14
15with open(args.filename, 'r') as f:
16  for line in f:
17    line = line.rstrip('\n')
18    if line.startswith(' ') or line.startswith('\t'):
19      path = line.lstrip(" \t")
20
21      if any(path.startswith(event) for event in on_boot_events):
22        continue
23
24      print("    chmod 0666 /sys/kernel/debug/tracing/events/{}/enable".format(path))
25      print("    chmod 0666 /sys/kernel/tracing/events/{}/enable".format(path))
26    else:
27      print ("    # {} trace points".format(line))
28
29print("# Sets permission for vendor ftrace events on boot")
30print("on boot")
31
32with open(args.filename, 'r') as f:
33  for line in f:
34    line = line.rstrip('\n')
35    if not line.startswith(' ') or line.startswith('\t'):
36      print ("    # {} trace points".format(line))
37      continue
38
39    path = line.lstrip(" \t")
40
41    if not any(path.startswith(event) for event in on_boot_events):
42      continue
43
44    print("    chmod 0666 /sys/kernel/debug/tracing/events/{}/enable".format(path))
45    print("    chmod 0666 /sys/kernel/tracing/events/{}/enable".format(path))
46