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

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

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 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
OLDNEW
1 """ 1 """
2 Uses perf_events to count cycles and instructions 2 Uses perf_events to count cycles and instructions
3 3
4 Defaults options: 4 Defaults options:
5 job.profilers.add('cpistat', interval=1) 5 job.profilers.add('cpistat', interval=1)
6 """ 6 """
7 import time, os, subprocess 7 import time, os, subprocess
8 from autotest_lib.client.bin import profiler 8 from autotest_lib.client.bin import profiler
9 9
10 class cpistat(profiler.profiler): 10 class cpistat(profiler.profiler):
11 version = 1 11 version = 1
12 12
13 def initialize(self, interval = 1): 13 def initialize(self, interval = 1):
14 self.interval = interval 14 self.interval = interval
15 15
16 16
17 def start(self, test): 17 def start(self, test):
18 cmd = os.path.join(self.bindir, 'site_cpistat') 18 cmd = os.path.join(self.bindir, 'site_cpistat')
19 if not os.path.exists(cmd): 19 if not os.path.exists(cmd):
20 cmd = os.path.join(self.bindir, 'cpistat') 20 cmd = os.path.join(self.bindir, 'cpistat')
21 logfile = open(os.path.join(test.profdir, "cpistat"), 'w') 21 logfile = open(os.path.join(test.profdir, "cpistat"), 'w')
22 p = subprocess.Popen(cmd, stdout=logfile, 22 p = subprocess.Popen(cmd, stdout=logfile,
23 stderr=subprocess.STDOUT) 23 stderr=subprocess.STDOUT)
24 self.pid = p.pid 24 self.pid = p.pid
25 25
26 26
27 def stop(self, test): 27 def stop(self, test):
28 os.kill(self.pid, 15) 28 os.kill(self.pid, 15)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698