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

Unified Diff: build/android/adb_profile_chrome.py

Issue 164203004: adb_profile_chrome: Use Enter to stop early instead of Ctrl-C (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_profile_chrome.py
diff --git a/build/android/adb_profile_chrome.py b/build/android/adb_profile_chrome.py
index bb3e9d038805e652ad1ff2f5b1da6e54fbad9011..dddd7df4d4cca13f0b181a4c836fc065825499fb 100755
--- a/build/android/adb_profile_chrome.py
+++ b/build/android/adb_profile_chrome.py
@@ -10,6 +10,7 @@ import logging
import optparse
import os
import re
+import select
import shutil
import sys
import threading
@@ -263,6 +264,10 @@ def _PrintMessage(heading, eol='\n'):
sys.stdout.flush()
+def _WaitForEnter(timeout):
+ select.select([sys.stdin], [], [], timeout)
+
+
def _StartTracing(controllers, interval):
for controller in controllers:
controller.StartTracing(interval)
@@ -307,14 +312,12 @@ def _CaptureAndPullTrace(controllers, interval, output, compress, write_html):
try:
_StartTracing(controllers, interval)
if interval:
- _PrintMessage('Capturing %d-second %s. Press Ctrl-C to stop early...' % \
+ _PrintMessage('Capturing %d-second %s. Press Enter to stop early...' % \
(interval, trace_type), eol='')
- time.sleep(interval)
+ _WaitForEnter(interval)
else:
_PrintMessage('Capturing %s. Press Enter to stop...' % trace_type, eol='')
raw_input()
- except KeyboardInterrupt:
- _PrintMessage('\nInterrupted...', eol='')
finally:
_StopTracing(controllers)
if interval:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698