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 | |
petrcermak
2016/07/07 15:04:45
This file is pretty much the same as news.py in ht
| |
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 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() | |
14 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value /numeric.html#L323 | |
15 _IGNORED_MEMORY_STATS_RE = re.compile(r'_(std|count|min|sum|pct_\d{4}(_\d+)?)$') | |
16 _MEMORY_STATS_RE = re.compile(r'renderer_processes') | |
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( | |
22 r'v8-gc-incremental-finalize_|' | |
23 r'v8-gc-incremental-step_|' | |
24 r'v8-gc-latency-mark-compactor_|' | |
25 r'v8-gc-memory-mark-compactor_|' | |
26 r'v8-gc-scavenger_|' | |
27 r'v8-gc-total_') | |
28 | |
29 | |
30 class _BrowseMediaBenchmark(perf_benchmark.PerfBenchmark): | |
31 """ Base class for media browsing benchmarks. | |
32 This benchmark measures memory usage with periodic memory dumps and v8 times. | |
33 See page_sets.media_browsing_stories._BrowseMediaStory for workload | |
34 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.SetTimelineBasedMetric('v8AndMemoryMetrics') | |
59 return options | |
60 | |
61 @classmethod | |
62 def Name(cls): | |
63 return 'browse_media_%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 (_MEMORY_STATS_RE.search(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 class MobileBrowseMediaBenchmark(_BrowseMediaBenchmark): | |
petrcermak
2016/07/07 15:04:45
nednguyen: I can see many benchmarks having to do
| |
80 page_set = page_sets.MobileBrowseMediaStorySet | |
81 | |
82 @classmethod | |
83 def ShouldDisable(cls, possible_browser): | |
84 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' | |
85 | |
86 class DesktopNewsBenchmark(_BrowseMediaBenchmark): | |
87 page_set = page_sets.DesktopBrowseMediaStorySet | |
88 | |
89 @classmethod | |
90 def ShouldDisable(cls, possible_browser): | |
91 return possible_browser.platform.GetDeviceTypeName() != 'Desktop' | |
OLD | NEW |