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

Side by Side Diff: build/android/pylib/android/logdog_logcat_monitor.py

Issue 2753993002: (Reland) Use logdog butler subcommand to run tests. (Closed)
Patch Set: when see none, don't return immediately Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 logging 5 import logging
6 6
7 from devil.android import logcat_monitor 7 from devil.android import logcat_monitor
8 from devil.utils import reraiser_thread 8 from devil.utils import reraiser_thread
9 from pylib.utils import logdog_helper 9 from pylib.utils import logdog_helper
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 self._StartRecording() 52 self._StartRecording()
53 53
54 def _StartRecording(self): 54 def _StartRecording(self):
55 """Starts recording logcat to file. 55 """Starts recording logcat to file.
56 56
57 Write logcat to stream at the same time. 57 Write logcat to stream at the same time.
58 """ 58 """
59 def record_to_stream(): 59 def record_to_stream():
60 if self._logdog_stream: 60 if self._logdog_stream:
61 for data in self._adb.Logcat(filter_specs=self._filter_specs, 61 for data in self._adb.Logcat(filter_specs=self._filter_specs,
62 logcat_format='threadtime'): 62 logcat_format='threadtime',
63 iter_timeout=0.05):
jbudorick 2017/03/17 19:20:21 This *might* be spinning too much. How's the perfo
BigBossZhiling 2017/03/20 22:09:50 Acknowledged.
63 if self._stop_recording_event.isSet(): 64 if self._stop_recording_event.isSet():
64 return 65 return
65 self._logdog_stream.write(data + '\n') 66 if data:
67 self._logdog_stream.write(data + '\n')
66 68
67 self._stop_recording_event.clear() 69 self._stop_recording_event.clear()
68 if not self._record_thread: 70 if not self._record_thread:
69 self._record_thread = reraiser_thread.ReraiserThread(record_to_stream) 71 self._record_thread = reraiser_thread.ReraiserThread(record_to_stream)
70 self._record_thread.start() 72 self._record_thread.start()
71 73
72 def Close(self): 74 def Close(self):
73 """Override parent's close method.""" 75 """Override parent's close method."""
74 pass 76 pass
75 77
76 def __del__(self): 78 def __del__(self):
77 """Override parent's delete method.""" 79 """Override parent's delete method."""
78 pass 80 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698