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

Side by Side Diff: tools/perf/record_android_profile.py

Issue 511653002: Add profiling_controller that manages profilers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/browser.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import sys 7 import sys
8 import tempfile 8 import tempfile
9 9
10 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'telemetry')) 10 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'telemetry'))
11 11
12 from telemetry.core import browser_finder 12 from telemetry.core import browser_finder
13 from telemetry.core import browser_options 13 from telemetry.core import browser_options
14 14
15 15
16 def _RunPrebuilt(options): 16 def _RunPrebuilt(options):
17 browser_to_create = browser_finder.FindBrowser(options) 17 browser_to_create = browser_finder.FindBrowser(options)
18 with browser_to_create.Create() as browser: 18 with browser_to_create.Create() as browser:
19 browser.Start() 19 browser.Start()
20 output_file = os.path.join(tempfile.mkdtemp(), options.profiler) 20 output_file = os.path.join(tempfile.mkdtemp(), options.profiler)
21 raw_input('Press enter to start profiling...') 21 raw_input('Press enter to start profiling...')
22 print '>> Starting profiler', options.profiler 22 print '>> Starting profiler', options.profiler
23 browser.StartProfiling(options.profiler, output_file) 23 browser.platform.profiling_controller.Start(
24 options.profiler, output_file)
24 print 'Press enter or CTRL+C to stop' 25 print 'Press enter or CTRL+C to stop'
25 try: 26 try:
26 raw_input() 27 raw_input()
27 except KeyboardInterrupt: 28 except KeyboardInterrupt:
28 pass 29 pass
29 finally: 30 finally:
30 browser.StopProfiling() 31 browser.platform.profiling_controller.Stop()
31 print '<< Stopped profiler ', options.profiler 32 print '<< Stopped profiler ', options.profiler
32 33
33 34
34 if __name__ == '__main__': 35 if __name__ == '__main__':
35 browser_finder_options = browser_options.BrowserFinderOptions() 36 browser_finder_options = browser_options.BrowserFinderOptions()
36 parser = browser_finder_options.CreateParser('') 37 parser = browser_finder_options.CreateParser('')
37 profiler_options, _ = parser.parse_args() 38 profiler_options, _ = parser.parse_args()
38 sys.exit(_RunPrebuilt(profiler_options)) 39 sys.exit(_RunPrebuilt(profiler_options))
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/browser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698