Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import re | |
| 6 | |
| 7 from core import perf_benchmark | |
| 8 from telemetry.timeline import chrome_trace_config | |
| 9 from telemetry.timeline import chrome_trace_category_filter | |
| 10 from telemetry.web_perf import timeline_based_measurement | |
| 11 import page_sets | |
| 12 | |
| 13 | |
| 14 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() | |
| 15 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value /numeric.html#L323 | |
| 16 _IGNORED_MEMORY_STATS_RE = re.compile(r'_(std|count|min|sum|pct_\d{4}(_\d+)?)$') | |
| 17 _MEMORY_STATS_RE = re.compile(r'renderer_processes') | |
|
petrcermak
2016/07/07 14:55:55
You can replace this by |'renderer_processes' in v
ulan
2016/07/07 17:34:38
Done.
petrcermak
2016/07/08 09:17:53
There's no point in having the regular expression
ulan
2016/07/08 09:50:57
Done.
| |
| 18 | |
| 19 # Track only the high-level GC stats to reduce the data load on dashboard. | |
| 20 _IGNORED_V8_STATS_RE = re.compile( | |
| 21 r'_(idle_deadline_overrun|percentage_idle|outside_idle)') | |
|
petrcermak
2016/07/07 14:55:56
Should this only match the end of the name ("$" at
ulan
2016/07/07 17:34:38
We can have outside_idle_(max|sum|min...).
petrcermak
2016/07/08 09:17:53
Acknowledged.
| |
| 22 _V8_GC_HIGH_LEVEL_STATS_RE = re.compile( | |
| 23 r'v8-gc-full-mark-compactor_|' | |
|
petrcermak
2016/07/07 14:55:55
Let's use the power of regular expressions when yo
ulan
2016/07/07 17:34:38
Thanks, I chose the second option as it seems more
petrcermak
2016/07/08 09:17:53
Acknowledged.
| |
| 24 r'v8-gc-incremental-finalize_|' | |
| 25 r'v8-gc-incremental-step_|' | |
| 26 r'v8-gc-latency-mark-compactor_|' | |
| 27 r'v8-gc-memory-mark-compactor_|' | |
| 28 r'v8-gc-scavenger_|' | |
| 29 r'v8-gc-total_') | |
| 30 | |
| 31 | |
| 32 class _NewsBenchmark(perf_benchmark.PerfBenchmark): | |
| 33 """ Base class for news browsing benchmarks. | |
|
petrcermak
2016/07/07 14:55:55
nit: Remove space after quotes
ulan
2016/07/07 17:34:38
Done.
| |
| 34 This benchmark measures memory usage with periodic memory dumps and v8 times. | |
| 35 See page_sets.news_stories._NewsStory for workload description. | |
| 36 """ | |
| 37 | |
| 38 def CreateTimelineBasedMeasurementOptions(self): | |
| 39 categories = [ | |
| 40 # Disable all categories by default. | |
| 41 '-*', | |
| 42 # Memory categories. | |
| 43 'disabled-by-default-memory-infra', | |
| 44 # V8 categories. | |
| 45 'blink.console', | |
| 46 'disabled-by-default-v8.gc', | |
| 47 'renderer.scheduler', | |
| 48 'v8', | |
| 49 'webkit.console', | |
| 50 ] | |
| 51 options = timeline_based_measurement.Options( | |
| 52 chrome_trace_category_filter.ChromeTraceCategoryFilter( | |
| 53 ','.join(categories))) | |
| 54 options.config.enable_android_graphics_memtrack = True | |
| 55 # Trigger periodic light memory dumps every 1000 ms. | |
| 56 memory_dump_config = chrome_trace_config.MemoryDumpConfig() | |
| 57 memory_dump_config.AddTrigger('light', 1000) | |
| 58 options.config.chrome_trace_config.SetMemoryDumpConfig(memory_dump_config) | |
| 59 options.SetTimelineBasedMetric('v8AndMemoryMetrics') | |
| 60 return options | |
| 61 | |
| 62 @classmethod | |
| 63 def Name(cls): | |
| 64 return 'news_%s' % cls.page_set.PLATFORM | |
| 65 | |
| 66 @classmethod | |
| 67 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 68 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard | |
| 69 # is able to cope with the data load generated by TBMv2 metrics. | |
| 70 if 'memory:chrome' in value.name: | |
| 71 return (_MEMORY_STATS_RE.search(value.name) and | |
| 72 not _IGNORED_MEMORY_STATS_RE.search(value.name)) | |
|
petrcermak
2016/07/07 14:55:55
You have this in both statements. I suggest you fa
ulan
2016/07/07 17:34:38
Note that the branch below has ignored V8 stats, n
petrcermak
2016/07/08 09:17:53
Ack. Sorry, I didn't realize that.
| |
| 73 return (_V8_GC_HIGH_LEVEL_STATS_RE.search(value.name) and | |
| 74 not _IGNORED_V8_STATS_RE.search(value.name)) | |
| 75 | |
| 76 @classmethod | |
| 77 def ShouldTearDownStateAfterEachStoryRun(cls): | |
| 78 return True | |
| 79 | |
| 80 | |
| 81 class DesktopNewsBenchmark(_NewsBenchmark): | |
| 82 page_set = page_sets.DesktopNewsStorySet | |
| 83 | |
| 84 @classmethod | |
| 85 def ShouldDisable(cls, possible_browser): | |
| 86 return possible_browser.platform.GetDeviceTypeName() != 'Desktop' | |
| 87 | |
| 88 | |
| 89 class MobileNewsBenchmark(_NewsBenchmark): | |
| 90 page_set = page_sets.MobileNewsStorySet | |
| 91 | |
| 92 @classmethod | |
| 93 def ShouldDisable(cls, possible_browser): | |
| 94 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' | |
| OLD | NEW |