Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(844)

Side by Side Diff: client/profilers/powertop/powertop.py

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/profilers/perf/perf.py ('k') | client/profilers/readprofile/readprofile.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """ 1 """
2 What's eating the battery life of my laptop? Why isn't it many more 2 What's eating the battery life of my laptop? Why isn't it many more
3 hours? Which software component causes the most power to be burned? 3 hours? Which software component causes the most power to be burned?
4 These are important questions without a good answer... until now. 4 These are important questions without a good answer... until now.
5 """ 5 """
6 import time, os 6 import time, os
7 from autotest_lib.client.bin import utils, profiler 7 from autotest_lib.client.bin import utils, profiler
8 8
9 class powertop(profiler.profiler): 9 class powertop(profiler.profiler):
10 version = 1 10 version = 1
11 preserve_srcdir = True 11 preserve_srcdir = True
12 12
13 # filenames: list of filenames to cat 13 # filenames: list of filenames to cat
14 def setup(self, *args, **dargs): 14 def setup(self, *args, **dargs):
15 os.chdir(self.srcdir) 15 os.chdir(self.srcdir)
16 utils.system('make') 16 utils.make()
17 17
18 18
19 def start(self, test): 19 def start(self, test):
20 self.child_pid = os.fork() 20 self.child_pid = os.fork()
21 if self.child_pid: # parent 21 if self.child_pid: # parent
22 return None 22 return None
23 else: # child 23 else: # child
24 powertop = os.path.join(self.srcdir, 'powertop') + ' -d' 24 powertop = os.path.join(self.srcdir, 'powertop') + ' -d'
25 outputfile = os.path.join(test.profdir, 'powertop') 25 outputfile = os.path.join(test.profdir, 'powertop')
26 while True: 26 while True:
27 output = open(outputfile, 'a') 27 output = open(outputfile, 'a')
28 output.write(time.asctime() + '\n') 28 output.write(time.asctime() + '\n')
29 data = utils.system_output('%s >> %s' % (powertop, outputfile)) 29 data = utils.system_output('%s >> %s' % (powertop, outputfile))
30 output.write(data) 30 output.write(data)
31 output.write('\n=========================\n') 31 output.write('\n=========================\n')
32 output.close() 32 output.close()
33 33
34 34
35 def stop(self, test): 35 def stop(self, test):
36 os.kill(self.child_pid, 15) 36 os.kill(self.child_pid, 15)
37 37
38 38
39 def report(self, test): 39 def report(self, test):
40 return None 40 return None
OLDNEW
« no previous file with comments | « client/profilers/perf/perf.py ('k') | client/profilers/readprofile/readprofile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698