| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 re | 5 import re |
| 6 | 6 |
| 7 from telemetry.timeline import tracing_category_filter | 7 from telemetry.timeline import tracing_category_filter |
| 8 | 8 |
| 9 RECORD_MODE_PARAM = 'record_mode' | 9 RECORD_MODE_PARAM = 'record_mode' |
| 10 ENABLE_SYSTRACE_PARAM = 'enable_systrace' | 10 ENABLE_SYSTRACE_PARAM = 'enable_systrace' |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 """Stores the triggers for memory dumps in ChromeTraceConfig.""" | 334 """Stores the triggers for memory dumps in ChromeTraceConfig.""" |
| 335 def __init__(self): | 335 def __init__(self): |
| 336 self._triggers = [] | 336 self._triggers = [] |
| 337 | 337 |
| 338 def AddTrigger(self, mode, periodic_interval_ms): | 338 def AddTrigger(self, mode, periodic_interval_ms): |
| 339 """Adds a new trigger to config. | 339 """Adds a new trigger to config. |
| 340 | 340 |
| 341 Args: | 341 Args: |
| 342 periodic_interval_ms: Dump time period in milliseconds. | 342 periodic_interval_ms: Dump time period in milliseconds. |
| 343 level_of_detail: Memory dump level of detail string. | 343 level_of_detail: Memory dump level of detail string. |
| 344 Valid arguments are "light" and "detailed". | 344 Valid arguments are "background", "light" and "detailed". |
| 345 """ | 345 """ |
| 346 assert mode in ['light', 'detailed'] | 346 assert mode in ['background', 'light', 'detailed'] |
| 347 assert periodic_interval_ms > 0 | 347 assert periodic_interval_ms > 0 |
| 348 self._triggers.append({'mode': mode, | 348 self._triggers.append({'mode': mode, |
| 349 'periodic_interval_ms': periodic_interval_ms}) | 349 'periodic_interval_ms': periodic_interval_ms}) |
| 350 | 350 |
| 351 def GetDictForChromeTracing(self): | 351 def GetDictForChromeTracing(self): |
| 352 """Returns the dump config as dictionary for chrome tracing.""" | 352 """Returns the dump config as dictionary for chrome tracing.""" |
| 353 # An empty trigger list would mean no periodic memory dumps. | 353 # An empty trigger list would mean no periodic memory dumps. |
| 354 return {'memory_dump_config': {'triggers': self._triggers}} | 354 return {'memory_dump_config': {'triggers': self._triggers}} |
| OLD | NEW |