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

Side by Side Diff: tools/android/adb_profile_chrome/systrace_controller.py

Issue 333933003: [Android] Switch to DeviceUtils version of RunShellCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 threading 5 import threading
6 import zlib 6 import zlib
7 7
8 from adb_profile_chrome import controllers 8 from adb_profile_chrome import controllers
9 from adb_profile_chrome import util 9 from adb_profile_chrome import util
10 10
(...skipping 19 matching lines...) Expand all
30 self._ring_buffer = ring_buffer 30 self._ring_buffer = ring_buffer
31 self._done = threading.Event() 31 self._done = threading.Event()
32 self._thread = None 32 self._thread = None
33 self._trace_data = None 33 self._trace_data = None
34 34
35 def __repr__(self): 35 def __repr__(self):
36 return 'systrace' 36 return 'systrace'
37 37
38 @staticmethod 38 @staticmethod
39 def GetCategories(device): 39 def GetCategories(device):
40 return device.old_interface.RunShellCommand('atrace --list_categories') 40 return device.RunShellCommand('atrace --list_categories')
41 41
42 def StartTracing(self, _): 42 def StartTracing(self, _):
43 self._thread = threading.Thread(target=self._CollectData) 43 self._thread = threading.Thread(target=self._CollectData)
44 self._thread.start() 44 self._thread.start()
45 45
46 def StopTracing(self): 46 def StopTracing(self):
47 self._done.set() 47 self._done.set()
48 48
49 def PullTrace(self): 49 def PullTrace(self):
50 self._thread.join() 50 self._thread.join()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 except ValueError: 86 except ValueError:
87 raise RuntimeError('Systrace start marker not found') 87 raise RuntimeError('Systrace start marker not found')
88 trace_data = trace_data[trace_start + 6:] 88 trace_data = trace_data[trace_start + 6:]
89 89
90 # Collapse CRLFs that are added by adb shell. 90 # Collapse CRLFs that are added by adb shell.
91 if trace_data.startswith('\r\n'): 91 if trace_data.startswith('\r\n'):
92 trace_data = trace_data.replace('\r\n', '\n') 92 trace_data = trace_data.replace('\r\n', '\n')
93 93
94 # Skip the initial newline. 94 # Skip the initial newline.
95 return trace_data[1:] 95 return trace_data[1:]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698