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

Side by Side Diff: systrace/systrace/tracing_agents/atrace_agent.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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
OLDNEW
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 re 5 import re
6 import py_utils 6 import py_utils
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import threading 9 import threading
10 import zlib 10 import zlib
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 def SupportsExplicitClockSync(self): 192 def SupportsExplicitClockSync(self):
193 return True 193 return True
194 194
195 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): 195 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
196 """Records a clock sync marker. 196 """Records a clock sync marker.
197 197
198 Args: 198 Args:
199 sync_id: ID string for clock sync marker. 199 sync_id: ID string for clock sync marker.
200 """ 200 """
201 cmd = 'echo name=%s > /sys/kernel/debug/tracing/trace_marker' % sync_id 201 cmd = 'echo trace_event_clock_sync: name=%s >' \
202 ' /sys/kernel/debug/tracing/trace_marker' % sync_id
202 with self._device_utils.adb.PersistentShell( 203 with self._device_utils.adb.PersistentShell(
203 self._device_serial_number) as shell: 204 self._device_serial_number) as shell:
204 t1 = trace_time.Now() 205 t1 = trace_time.Now()
205 shell.RunCommand(cmd, close=True) 206 shell.RunCommand(cmd, close=True)
206 did_record_sync_marker_callback(t1, sync_id) 207 did_record_sync_marker_callback(t1, sync_id)
207 208
208 def _dump_trace(self): 209 def _dump_trace(self):
209 """Dumps the atrace buffer and returns the dumped buffer.""" 210 """Dumps the atrace buffer and returns the dumped buffer."""
210 dump_cmd = self._tracer_args + ['--async_dump'] 211 dump_cmd = self._tracer_args + ['--async_dump']
211 return self._device_utils.RunShellCommand(dump_cmd, raw_output=True) 212 return self._device_utils.RunShellCommand(dump_cmd, raw_output=True)
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 serial: Serial number of device. 501 serial: Serial number of device.
501 """ 502 """
502 503
503 args = [command] 504 args = [command]
504 dump, ret_code = util.run_adb_shell(args, serial) 505 dump, ret_code = util.run_adb_shell(args, serial)
505 if ret_code != 0: 506 if ret_code != 0:
506 return None 507 return None
507 508
508 dump = ''.join(dump) 509 dump = ''.join(dump)
509 return dump 510 return dump
OLDNEW
« no previous file with comments | « systrace/profile_chrome/profiler.py ('k') | systrace/systrace/tracing_agents/battor_trace_agent.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698