| OLD | NEW |
| 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 """Monitor tracing events on chrome via chrome remote debugging.""" | 5 """Monitor tracing events on chrome via chrome remote debugging.""" |
| 6 | 6 |
| 7 import bisect | 7 import bisect |
| 8 import itertools | 8 import itertools |
| 9 import logging | 9 import logging |
| 10 import operator | 10 import operator |
| 11 | 11 |
| 12 import devtools_monitor | 12 import devtools_monitor |
| 13 | 13 |
| 14 | 14 |
| 15 _DISABLED_CATEGORIES = ('cc',) # Contains a lot of events, none of which we use. | 15 _DISABLED_CATEGORIES = ('cc',) # Contains a lot of events, none of which we use. |
| 16 INITIAL_CATEGORIES = ( | 16 INITIAL_CATEGORIES = ( |
| 17 'toplevel', 'blink', 'v8', 'java', 'devtools.timeline', | 17 ('toplevel', 'blink', 'v8', 'java', 'devtools.timeline', |
| 18 'blink.user_timing', 'blink.net') + tuple( | 18 'blink.user_timing', 'blink.net', 'disabled-by-default-blink.debug.layout') |
| 19 '-' + cat for cat in _DISABLED_CATEGORIES) | 19 + tuple('-' + cat for cat in _DISABLED_CATEGORIES)) |
| 20 | 20 |
| 21 | 21 |
| 22 class TracingTrack(devtools_monitor.Track): | 22 class TracingTrack(devtools_monitor.Track): |
| 23 """Grabs and processes trace event messages. | 23 """Grabs and processes trace event messages. |
| 24 | 24 |
| 25 See https://goo.gl/Qabkqk for details on the protocol. | 25 See https://goo.gl/Qabkqk for details on the protocol. |
| 26 """ | 26 """ |
| 27 def __init__(self, connection, additional_categories=None, | 27 def __init__(self, connection, additional_categories=None, |
| 28 fetch_stream=False): | 28 fetch_stream=False): |
| 29 """Initialize this TracingTrack. | 29 """Initialize this TracingTrack. |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 self._left = _IntervalTree(self.start, left_end, left_events) | 549 self._left = _IntervalTree(self.start, left_end, left_events) |
| 550 self._right = _IntervalTree(right_start, self.end, right_events) | 550 self._right = _IntervalTree(right_start, self.end, right_events) |
| 551 | 551 |
| 552 def _IsLeaf(self): | 552 def _IsLeaf(self): |
| 553 return self._left is None | 553 return self._left is None |
| 554 | 554 |
| 555 @classmethod | 555 @classmethod |
| 556 def _Overlaps(cls, event, start, end): | 556 def _Overlaps(cls, event, start, end): |
| 557 return (min(end, event.end_msec) - max(start, event.start_msec) > 0 | 557 return (min(end, event.end_msec) - max(start, event.start_msec) > 0 |
| 558 or start <= event.start_msec < end) # For instant events. | 558 or start <= event.start_msec < end) # For instant events. |
| OLD | NEW |