Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: tools/perf/benchmarks/news.py

Issue 2118293002: Add benchmark that imitates news reading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 _NewsBenchmark(perf_benchmark.PerfBenchmark):
32 """Base class for news browsing benchmarks.
33 This benchmark measures memory usage with periodic memory dumps and v8 times.
34 See page_sets.news_stories._NewsStory 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.SetTimelineBasedMetric('v8AndMemoryMetrics')
59 return options
60
61 @classmethod
62 def Name(cls):
63 return 'news_%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(_NewsBenchmark):
81 page_set = page_sets.DesktopNewsStorySet
82
83 @classmethod
84 def ShouldDisable(cls, possible_browser):
85 return possible_browser.platform.GetDeviceTypeName() != 'Desktop'
86
87
88 class MobileNewsBenchmark(_NewsBenchmark):
89 page_set = page_sets.MobileNewsStorySet
90
91 @classmethod
92 def ShouldDisable(cls, possible_browser):
93 return possible_browser.platform.GetDeviceTypeName() == 'Desktop'
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698