blob: 04633bbd3a2b6eacdedd04b0068091a4913633ef [file] [log] [blame]
Javi Merino572049d2014-03-31 16:45:23 +01001#!/usr/bin/python3
2"""Process the output of the power allocator trace in the current directory's trace.dat"""
3
4import os
5import subprocess
6
7class Thermal(object):
8 def __init__(self):
9 if not os.path.isfile("trace.txt"):
10 self.__run_trace_cmd_report()
11
12
13 def __run_trace_cmd_report(self):
14 """Run "trace-cmd report > trace.txt". Overwrites the contents of trace.txt if it exists."""
15 with open(os.devnull) as devnull:
16 out = subprocess.check_output(["trace-cmd", "report"], stderr=devnull)
17
18 with open("trace.txt", "w") as f:
19 f.write(out)