Chromium Code Reviews| Index: tools/perf/benchmarks/news.py |
| diff --git a/tools/perf/benchmarks/news.py b/tools/perf/benchmarks/news.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..af06225eee0b4f8269ab32df2b2804887ab3505a |
| --- /dev/null |
| +++ b/tools/perf/benchmarks/news.py |
| @@ -0,0 +1,94 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import re |
| + |
| +from core import perf_benchmark |
| +from telemetry.timeline import chrome_trace_config |
| +from telemetry.timeline import chrome_trace_category_filter |
| +from telemetry.web_perf import timeline_based_measurement |
| +import page_sets |
| + |
| + |
| +# See tr.v.Numeric.getSummarizedScalarNumericsWithNames() |
| +# https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value/numeric.html#L323 |
| +_IGNORED_MEMORY_STATS_RE = re.compile(r'_(std|count|min|sum|pct_\d{4}(_\d+)?)$') |
| +_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.
|
| + |
| +# Track only the high-level GC stats to reduce the data load on dashboard. |
| +_IGNORED_V8_STATS_RE = re.compile( |
| + 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.
|
| +_V8_GC_HIGH_LEVEL_STATS_RE = re.compile( |
| + 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.
|
| + r'v8-gc-incremental-finalize_|' |
| + r'v8-gc-incremental-step_|' |
| + r'v8-gc-latency-mark-compactor_|' |
| + r'v8-gc-memory-mark-compactor_|' |
| + r'v8-gc-scavenger_|' |
| + r'v8-gc-total_') |
| + |
| + |
| +class _NewsBenchmark(perf_benchmark.PerfBenchmark): |
| + """ 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.
|
| + This benchmark measures memory usage with periodic memory dumps and v8 times. |
| + See page_sets.news_stories._NewsStory for workload description. |
| + """ |
| + |
| + def CreateTimelineBasedMeasurementOptions(self): |
| + categories = [ |
| + # Disable all categories by default. |
| + '-*', |
| + # Memory categories. |
| + 'disabled-by-default-memory-infra', |
| + # V8 categories. |
| + 'blink.console', |
| + 'disabled-by-default-v8.gc', |
| + 'renderer.scheduler', |
| + 'v8', |
| + 'webkit.console', |
| + ] |
| + options = timeline_based_measurement.Options( |
| + chrome_trace_category_filter.ChromeTraceCategoryFilter( |
| + ','.join(categories))) |
| + options.config.enable_android_graphics_memtrack = True |
| + # Trigger periodic light memory dumps every 1000 ms. |
| + memory_dump_config = chrome_trace_config.MemoryDumpConfig() |
| + memory_dump_config.AddTrigger('light', 1000) |
| + options.config.chrome_trace_config.SetMemoryDumpConfig(memory_dump_config) |
| + options.SetTimelineBasedMetric('v8AndMemoryMetrics') |
| + return options |
| + |
| + @classmethod |
| + def Name(cls): |
| + return 'news_%s' % cls.page_set.PLATFORM |
| + |
| + @classmethod |
| + def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| + # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard |
| + # is able to cope with the data load generated by TBMv2 metrics. |
| + if 'memory:chrome' in value.name: |
| + return (_MEMORY_STATS_RE.search(value.name) and |
| + 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.
|
| + return (_V8_GC_HIGH_LEVEL_STATS_RE.search(value.name) and |
| + not _IGNORED_V8_STATS_RE.search(value.name)) |
| + |
| + @classmethod |
| + def ShouldTearDownStateAfterEachStoryRun(cls): |
| + return True |
| + |
| + |
| +class DesktopNewsBenchmark(_NewsBenchmark): |
| + page_set = page_sets.DesktopNewsStorySet |
| + |
| + @classmethod |
| + def ShouldDisable(cls, possible_browser): |
| + return possible_browser.platform.GetDeviceTypeName() != 'Desktop' |
| + |
| + |
| +class MobileNewsBenchmark(_NewsBenchmark): |
| + page_set = page_sets.MobileNewsStorySet |
| + |
| + @classmethod |
| + def ShouldDisable(cls, possible_browser): |
| + return possible_browser.platform.GetDeviceTypeName() == 'Desktop' |