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

Side by Side Diff: client/profilers/perf/perf.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/oprofile/oprofile.py ('k') | client/profilers/powertop/powertop.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 perf is a tool included in the linux kernel tree that 2 perf is a tool included in the linux kernel tree that
3 supports functionality similar to oprofile and more. 3 supports functionality similar to oprofile and more.
4 4
5 @see: http://lwn.net/Articles/310260/ 5 @see: http://lwn.net/Articles/310260/
6 """ 6 """
7 7
8 import time, os, subprocess, signal 8 import time, os, stat, subprocess, signal
9 import logging
9 from autotest_lib.client.bin import profiler, os_dep, utils 10 from autotest_lib.client.bin import profiler, os_dep, utils
10 11
11 12
12 class perf(profiler.profiler): 13 class perf(profiler.profiler):
13 version = 1 14 version = 1
14 15
15 def initialize(self, events="cycles,instructions"): 16 def initialize(self, events="cycles,instructions"):
16 self.events = events 17 self.events = events
17 self.perf_bin = os_dep.command('perf') 18 self.perf_bin = os_dep.command('perf')
18 perf_help = utils.run('%s report help' % self.perf_bin, 19 perf_help = utils.run('%s report help' % self.perf_bin,
(...skipping 25 matching lines...) Expand all
44 def report(self, test): 45 def report(self, test):
45 for key in self.sort_keys: 46 for key in self.sort_keys:
46 reportfile = os.path.join(test.profdir, '%s.comm' % key) 47 reportfile = os.path.join(test.profdir, '%s.comm' % key)
47 cmd = ("%s report -i %s --sort %s,dso" % (self.perf_bin, 48 cmd = ("%s report -i %s --sort %s,dso" % (self.perf_bin,
48 self.logfile, 49 self.logfile,
49 key)) 50 key))
50 outfile = open(reportfile, 'w') 51 outfile = open(reportfile, 'w')
51 p = subprocess.Popen(cmd, shell=True, stdout=outfile, 52 p = subprocess.Popen(cmd, shell=True, stdout=outfile,
52 stderr=subprocess.STDOUT) 53 stderr=subprocess.STDOUT)
53 p.wait() 54 p.wait()
55 # The raw detailed perf output is HUGE. We cannot store it by default.
56 perf_log_size = os.stat(self.logfile)[stat.ST_SIZE]
57 logging.info('Removing %s after generating reports (saving %s bytes).',
58 self.logfile, perf_log_size)
59 os.unlink(self.logfile)
OLDNEW
« no previous file with comments | « client/profilers/oprofile/oprofile.py ('k') | client/profilers/powertop/powertop.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698