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

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

Issue 3541002: Revert "Merge remote branch 'cros/upstream' into tempbranch2" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/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, stat, subprocess, signal 8 import time, os, subprocess, signal
9 import logging
10 from autotest_lib.client.bin import profiler, os_dep, utils 9 from autotest_lib.client.bin import profiler, os_dep, utils
11 10
12 11
13 class perf(profiler.profiler): 12 class perf(profiler.profiler):
14 version = 1 13 version = 1
15 14
16 def initialize(self, events="cycles,instructions"): 15 def initialize(self, events="cycles,instructions"):
17 self.events = events 16 self.events = events
18 self.perf_bin = os_dep.command('perf') 17 self.perf_bin = os_dep.command('perf')
19 perf_help = utils.run('%s report help' % self.perf_bin, 18 perf_help = utils.run('%s report help' % self.perf_bin,
(...skipping 25 matching lines...) Expand all
45 def report(self, test): 44 def report(self, test):
46 for key in self.sort_keys: 45 for key in self.sort_keys:
47 reportfile = os.path.join(test.profdir, '%s.comm' % key) 46 reportfile = os.path.join(test.profdir, '%s.comm' % key)
48 cmd = ("%s report -i %s --sort %s,dso" % (self.perf_bin, 47 cmd = ("%s report -i %s --sort %s,dso" % (self.perf_bin,
49 self.logfile, 48 self.logfile,
50 key)) 49 key))
51 outfile = open(reportfile, 'w') 50 outfile = open(reportfile, 'w')
52 p = subprocess.Popen(cmd, shell=True, stdout=outfile, 51 p = subprocess.Popen(cmd, shell=True, stdout=outfile,
53 stderr=subprocess.STDOUT) 52 stderr=subprocess.STDOUT)
54 p.wait() 53 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