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 | |
18 # Track only the high-level GC stats to reduce the data load on dashboard. | |
19 _IGNORED_V8_STATS_RE = re.compile( | |
20 r'_(idle_deadline_overrun|percentage_idle|outside_idle)') | |
21 _V8_GC_HIGH_LEVEL_STATS_RE = re.compile(r'^v8-gc-(' | |
22 r'full-mark-compactor_|' | |
23 r'incremental-finalize_|' | |
24 r'incremental-step_|' | |
25 r'latency-mark-compactor_|' | |
26 r'memory-mark-compactor_|' | |
27 r'scavenger_|' | |
28 r'gc-total_)') | |
29 | |
30 | |
31 class _BrowsingBenchmark(perf_benchmark.PerfBenchmark): | |
32 """Base class for browsing benchmarks. | |
33 This benchmark measures memory usage with periodic memory dumps and v8 times. | |
34 See browsing_stories._BrowsingStory for workload description. | |
35 """ | |
36 | |
37 def CreateTimelineBasedMeasurementOptions(self): | |
38 categories = [ | |
39 # Disable all categories by default. | |
40 '-*', | |
41 # Memory categories. | |
42 'disabled-by-default-memory-infra', | |
43 # V8 categories. | |
44 'blink.console', | |
45 'disabled-by-default-v8.gc', | |
46 'renderer.scheduler', | |
47 'v8', | |
48 'webkit.console', | |
49 ] | |
50 options = timeline_based_measurement.Options( | |
51 chrome_trace_category_filter.ChromeTraceCategoryFilter( | |
52 ','.join(categories))) | |
53 options.config.enable_android_graphics_memtrack = True | |
54 # Trigger periodic light memory dumps every 1000 ms. | |
55 memory_dump_config = chrome_trace_config.MemoryDumpConfig() | |
56 memory_dump_config.AddTrigger('light', 1000) | |
57 options.config.chrome_trace_config.SetMemoryDumpConfig(memory_dump_config) | |
58 options.SetTimelineBasedMetrics(['v8AndMemoryMetrics']) | |
59 return options | |
60 | |
61 @classmethod | |
62 def Name(cls): | |
63 return 'v8.browsing_%s' % cls.page_set.PLATFORM | |
64 | |
65 @classmethod | |
66 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
67 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard | |
68 # is able to cope with the data load generated by TBMv2 metrics. | |
69 if 'memory:chrome' in value.name: | |
70 return ('renderer_processes' in value.name and | |
71 not _IGNORED_MEMORY_STATS_RE.search(value.name)) | |
72 return (_V8_GC_HIGH_LEVEL_STATS_RE.search(value.name) and | |
73 not _IGNORED_V8_STATS_RE.search(value.name)) | |
74 | |
75 @classmethod | |
76 def ShouldTearDownStateAfterEachStoryRun(cls): | |
77 return True | |
78 | |
79 | |
80 class DesktopNewsBenchmark(_BrowsingBenchmark): | |
petrcermak
2016/07/12 18:07:49
This should be DesktopBrowsingBenchmark
ulan
2016/07/13 12:47:31
Done.
| |
81 page_set = page_sets.DesktopBrowsingSystemHealthStorySet | |
82 | |
83 @classmethod | |
84 def ShouldDisable(cls, possible_browser): | |
85 return possible_browser.platform.GetDeviceTypeName() != 'Desktop' | |
86 | |
87 | |
88 class MobileNewsBenchmark(_BrowsingBenchmark): | |
petrcermak
2016/07/12 18:07:50
This should be MobileBrowsingBenchmark
ulan
2016/07/13 12:47:31
Done.
| |
89 page_set = page_sets.MobileBrowsingSystemHealthStorySet | |
90 | |
91 @classmethod | |
92 def ShouldDisable(cls, possible_browser): | |
93 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' | |
OLD | NEW |