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

Side by Side Diff: systrace/profile_chrome/chrome_startup_tracing_agent.py

Issue 2712163002: [Systrace] Fix systrace clock syncing issue with BattOr. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | systrace/profile_chrome/chrome_tracing_agent.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 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import optparse 5 import optparse
6 import os 6 import os
7 import py_utils 7 import py_utils
8 import re 8 import re
9 9
10 from devil.android import flag_changer 10 from devil.android import flag_changer
11 from devil.android.perf import cache_control 11 from devil.android.perf import cache_control
12 from devil.android.sdk import intent 12 from devil.android.sdk import intent
13
14 from systrace import trace_result 13 from systrace import trace_result
15 from systrace import tracing_agents 14 from systrace import tracing_agents
15 from telemetry.timeline import trace_data as trace_data_module
rnephew (Reviews Here) 2017/02/24 17:21:26 I eventually would like to move this out of teleme
16 16
17 17
18 class ChromeStartupTracingAgent(tracing_agents.TracingAgent): 18 class ChromeStartupTracingAgent(tracing_agents.TracingAgent):
19 def __init__(self, device, package_info, cold, url): 19 def __init__(self, device, package_info, cold, url):
20 tracing_agents.TracingAgent.__init__(self) 20 tracing_agents.TracingAgent.__init__(self)
21 self._device = device 21 self._device = device
22 self._package_info = package_info 22 self._package_info = package_info
23 self._cold = cold 23 self._cold = cold
24 self._logcat_monitor = self._device.GetLogcatMonitor() 24 self._logcat_monitor = self._device.GetLogcatMonitor()
25 self._url = url 25 self._url = url
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 finally: 70 finally:
71 self._TearDownTracing() 71 self._TearDownTracing()
72 return True 72 return True
73 73
74 @py_utils.Timeout(tracing_agents.GET_RESULTS_TIMEOUT) 74 @py_utils.Timeout(tracing_agents.GET_RESULTS_TIMEOUT)
75 def GetResults(self, timeout=None): 75 def GetResults(self, timeout=None):
76 with open(self._PullTrace(), 'r') as f: 76 with open(self._PullTrace(), 'r') as f:
77 trace_data = f.read() 77 trace_data = f.read()
78 return trace_result.TraceResult('traceEvents', trace_data) 78 return trace_result.TraceResult('traceEvents', trace_data)
79 79
80 def CollectAgentTraceData(self, trace_data_builder):
rnephew (Reviews Here) 2017/02/24 17:21:26 Made changes to make it operate more like the trac
81 with open(self._PullTrace(), 'r') as f:
82 data = f.read()
83 trace_data_builder.AddTraceFor(trace_data_module.CHROME_TRACE_PART, data)
84
80 def _PullTrace(self): 85 def _PullTrace(self):
81 trace_file = self._trace_file.replace('/storage/emulated/0/', '/sdcard/') 86 trace_file = self._trace_file.replace('/storage/emulated/0/', '/sdcard/')
82 host_file = os.path.join(os.path.curdir, os.path.basename(trace_file)) 87 host_file = os.path.join(os.path.curdir, os.path.basename(trace_file))
83 self._device.PullFile(trace_file, host_file) 88 self._device.PullFile(trace_file, host_file)
84 return host_file 89 return host_file
85 90
86 def SupportsExplicitClockSync(self): 91 def SupportsExplicitClockSync(self):
87 return False 92 return False
88 93
89 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): 94 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
(...skipping 24 matching lines...) Expand all
114 default='https://www.google.com', metavar='URL') 119 default='https://www.google.com', metavar='URL')
115 options.add_option('--cold', help='Flush the OS page cache before starting ' 120 options.add_option('--cold', help='Flush the OS page cache before starting '
116 'the browser. Note that this require a device with root ' 121 'the browser. Note that this require a device with root '
117 'access.', default=False, action='store_true') 122 'access.', default=False, action='store_true')
118 return options 123 return options
119 124
120 def get_config(options): 125 def get_config(options):
121 return ChromeStartupConfig(options.device, options.package_info, 126 return ChromeStartupConfig(options.device, options.package_info,
122 options.cold, options.url, 127 options.cold, options.url,
123 options.chrome_categories) 128 options.chrome_categories)
OLDNEW
« no previous file with comments | « no previous file | systrace/profile_chrome/chrome_tracing_agent.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698