|
|
Description[Telemetry] Drop check for devtools support for record-as-much-as-possible (chrome >2118)
BUG=396081
Committed: https://crrev.com/1ca83b0ff277b7ec1d10ed3a14dcca823ce72249
Cr-Commit-Position: refs/heads/master@{#309872}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Drop chrome_browser_backend from TracingBackend. The version check was the only thing that needed i… #Patch Set 3 : Add back the mapping from telemetry tracing record_mode to DevTools string. Update docstrings. #
Total comments: 1
Patch Set 4 : Restore original map style #Patch Set 5 : Rebase. #
Messages
Total messages: 44 (18 generated)
slamm@chromium.org changed reviewers: + nednguyen@google.com
https://codereview.chromium.org/808563005/diff/1/tools/telemetry/telemetry/co... File tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py (right): https://codereview.chromium.org/808563005/diff/1/tools/telemetry/telemetry/co... tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py:23: def __init__(self, devtools_port, chrome_browser_backend): We should be able to drop chrome_browser_backend from the constructor.
nednguyen@google.com changed reviewers: + ariblue@google.com
Drop chrome_browser_backend from TracingBackend. The version check was the only thing that needed it.
The CQ bit was checked by nednguyen@google.com
lgtm
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/808563005/20001
The CQ bit was unchecked by nednguyen@google.com
Add back the mapping from telemetry tracing record_mode to DevTools string. Update docstrings.
As per our conversation, I added back the dict to map the Telemetry record_mode to the DevTools API string. I fixed up a couple doc strings too. https://codereview.chromium.org/808563005/diff/1/tools/telemetry/telemetry/co... File tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py (right): https://codereview.chromium.org/808563005/diff/1/tools/telemetry/telemetry/co... tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py:23: def __init__(self, devtools_port, chrome_browser_backend): On 2014/12/22 18:29:48, nednguyen wrote: > We should be able to drop chrome_browser_backend from the constructor. Done. That is much better.
Feel free to land this after you address the nit. https://codereview.chromium.org/808563005/diff/40001/tools/telemetry/telemetr... File tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py (right): https://codereview.chromium.org/808563005/diff/40001/tools/telemetry/telemetr... tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py:53: }[trace_options.record_mode] Nit: can you declare the map like the left?
Restore original map style
Restore original map style
Patchset #4 (id:60001) has been deleted
The CQ bit was checked by slamm@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/808563005/80001
chrishenry@google.com changed reviewers: + chrishenry@google.com
Can you make sure that L webview is past this branch number or doesn't require this for other reason? Thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py: While running git apply --index -3 -p1; error: patch failed: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py:30 Falling back to three-way merge... Applied patch to 'tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py' with conflicts. U tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py Patch: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py Index: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py index 62426419bdc07504e10264d4b74b915761da93a8..f9fb353b6bdc1c5d4e507a7f3e76aa9ea5019619 100644 --- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py +++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py @@ -20,7 +20,7 @@ class TracingHasNotRunException(Exception): class TracingBackend(object): - def __init__(self, devtools_port, chrome_browser_backend): + def __init__(self, devtools_port): self._inspector_websocket = inspector_websocket.InspectorWebsocket( self._ErrorHandler) self._inspector_websocket.RegisterDomain( @@ -30,42 +30,33 @@ class TracingBackend(object): 'ws://127.0.0.1:%i/devtools/browser' % devtools_port) self._tracing_data = [] self._is_tracing_running = False - self._chrome_browser_backend = chrome_browser_backend @property def is_tracing_running(self): return self._is_tracing_running - @property - def _devtools_client(self): - return self._chrome_browser_backend.devtools_client - def StartTracing(self, trace_options, custom_categories=None, timeout=10): - """ Starts tracing on the first call and returns True. Returns False - and does nothing on subsequent nested calls. + """When first called, starts tracing, and returns True. + + Once started, repeated calls do not affect tracing and return False. """ if self.is_tracing_running: return False # Reset collected tracing data from previous tracing calls. self._tracing_data = [] self._CheckNotificationSupported() - #TODO(nednguyen): remove this when the stable branch pass 2118. - if (trace_options.record_mode == tracing_options.RECORD_AS_MUCH_AS_POSSIBLE - and self._devtools_client.GetChromeBranchNumber() - and self._devtools_client.GetChromeBranchNumber() < 2118): - logging.warning( - 'Cannot use %s tracing mode on chrome browser with branch version %i,' - ' (<2118) fallback to use %s tracing mode' % ( - trace_options.record_mode, - self._devtools_client.GetChromeBranchNumber(), - tracing_options.RECORD_UNTIL_FULL)) - trace_options.record_mode = tracing_options.RECORD_UNTIL_FULL - req = {'method': 'Tracing.start'} - req['params'] = {} + # Map telemetry's tracing record_mode to the DevTools API string. + # (The keys happen to be the same as the values.) m = {tracing_options.RECORD_UNTIL_FULL: 'record-until-full', tracing_options.RECORD_AS_MUCH_AS_POSSIBLE: 'record-as-much-as-possible'} - req['params']['options'] = m[trace_options.record_mode] + # DevTools started supporting RECORD_AS_MUCH_AS_POSSIBLE in Chrome 2118. + # However, we send it for earlier versions as well because Chrome ignores + # the unknown value and falls back to RECORD_UNTIL_FULL. + req = { + 'method': 'Tracing.start', + 'params': {'options': m[trace_options.record_mode]} + } if custom_categories: req['params']['categories'] = custom_categories self._inspector_websocket.SyncRequest(req, timeout) @@ -73,9 +64,10 @@ class TracingBackend(object): return True def StopTracing(self, timeout=30): - """ Stops tracing and returns the raw json trace result. It this is called - after tracing has been stopped, trace data from the last tracing run is - returned. + """Stops tracing, and returns the raw json trace result. + + If this is called after tracing has been stopped, this returns + trace data from the most recent tracing run. """ if not self.is_tracing_running: if not self._tracing_data:
On 2014/12/22 23:26:36, chrishenry (OOO until Jan 5) wrote: > Can you make sure that L webview is past this branch number or doesn't require > this for other reason? Thanks! Doesn't matter that much. I implemented this after the I landed the record-as-much-as-possible tracing mode. If the chrome webview doesn't past that branch number, then devtool implementation also ignore that options field.
The CQ bit was checked by nednguyen@google.com
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/808563005/80001
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py: While running git apply --index -3 -p1; error: patch failed: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py:30 Falling back to three-way merge... Applied patch to 'tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py' with conflicts. U tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py Patch: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py Index: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py index 62426419bdc07504e10264d4b74b915761da93a8..f9fb353b6bdc1c5d4e507a7f3e76aa9ea5019619 100644 --- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py +++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py @@ -20,7 +20,7 @@ class TracingHasNotRunException(Exception): class TracingBackend(object): - def __init__(self, devtools_port, chrome_browser_backend): + def __init__(self, devtools_port): self._inspector_websocket = inspector_websocket.InspectorWebsocket( self._ErrorHandler) self._inspector_websocket.RegisterDomain( @@ -30,42 +30,33 @@ class TracingBackend(object): 'ws://127.0.0.1:%i/devtools/browser' % devtools_port) self._tracing_data = [] self._is_tracing_running = False - self._chrome_browser_backend = chrome_browser_backend @property def is_tracing_running(self): return self._is_tracing_running - @property - def _devtools_client(self): - return self._chrome_browser_backend.devtools_client - def StartTracing(self, trace_options, custom_categories=None, timeout=10): - """ Starts tracing on the first call and returns True. Returns False - and does nothing on subsequent nested calls. + """When first called, starts tracing, and returns True. + + Once started, repeated calls do not affect tracing and return False. """ if self.is_tracing_running: return False # Reset collected tracing data from previous tracing calls. self._tracing_data = [] self._CheckNotificationSupported() - #TODO(nednguyen): remove this when the stable branch pass 2118. - if (trace_options.record_mode == tracing_options.RECORD_AS_MUCH_AS_POSSIBLE - and self._devtools_client.GetChromeBranchNumber() - and self._devtools_client.GetChromeBranchNumber() < 2118): - logging.warning( - 'Cannot use %s tracing mode on chrome browser with branch version %i,' - ' (<2118) fallback to use %s tracing mode' % ( - trace_options.record_mode, - self._devtools_client.GetChromeBranchNumber(), - tracing_options.RECORD_UNTIL_FULL)) - trace_options.record_mode = tracing_options.RECORD_UNTIL_FULL - req = {'method': 'Tracing.start'} - req['params'] = {} + # Map telemetry's tracing record_mode to the DevTools API string. + # (The keys happen to be the same as the values.) m = {tracing_options.RECORD_UNTIL_FULL: 'record-until-full', tracing_options.RECORD_AS_MUCH_AS_POSSIBLE: 'record-as-much-as-possible'} - req['params']['options'] = m[trace_options.record_mode] + # DevTools started supporting RECORD_AS_MUCH_AS_POSSIBLE in Chrome 2118. + # However, we send it for earlier versions as well because Chrome ignores + # the unknown value and falls back to RECORD_UNTIL_FULL. + req = { + 'method': 'Tracing.start', + 'params': {'options': m[trace_options.record_mode]} + } if custom_categories: req['params']['categories'] = custom_categories self._inspector_websocket.SyncRequest(req, timeout) @@ -73,9 +64,10 @@ class TracingBackend(object): return True def StopTracing(self, timeout=30): - """ Stops tracing and returns the raw json trace result. It this is called - after tracing has been stopped, trace data from the last tracing run is - returned. + """Stops tracing, and returns the raw json trace result. + + If this is called after tracing has been stopped, this returns + trace data from the most recent tracing run. """ if not self.is_tracing_running: if not self._tracing_data:
The CQ bit was unchecked by commit-bot@chromium.org
Rebase
Patchset #5 (id:100001) has been deleted
The CQ bit was checked by slamm@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/808563005/80001
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py: While running git apply --index -3 -p1; error: patch failed: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py:30 Falling back to three-way merge... Applied patch to 'tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py' with conflicts. U tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py Patch: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py Index: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py index 62426419bdc07504e10264d4b74b915761da93a8..f9fb353b6bdc1c5d4e507a7f3e76aa9ea5019619 100644 --- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py +++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py @@ -20,7 +20,7 @@ class TracingHasNotRunException(Exception): class TracingBackend(object): - def __init__(self, devtools_port, chrome_browser_backend): + def __init__(self, devtools_port): self._inspector_websocket = inspector_websocket.InspectorWebsocket( self._ErrorHandler) self._inspector_websocket.RegisterDomain( @@ -30,42 +30,33 @@ class TracingBackend(object): 'ws://127.0.0.1:%i/devtools/browser' % devtools_port) self._tracing_data = [] self._is_tracing_running = False - self._chrome_browser_backend = chrome_browser_backend @property def is_tracing_running(self): return self._is_tracing_running - @property - def _devtools_client(self): - return self._chrome_browser_backend.devtools_client - def StartTracing(self, trace_options, custom_categories=None, timeout=10): - """ Starts tracing on the first call and returns True. Returns False - and does nothing on subsequent nested calls. + """When first called, starts tracing, and returns True. + + Once started, repeated calls do not affect tracing and return False. """ if self.is_tracing_running: return False # Reset collected tracing data from previous tracing calls. self._tracing_data = [] self._CheckNotificationSupported() - #TODO(nednguyen): remove this when the stable branch pass 2118. - if (trace_options.record_mode == tracing_options.RECORD_AS_MUCH_AS_POSSIBLE - and self._devtools_client.GetChromeBranchNumber() - and self._devtools_client.GetChromeBranchNumber() < 2118): - logging.warning( - 'Cannot use %s tracing mode on chrome browser with branch version %i,' - ' (<2118) fallback to use %s tracing mode' % ( - trace_options.record_mode, - self._devtools_client.GetChromeBranchNumber(), - tracing_options.RECORD_UNTIL_FULL)) - trace_options.record_mode = tracing_options.RECORD_UNTIL_FULL - req = {'method': 'Tracing.start'} - req['params'] = {} + # Map telemetry's tracing record_mode to the DevTools API string. + # (The keys happen to be the same as the values.) m = {tracing_options.RECORD_UNTIL_FULL: 'record-until-full', tracing_options.RECORD_AS_MUCH_AS_POSSIBLE: 'record-as-much-as-possible'} - req['params']['options'] = m[trace_options.record_mode] + # DevTools started supporting RECORD_AS_MUCH_AS_POSSIBLE in Chrome 2118. + # However, we send it for earlier versions as well because Chrome ignores + # the unknown value and falls back to RECORD_UNTIL_FULL. + req = { + 'method': 'Tracing.start', + 'params': {'options': m[trace_options.record_mode]} + } if custom_categories: req['params']['categories'] = custom_categories self._inspector_websocket.SyncRequest(req, timeout) @@ -73,9 +64,10 @@ class TracingBackend(object): return True def StopTracing(self, timeout=30): - """ Stops tracing and returns the raw json trace result. It this is called - after tracing has been stopped, trace data from the last tracing run is - returned. + """Stops tracing, and returns the raw json trace result. + + If this is called after tracing has been stopped, this returns + trace data from the most recent tracing run. """ if not self.is_tracing_running: if not self._tracing_data:
The CQ bit was unchecked by commit-bot@chromium.org
Rebase.
The CQ bit was checked by slamm@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/808563005/120001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tes...)
The CQ bit was checked by slamm@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/808563005/120001
Message was sent while issue was closed.
Committed patchset #5 (id:120001)
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/1ca83b0ff277b7ec1d10ed3a14dcca823ce72249 Cr-Commit-Position: refs/heads/master@{#309872} |