From 99677208ff3b216fdfec551fbe548da5520cd6fb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 29 Oct 2020 10:46:47 +0100 Subject: BASELINE: Update Chromium to 86.0.4240.124 Change-Id: Ide0ff151e94cd665ae6521a446995d34a9d1d644 Reviewed-by: Allan Sandfeld Jensen --- chromium/third_party/catapult/BUILD.gn | 1 + .../catapult_build/run_dev_server_tests.py | 1 + .../catapult/common/py_utils/py_utils/discover.py | 6 +- .../py_utils/py_utils/webpagereplay_go_server.py | 48 ++- chromium/third_party/catapult/tracing/PRESUBMIT.py | 10 +- .../third_party/catapult/tracing/trace_viewer.gni | 2 + .../importer/linux_perf/ftrace_importer.html | 1 + .../extras/importer/linux_perf/thermal_parser.html | 80 +++++ .../importer/linux_perf/thermal_parser_test.html | 64 ++++ .../extras/importer/trace_event_importer.html | 1 + .../tracing/tracing/metrics/all_metrics.html | 1 + .../tracing/tracing/metrics/blink/gc_metric.html | 347 +++++++++++---------- .../tracing/metrics/blink/gc_metric_test.html | 186 ++++++++--- .../tracing/metrics/console_error_metric.html | 30 +- .../tracing/metrics/rendering/cpu_utilization.html | 85 ++--- .../metrics/rendering/cpu_utilization_test.html | 8 +- .../tracing/metrics/rendering/frame_time.html | 6 +- .../catapult/tracing/tracing/metrics/v8/utils.html | 25 ++ .../tracing/tracing/metrics/v8/wasm_metric.html | 104 ++++++ .../tracing/metrics/v8/wasm_metric_test.html | 169 ++++++++++ .../model/helpers/chrome_renderer_helper.html | 7 + .../tracing/tracing/ui/base/dom_helpers.html | 6 +- .../ui/extras/about_tracing/profiling_view.html | 44 ++- .../tracing/value/diagnostics/reserved_infos.py | 1 + .../tracing/value/diagnostics/reserved_names.html | 1 + 25 files changed, 905 insertions(+), 329 deletions(-) create mode 100644 chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser.html create mode 100644 chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser_test.html create mode 100644 chromium/third_party/catapult/tracing/tracing/metrics/v8/wasm_metric.html create mode 100644 chromium/third_party/catapult/tracing/tracing/metrics/v8/wasm_metric_test.html (limited to 'chromium/third_party/catapult') diff --git a/chromium/third_party/catapult/BUILD.gn b/chromium/third_party/catapult/BUILD.gn index 059400fb60f..aa6e5d059a4 100644 --- a/chromium/third_party/catapult/BUILD.gn +++ b/chromium/third_party/catapult/BUILD.gn @@ -62,6 +62,7 @@ group("telemetry_chrome_test_support") { "third_party/cloudstorage/", "third_party/coverage/", "third_party/d3/", + "third_party/depot_tools/", "third_party/flot/", "third_party/gae_ts_mon/", "third_party/google-auth/", diff --git a/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py b/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py index 10bce608cd6..59509398017 100644 --- a/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py +++ b/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py @@ -206,6 +206,7 @@ def RunTests(args, chrome_path): '--enable-features=ForceWebRequestProxyForTest', '--enable-blink-features=CustomElementsV0,' 'HTMLImports,ShadowDOMV0', + '--force-device-scale-factor=1', ('http://localhost:%s/%s/tests.html?' % (port, args.tests)) + 'headless=true&testTypeToRun=all', ] diff --git a/chromium/third_party/catapult/common/py_utils/py_utils/discover.py b/chromium/third_party/catapult/common/py_utils/py_utils/discover.py index ae8ba87d9fc..a9333e2d7dd 100644 --- a/chromium/third_party/catapult/common/py_utils/py_utils/discover.py +++ b/chromium/third_party/catapult/common/py_utils/py_utils/discover.py @@ -101,20 +101,18 @@ def DiscoverClasses(start_dir, for module in modules: new_classes = DiscoverClassesInModule( module, base_class, index_by_class_name, directly_constructable) - # TODO(nednguyen): we should remove index_by_class_name once + # TODO(crbug.com/548652): we should remove index_by_class_name once # benchmark_smoke_unittest in chromium/src/tools/perf no longer relied # naming collisions to reduce the number of smoked benchmark tests. - # crbug.com/548652 if index_by_class_name: AssertNoKeyConflicts(classes, new_classes) classes = dict(list(classes.items()) + list(new_classes.items())) return classes -# TODO(nednguyen): we should remove index_by_class_name once +# TODO(crbug.com/548652): we should remove index_by_class_name once # benchmark_smoke_unittest in chromium/src/tools/perf no longer relied # naming collisions to reduce the number of smoked benchmark tests. -# crbug.com/548652 def DiscoverClassesInModule(module, base_class, index_by_class_name=False, diff --git a/chromium/third_party/catapult/common/py_utils/py_utils/webpagereplay_go_server.py b/chromium/third_party/catapult/common/py_utils/py_utils/webpagereplay_go_server.py index 950e8adcb79..26b462dc4e3 100644 --- a/chromium/third_party/catapult/common/py_utils/py_utils/webpagereplay_go_server.py +++ b/chromium/third_party/catapult/common/py_utils/py_utils/webpagereplay_go_server.py @@ -102,16 +102,9 @@ class ReplayServer(object): # subprocess. self._temp_log_file_path = None - # Assign the downloader func and binary_manager - downloader = None - if binary_downloader: - downloader = binary_downloader - else: - configs = [CHROME_BINARY_CONFIG, TELEMETRY_PROJECT_CONFIG] - downloader = binary_manager.BinaryManager(configs).FetchPath - + self._downloader = binary_downloader self._cmd_line = self._GetCommandLine( - self._GetGoBinaryPath(downloader=downloader), http_port, https_port, + self._GetGoBinaryPath(), http_port, https_port, replay_options, archive_path) if RECORD in replay_options or 'record' in replay_options: @@ -122,19 +115,44 @@ class ReplayServer(object): self.replay_process = None - @classmethod - def _GetGoBinaryPath(cls, downloader): - if not cls._go_binary_path: - cls._go_binary_path = downloader( + def _GetDownloader(self): + """Gets the downloader used to download wpr_go binary from GCS.""" + if ReplayServer._go_binary_path: + # If the _go_binary_path was already set, then no need to use downloader + # to download via binary_manager. + self._downloader = None + elif not self._downloader: + configs = [CHROME_BINARY_CONFIG, TELEMETRY_PROJECT_CONFIG] + self._downloader = binary_manager.BinaryManager(configs).FetchPath + return self._downloader + + def _GetGoBinaryPath(self): + """Gets the _go_binary_path if it already set, or downloads it.""" + if not ReplayServer._go_binary_path: + downloader = self._GetDownloader() + if not downloader: + raise RuntimeError('downloader should not be None ' + 'while _go_binary_path is None') + ReplayServer._go_binary_path = downloader( 'wpr_go', py_utils.GetHostOsName(), py_utils.GetHostArchName()) - return cls._go_binary_path + return ReplayServer._go_binary_path @classmethod def SetGoBinaryPath(cls, go_binary_path): """Overrides the _go_binary_path. This allows the server to use WPRGO files retrieved from somewhere - other than GCS, such as CIPD.""" + other than GCS via binary_manager, such as test isolation. + + For chromium project to use WPR, it is encourage to use test isolation, + and therefore should call SetGoBinaryPath to set _go_binary_path. + + For Catapult/Telemetry project, the tradition is to download wpr_go + binary via binary_manager. So do not call SetGoBinaryPath. + """ + if not os.path.exists(go_binary_path): + raise ValueError('SetGoBinaryPath could not set {} as it does not exist' + .format(go_binary_path)) cls._go_binary_path = go_binary_path @property diff --git a/chromium/third_party/catapult/tracing/PRESUBMIT.py b/chromium/third_party/catapult/tracing/PRESUBMIT.py index b087f658fb4..90442392078 100644 --- a/chromium/third_party/catapult/tracing/PRESUBMIT.py +++ b/chromium/third_party/catapult/tracing/PRESUBMIT.py @@ -41,7 +41,7 @@ def _CheckRegisteredDiagnostics(input_api, output_api): def _WarnOnReservedInfosChanges(input_api, output_api): source_file_filter = lambda x: input_api.FilterSourceFile( - x, white_list=[r'.*reserved_infos\.(py|cc)$']) + x, files_to_check=[r'.*reserved_infos\.(py|cc)$']) count = len(input_api.AffectedSourceFiles(source_file_filter)) results = [] @@ -55,7 +55,7 @@ def _WarnOnReservedInfosChanges(input_api, output_api): def _CheckHistogramProtoIsGated(input_api, output_api): source_file_filter = lambda x: input_api.FilterSourceFile( - x, white_list=[r'.*\.py$'], black_list=['.*PRESUBMIT.py$']) + x, files_to_check=[r'.*\.py$'], block_list=['.*PRESUBMIT.py$']) files = [] for f in input_api.AffectedSourceFiles(source_file_filter): @@ -76,7 +76,7 @@ def _CheckHistogramProtoIsGated(input_api, output_api): def _CheckProtoNamespace(input_api, output_api): source_file_filter = lambda x: input_api.FilterSourceFile( - x, white_list=[r'.*\.(cc|h)$']) + x, files_to_check=[r'.*\.(cc|h)$']) files = [] for f in input_api.AffectedSourceFiles(source_file_filter): @@ -117,10 +117,10 @@ def _CheckChange(input_api, output_api): sys.path = original_sys_path - black_list = input_api.DEFAULT_BLACK_LIST + (".*_pb2.py$",) + files_to_skip = input_api.DEFAULT_FILES_TO_SKIP + (".*_pb2.py$",) results += input_api.RunTests(input_api.canned_checks.GetPylint( input_api, output_api, extra_paths_list=_GetPathsToPrepend(input_api), - pylintrc='../pylintrc', black_list=black_list)) + pylintrc='../pylintrc', files_to_skip=files_to_skip)) results += _CheckRegisteredMetrics(input_api, output_api) results += _CheckRegisteredDiagnostics(input_api, output_api) diff --git a/chromium/third_party/catapult/tracing/trace_viewer.gni b/chromium/third_party/catapult/tracing/trace_viewer.gni index f82c66eb418..18d64554a28 100644 --- a/chromium/third_party/catapult/tracing/trace_viewer.gni +++ b/chromium/third_party/catapult/tracing/trace_viewer.gni @@ -140,6 +140,7 @@ tracing_js_html_files = [ "tracing/extras/importer/linux_perf/rss_parser.html", "tracing/extras/importer/linux_perf/sched_parser.html", "tracing/extras/importer/linux_perf/sync_parser.html", + "tracing/extras/importer/linux_perf/thermal_parser.html", "tracing/extras/importer/linux_perf/workqueue_parser.html", "tracing/extras/importer/oboe.html", "tracing/extras/importer/pako.html", @@ -239,6 +240,7 @@ tracing_js_html_files = [ "tracing/metrics/v8/runtime_stats_metric.html", "tracing/metrics/v8/utils.html", "tracing/metrics/v8/v8_metrics.html", + "tracing/metrics/v8/wasm_metric.html", "tracing/metrics/vr/frame_cycle_duration_metric.html", "tracing/metrics/vr/webvr_metric.html", "tracing/metrics/vr/webxr_metric.html", diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html index 664b0a6bfa1..048869e22d0 100644 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html +++ b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html @@ -30,6 +30,7 @@ found in the LICENSE file. + diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser.html new file mode 100644 index 00000000000..93818c74b82 --- /dev/null +++ b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser.html @@ -0,0 +1,80 @@ + + + + + + + diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser_test.html new file mode 100644 index 00000000000..f0f37ad042c --- /dev/null +++ b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/thermal_parser_test.html @@ -0,0 +1,64 @@ + + + + + + + diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html index 00918705bf7..54f4dcbaa15 100644 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html +++ b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html @@ -127,6 +127,7 @@ tr.exportTo('tr.e.importer', function() { 'powerTraceAsString', 'systemTraceEvents', 'androidProcessDump', + 'cgroupDump', ]); // The complete list of fields on the trace that should not be treated as diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html index 80696a7a243..694f443fab7 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html @@ -40,6 +40,7 @@ found in the LICENSE file. + diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric.html index a9fbe9cd589..aaa772d8a62 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric.html @@ -31,6 +31,32 @@ tr.exportTo('tr.metrics.blink', function() { 'blink-gc-atomic-pause-sweep-and-compact' }; + // Maps non-aggregated Blink GC events in timeline to telemetry friendly + // names using the new naming scheme. This map contains events that occur + // only on the main thread. + const BLINK_NON_AGGREGATED_GC_EVENTS_NEW_NAMES_MAP = { + 'BlinkGC.AtomicPauseMarkEpilogue': + 'blink:gc:main_thread:cycle:full:atomic:mark:epilogue', + 'BlinkGC.AtomicPauseMarkPrologue': + 'blink:gc:main_thread:cycle:full:atomic:mark:prologue', + 'BlinkGC.AtomicPauseMarkRoots': + 'blink:gc:main_thread:cycle:full:atomic:mark:roots', + 'BlinkGC.IncrementalMarkingStartMarking': + 'blink:gc:main_thread:cycle:full:incremental:mark:start', + 'BlinkGC.IncrementalMarkingStep': + 'blink:gc:main_thread:cycle:full:incremental:mark:step', + 'BlinkGC.UnifiedMarkingStep': + 'unified:gc:main_thread:cycle:full:mark:step', + 'BlinkGC.CompleteSweep': + 'blink:gc:main_thread:cycle:full:sweep:complete', + 'BlinkGC.LazySweepInIdle': + 'blink:gc:main_thread:cycle:full:sweep:idle', + 'BlinkGC.LazySweepOnAllocation': + 'blink:gc:main_thread:cycle:full:sweep:on_allocation', + 'BlinkGC.AtomicPauseSweepAndCompact': + 'blink:gc:main_thread:cycle:full:atomic:sweep:compact' + }; + // All events that should be summed up to 'blink-gc-mark-roots'. const BLINK_TOP_GC_ROOTS_MARKING_EVENTS = [ 'BlinkGC.VisitRoots' @@ -57,6 +83,17 @@ tr.exportTo('tr.metrics.blink', function() { 'BlinkGC.IncrementalMarkingStartMarking', ].concat(BLINK_GC_FOREGROUND_MARKING_TRANSITIVE_CLOSURE_EVENTS); + // Names of Blink GC foreground marking events in timeline. + const BLINK_GC_FORCED_FOREGROUND_MARKING_EVENTS = [ + 'BlinkGC.AtomicPauseMarkEpilogue', + 'BlinkGC.AtomicPauseMarkPrologue', + 'BlinkGC.AtomicPauseMarkRoots', + 'BlinkGC.IncrementalMarkingStartMarking', + 'BlinkGC.MarkBailOutObjects', + 'BlinkGC.MarkFlushV8References', + 'BlinkGC.MarkFlushEphemeronPairs', + ]; + // Names of Blink GC background marking events in timeline. const BLINK_TOP_GC_BACKGROUND_MARKING_EVENTS = [ 'BlinkGC.ConcurrentMarkingStep' @@ -97,6 +134,14 @@ tr.exportTo('tr.metrics.blink', function() { return Object.values(BLINK_NON_AGGREGATED_GC_EVENTS_NAMES_MAP); } + function blinkGarbageCollectionEventNewName(event) { + return BLINK_NON_AGGREGATED_GC_EVENTS_NEW_NAMES_MAP[event.title]; + } + + function blinkGarbageCollectionEventNewNames() { + return Object.values(BLINK_NON_AGGREGATED_GC_EVENTS_NEW_NAMES_MAP); + } + function isNonForcedEvent(event) { return (!event.args || !event.args.forced) && !tr.metrics.v8.utils.isForcedGarbageCollectionEvent(event); @@ -123,8 +168,7 @@ tr.exportTo('tr.metrics.blink', function() { function isNonForcedBlinkGarbageCollectionMarkingTransitiveColsureEvent(event) { return BLINK_GC_FOREGROUND_MARKING_TRANSITIVE_CLOSURE_EVENTS.includes( - event.title) && - isNonForcedEvent(event); + event.title) && isNonForcedEvent(event); } function @@ -138,6 +182,12 @@ tr.exportTo('tr.metrics.blink', function() { isNonForcedEvent(event); } + function isNonForcedBlinkGarbageCollectionForcedForegroundMarkEvent(event) { + return BLINK_GC_FORCED_FOREGROUND_MARKING_EVENTS.includes( + event.title) && + isNonForcedEvent(event); + } + function isNonForcedBlinkGarbageCollectionBackgroundMarkingEvent(event) { return BLINK_TOP_GC_BACKGROUND_MARKING_EVENTS.includes(event.title) && isNonForcedEvent(event); @@ -168,98 +218,115 @@ tr.exportTo('tr.metrics.blink', function() { addTotalDurationOfRootsMarking(histograms, model); addTotalDurationOfMarkingTransitiveClosure(histograms, model); addTotalDurationOfForegroundMarking(histograms, model); + addTotalDurationOfForcedForegroundMarking(histograms, model); addTotalDurationOfBackgroundMarking(histograms, model); addTotalDurationOfForegroundSweeping(histograms, model); addTotalDurationOfBackgroundSweeping(histograms, model); } - tr.metrics.MetricRegistry.register(blinkGcMetric); + function getEventEpochUniqueId(event) { + // event.parentContainer.parent.stableId return the event's process id. + return event.parentContainer.parent.stableId + ':' + event.args.epoch; + } - const timeDurationInMs_smallerIsBetter = - tr.b.Unit.byName.timeDurationInMs_smallerIsBetter; + tr.metrics.MetricRegistry.register(blinkGcMetric); // 0.1 steps from 0 to 20 since it is the most common range. // Exponentially increasing steps from 20 to 200. const CUSTOM_BOUNDARIES = tr.v.HistogramBinBoundaries.createLinear(0, 20, 200) .addExponentialBins(200, 100); - function createNumericForTopEventTime(name) { + function createNumericForEventTime(name) { const n = new tr.v.Histogram(name, - timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES); + tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES); n.customizeSummaryOptions({ avg: true, count: true, max: true, - min: false, + min: true, std: true, sum: true, percentile: [0.90]}); return n; } - function createNumericForTotalEventTime(name) { - const n = new tr.v.Histogram(name, - timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES); - n.customizeSummaryOptions({ - avg: false, - count: true, - max: false, - min: false, - std: false, - sum: true, - percentile: [0.90]}); - return n; - } - - function createNumericForUnifiedEventTime(name) { - const n = new tr.v.Histogram(name, - timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES); - n.customizeSummaryOptions({ - avg: false, - count: true, - max: true, - min: false, - std: false, - sum: true, - percentile: [0.90]}); - return n; - } - /** * Example output: * - blink-gc-incremental-start */ function addDurationOfTopEvents(histograms, model) { + const nameToNumeric = {}; + const nameToEpochNumeric = {}; + for (const name of blinkGarbageCollectionEventNames()) { + nameToNumeric[name] = createNumericForEventTime(name); + } + for (const name of blinkGarbageCollectionEventNewNames()) { + nameToEpochNumeric[name] = createNumericForEventTime(name); + } tr.metrics.v8.utils.groupAndProcessEvents(model, isNonForcedNonAggregatedBlinkGarbageCollectionEvent, - blinkGarbageCollectionEventName, - function(name, events) { - const cpuDuration = createNumericForTopEventTime(name); + getEventEpochUniqueId, + function(epoch, events) { + const namesToPerEpochDurations = {}; + for (const event of events) { + nameToNumeric[blinkGarbageCollectionEventName(event)] + .addSample(event.cpuDuration); + const name = blinkGarbageCollectionEventNewName(event); + namesToPerEpochDurations[name] = + (namesToPerEpochDurations[name] || 0) + event.cpuDuration; + } + for (const name in namesToPerEpochDurations) { + nameToEpochNumeric[name].addSample(namesToPerEpochDurations[name]); + } + } + ); + for (const name of blinkGarbageCollectionEventNames()) { + histograms.addHistogram(nameToNumeric[name]); + } + for (const name of blinkGarbageCollectionEventNewNames()) { + histograms.addHistogram(nameToEpochNumeric[name]); + } + } + + function addIndividualDurationsOfEvents(histograms, model, name, filter) { + const cpuDuration = createNumericForEventTime(name); + tr.metrics.v8.utils.groupAndProcessEvents(model, + filter, + event => name, + function(group, events) { for (const event of events) { cpuDuration.addSample(event.cpuDuration); } - histograms.addHistogram(cpuDuration); }, - blinkGarbageCollectionEventNames() + [name] ); + histograms.addHistogram(cpuDuration); } - /** - * Example output: - * - blink-gc-atomic-pause - */ - function addDurationOfAtomicPause(histograms, model) { + function addPerEpochDurationsOfEvents(histograms, model, name, filter) { + const cpuDuration = createNumericForEventTime(name); tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionAtomicPauseEvent, - event => event.args.epoch, - function(group, events) { - const cpuDuration = createNumericForTopEventTime( - 'blink-gc-atomic-pause'); + filter, + getEventEpochUniqueId, + function(epoch, events) { cpuDuration.addSample( events.reduce((acc, current) => acc + current.cpuDuration, 0)); - histograms.addHistogram(cpuDuration); } ); + histograms.addHistogram(cpuDuration); + } + + /** + * Example output: + * - blink-gc-atomic-pause + */ + function addDurationOfAtomicPause(histograms, model) { + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-atomic-pause', + isNonForcedBlinkGarbageCollectionAtomicPauseEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:atomic', + isNonForcedBlinkGarbageCollectionAtomicPauseEvent); } /** @@ -267,17 +334,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-atomic-pause-mark-transitive-closure */ function addDurationOfAtomicPauseTransitiveClosure(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionAtomicPauseTransitiveColsureEvent, - event => event.args.epoch, - function(group, events) { - const cpuDuration = createNumericForTopEventTime( - 'blink-gc-atomic-pause-mark-transitive-closure'); - cpuDuration.addSample( - events.reduce((acc, current) => acc + current.cpuDuration, 0)); - histograms.addHistogram(cpuDuration); - } - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-atomic-pause-mark-transitive-closure', + isNonForcedBlinkGarbageCollectionAtomicPauseTransitiveColsureEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:atomic:mark:transitive_closure', + isNonForcedBlinkGarbageCollectionAtomicPauseTransitiveColsureEvent); } /** @@ -285,18 +347,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-total */ function addTotalDurationOfTopEvents(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionEvent, - event => 'blink-gc-total', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-total'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-total', + isNonForcedBlinkGarbageCollectionEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full', + isNonForcedBlinkGarbageCollectionEvent); } /** @@ -304,18 +360,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-mark-roots */ function addTotalDurationOfRootsMarking(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionRootsMarkingEvent, - event => 'blink-gc-mark-roots', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-mark-roots'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-mark-roots', + isNonForcedBlinkGarbageCollectionRootsMarkingEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:mark:roots', + isNonForcedBlinkGarbageCollectionRootsMarkingEvent); } /** @@ -323,18 +373,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-mark-transitive-closure */ function addTotalDurationOfMarkingTransitiveClosure(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionMarkingTransitiveColsureEvent, - event => 'blink-gc-mark-transitive-closure', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-mark-transitive-closure'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-mark-transitive-closure', + isNonForcedBlinkGarbageCollectionMarkingTransitiveColsureEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:mark:transitive_closure', + isNonForcedBlinkGarbageCollectionMarkingTransitiveColsureEvent); } /** @@ -342,18 +386,25 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-mark-foreground */ function addTotalDurationOfForegroundMarking(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionForegroundMarkingEvent, - event => 'blink-gc-mark-foreground', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-mark-foreground'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-mark-foreground', + isNonForcedBlinkGarbageCollectionForegroundMarkingEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:mark', + isNonForcedBlinkGarbageCollectionForegroundMarkingEvent); + } + + /** + * Example output: + * - blink-gc-mark-foreground-forced + */ + function addTotalDurationOfForcedForegroundMarking(histograms, model) { + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-mark-foreground-forced', + isNonForcedBlinkGarbageCollectionForcedForegroundMarkEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:mark:forced', + isNonForcedBlinkGarbageCollectionForcedForegroundMarkEvent); } /** @@ -361,18 +412,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-mark-background */ function addTotalDurationOfBackgroundMarking(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionBackgroundMarkingEvent, - event => 'blink-gc-mark-background', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-mark-background'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-mark-background', + isNonForcedBlinkGarbageCollectionBackgroundMarkingEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:concurrent_thread:cycle:full:mark', + isNonForcedBlinkGarbageCollectionBackgroundMarkingEvent); } /** @@ -380,18 +425,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-sweep-foreground */ function addTotalDurationOfForegroundSweeping(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionForegroundSweepingEvent, - event => 'blink-gc-sweep-foreground', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-sweep-foreground'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-sweep-foreground', + isNonForcedBlinkGarbageCollectionForegroundSweepingEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:main_thread:cycle:full:sweep', + isNonForcedBlinkGarbageCollectionForegroundSweepingEvent); } /** @@ -399,18 +438,12 @@ tr.exportTo('tr.metrics.blink', function() { * - blink-gc-sweep-background */ function addTotalDurationOfBackgroundSweeping(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isNonForcedBlinkGarbageCollectionBackgroundSweepingEvent, - event => 'blink-gc-sweep-background', - function(name, events) { - const cpuDuration = createNumericForTotalEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['blink-gc-sweep-background'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'blink-gc-sweep-background', + isNonForcedBlinkGarbageCollectionBackgroundSweepingEvent); + addPerEpochDurationsOfEvents(histograms, model, + 'blink:gc:concurrent_thread:cycle:full:sweep', + isNonForcedBlinkGarbageCollectionBackgroundSweepingEvent); } function isV8OrBlinkTopLevelGarbageCollectionEvent(event) { @@ -420,23 +453,13 @@ tr.exportTo('tr.metrics.blink', function() { /** * Example output: - * - unified-gc-total_sum - * - unified-gc-total_max - * - unified-gc-total_count + * - unified-gc-total */ function addTotalDurationOfBlinkAndV8TopEvents(histograms, model) { - tr.metrics.v8.utils.groupAndProcessEvents(model, - isV8OrBlinkTopLevelGarbageCollectionEvent, - event => 'unified-gc-total', - function(name, events) { - const cpuDuration = createNumericForUnifiedEventTime(name); - for (const event of events) { - cpuDuration.addSample(event.cpuDuration); - } - histograms.addHistogram(cpuDuration); - }, - ['unified-gc-total'] - ); + addIndividualDurationsOfEvents(histograms, model, + 'unified-gc-total', + isV8OrBlinkTopLevelGarbageCollectionEvent); + // No epoch durations because v8 events don't provide an epoch id. } return { diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric_test.html index 4e0b9da923f..0c20030edc1 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric_test.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/blink/gc_metric_test.html @@ -78,59 +78,112 @@ tr.b.unittest.testSuite(function() { } }); + test('topEventsPerEpoch', function() { + const events = { + 'BlinkGC.AtomicPauseMarkEpilogue': + 'blink:gc:main_thread:cycle:full:atomic:mark:epilogue', + 'BlinkGC.AtomicPauseMarkPrologue': + 'blink:gc:main_thread:cycle:full:atomic:mark:prologue', + 'BlinkGC.AtomicPauseMarkRoots': + 'blink:gc:main_thread:cycle:full:atomic:mark:roots', + 'BlinkGC.IncrementalMarkingStartMarking': + 'blink:gc:main_thread:cycle:full:incremental:mark:start', + 'BlinkGC.IncrementalMarkingStep': + 'blink:gc:main_thread:cycle:full:incremental:mark:step', + 'BlinkGC.UnifiedMarkingStep': + 'unified:gc:main_thread:cycle:full:mark:step', + 'BlinkGC.CompleteSweep': + 'blink:gc:main_thread:cycle:full:sweep:complete', + 'BlinkGC.LazySweepInIdle': + 'blink:gc:main_thread:cycle:full:sweep:idle', + 'BlinkGC.LazySweepOnAllocation': + 'blink:gc:main_thread:cycle:full:sweep:on_allocation', + 'BlinkGC.AtomicPauseSweepAndCompact': + 'blink:gc:main_thread:cycle:full:atomic:sweep:compact', + 'BlinkGC.AtomicPauseMarkTransitiveClosure': + 'blink:gc:main_thread:cycle:full:atomic:mark:transitive_closure', + 'BlinkGC.VisitRoots': + 'blink:gc:main_thread:cycle:full:mark:roots' + }; + for (const [timelineName, telemetryName] of Object.entries(events)) { + const slices = [ + { + title: timelineName, args: {'epoch': 0}, start: 100, end: 150, + cpuStart: 100, cpuEnd: 150 + }, + { + title: timelineName, args: {'epoch': 0}, start: 150, end: 200, + cpuStart: 150, cpuEnd: 200 + }, + { + title: timelineName, args: {'epoch': 1}, start: 200, end: 300, + cpuStart: 200, cpuEnd: 300 + } + ]; + const actual = run(slices); + + const value = actual.getHistogramNamed(telemetryName); + assert.strictEqual(value.running.sum, 200); + assert.strictEqual(value.numValues, 2); + assert.strictEqual(value.average, 100); + assert.strictEqual(value.running.max, 100); + assert.closeTo(value.getApproximatePercentile(0.90), 100, 1); + } + }); + test('totalTimeForBlinkGC', function() { const histograms = new tr.v.HistogramSet(); const slices = [ { - title: 'BlinkGC.AtomicPauseMarkPrologue', args: {}, + title: 'BlinkGC.AtomicPauseMarkPrologue', args: {'epoch': 0}, start: 100, end: 110, cpuStart: 100, cpuEnd: 110 }, { - title: 'BlinkGC.AtomicPauseMarkRoots', args: {}, + title: 'BlinkGC.AtomicPauseMarkRoots', args: {'epoch': 0}, start: 110, end: 120, cpuStart: 110, cpuEnd: 120 }, { - title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {}, + title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {'epoch': 0}, start: 120, end: 130, cpuStart: 120, cpuEnd: 130 }, { - title: 'BlinkGC.AtomicPauseMarkEpilogue', args: {}, + title: 'BlinkGC.AtomicPauseMarkEpilogue', args: {'epoch': 0}, start: 130, end: 140, cpuStart: 130, cpuEnd: 140 }, { - title: 'BlinkGC.AtomicPauseSweepAndCompact', args: {}, + title: 'BlinkGC.AtomicPauseSweepAndCompact', args: {'epoch': 0}, start: 140, end: 200, cpuStart: 140, cpuEnd: 200 }, { - title: 'BlinkGC.LazySweepInIdle', args: {}, start: 210, + title: 'BlinkGC.LazySweepInIdle', args: {'epoch': 0}, start: 210, end: 290, cpuStart: 210, cpuEnd: 290 }, { - title: 'BlinkGC.IncrementalMarkingStartMarking', args: {}, start: 500, - end: 550, cpuStart: 500, cpuEnd: 550 + title: 'BlinkGC.IncrementalMarkingStartMarking', args: {'epoch': 1}, + start: 500, end: 550, cpuStart: 500, cpuEnd: 550 }, { - title: 'BlinkGC.IncrementalMarkingStep', args: {}, start: 550, + title: 'BlinkGC.IncrementalMarkingStep', args: {'epoch': 1}, start: 550, end: 600, cpuStart: 550, cpuEnd: 600 }, { - title: 'BlinkGC.UnifiedMarkingStep', args: {}, start: 600, + title: 'BlinkGC.UnifiedMarkingStep', args: {'epoch': 1}, start: 600, end: 650, cpuStart: 600, cpuEnd: 650 }, // Background events shouldn't contribute to total time. { - title: 'BlinkGC.ConcurrentSweepingStep', args: {}, start: 300, + title: 'BlinkGC.ConcurrentSweepingStep', args: {'epoch': 1}, start: 300, end: 390, cpuStart: 300, cpuEnd: 390 }, { - title: 'BlinkGC.ConcurrentMarkingStep', args: {}, start: 400, + title: 'BlinkGC.ConcurrentMarkingStep', args: {'epoch': 1}, start: 400, end: 450, cpuStart: 400, cpuEnd: 450 }, // Explicit roots marking should also not contribute to total time // (this is already encompassed by BlinkGC.AtomicPauseMarkRoots and // BlinkGC.IncrementalMarkingStartMarking). { - title: 'BlinkGC.VisitRoots', args: {}, start: 450, + title: 'BlinkGC.VisitRoots', args: {'epoch': 1}, start: 450, end: 500, cpuStart: 450, cpuEnd: 500 } ]; @@ -140,41 +193,47 @@ tr.b.unittest.testSuite(function() { assert.strictEqual(value.running.sum, 330); assert.strictEqual(value.numValues, 9); assert.strictEqual(value.running.max, 80); + + const valuePerEpoch = actual.getHistogramNamed( + 'blink:gc:main_thread:cycle:full'); + assert.strictEqual(valuePerEpoch.running.sum, 330); + assert.strictEqual(valuePerEpoch.numValues, 2); + assert.strictEqual(valuePerEpoch.running.max, 180); }); test('totalForegroundSweepingTimeForBlinkGC', function() { const histograms = new tr.v.HistogramSet(); const slices = [ { - title: 'BlinkGC.AtomicPauseMarkPrologue', args: {}, + title: 'BlinkGC.AtomicPauseMarkPrologue', args: {'epoch': 0}, start: 100, end: 110, cpuStart: 100, cpuEnd: 110 }, { - title: 'BlinkGC.AtomicPauseMarkRoots', args: {}, + title: 'BlinkGC.AtomicPauseMarkRoots', args: {'epoch': 0}, start: 110, end: 120, cpuStart: 110, cpuEnd: 120 }, { - title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {}, + title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {'epoch': 0}, start: 120, end: 130, cpuStart: 120, cpuEnd: 130 }, { - title: 'BlinkGC.AtomicPauseMarkEpilogue', args: {}, + title: 'BlinkGC.AtomicPauseMarkEpilogue', args: {'epoch': 0}, start: 130, end: 140, cpuStart: 130, cpuEnd: 140 }, { - title: 'BlinkGC.AtomicPauseSweepAndCompact', args: {}, + title: 'BlinkGC.AtomicPauseSweepAndCompact', args: {'epoch': 0}, start: 140, end: 200, cpuStart: 140, cpuEnd: 200 }, { - title: 'BlinkGC.LazySweepInIdle', args: {}, + title: 'BlinkGC.LazySweepInIdle', args: {'epoch': 0}, start: 210, end: 300, cpuStart: 210, cpuEnd: 300 }, { - title: 'BlinkGC.LazySweepOnAllocation', args: {}, + title: 'BlinkGC.LazySweepOnAllocation', args: {'epoch': 0}, start: 310, end: 400, cpuStart: 310, cpuEnd: 400 }, { - title: 'BlinkGC.CompleteSweep', args: {}, + title: 'BlinkGC.CompleteSweep', args: {'epoch': 1}, start: 410, end: 500, cpuStart: 410, cpuEnd: 500 } ]; @@ -185,25 +244,32 @@ tr.b.unittest.testSuite(function() { assert.strictEqual(value.numValues, 3); assert.strictEqual(value.average, 90); assert.strictEqual(value.running.max, 90); + + const valuePerEpoch = actual.getHistogramNamed( + 'blink:gc:main_thread:cycle:full:sweep'); + assert.strictEqual(valuePerEpoch.running.sum, 270); + assert.strictEqual(valuePerEpoch.numValues, 2); + assert.strictEqual(valuePerEpoch.average, 135); + assert.strictEqual(valuePerEpoch.running.max, 180); }); test('totalBackgroundSweepingTimeForBlinkGC', function() { const histograms = new tr.v.HistogramSet(); const slices = [ { - title: 'BlinkGC.ConcurrentSweepingStep', args: {}, + title: 'BlinkGC.ConcurrentSweepingStep', args: {'epoch': 0}, start: 100, end: 200, cpuStart: 100, cpuEnd: 200 }, { - title: 'BlinkGC.LazySweepInIdle', args: {}, + title: 'BlinkGC.LazySweepInIdle', args: {'epoch': 0}, start: 210, end: 300, cpuStart: 210, cpuEnd: 300 }, { - title: 'BlinkGC.ConcurrentSweepingStep', args: {}, + title: 'BlinkGC.ConcurrentSweepingStep', args: {'epoch': 1}, start: 250, end: 300, cpuStart: 250, cpuEnd: 300 }, { - title: 'BlinkGC.CompleteSweep', args: {}, + title: 'BlinkGC.CompleteSweep', args: {'epoch': 1}, start: 300, end: 400, cpuStart: 310, cpuEnd: 400 } ]; @@ -214,49 +280,56 @@ tr.b.unittest.testSuite(function() { assert.strictEqual(value.numValues, 2); assert.strictEqual(value.average, 75); assert.strictEqual(value.running.max, 100); + + const valuePerEpoch = actual.getHistogramNamed( + 'blink:gc:concurrent_thread:cycle:full:sweep'); + assert.strictEqual(valuePerEpoch.running.sum, 150); + assert.strictEqual(valuePerEpoch.numValues, 2); + assert.strictEqual(valuePerEpoch.average, 75); + assert.strictEqual(valuePerEpoch.running.max, 100); }); test('totalMarkingTimeForBlinkGC', function() { const histograms = new tr.v.HistogramSet(); const slices = [ { - title: 'BlinkGC.IncrementalMarkingStartMarking', args: {}, start: 0, - end: 10, cpuStart: 0, cpuEnd: 10 + title: 'BlinkGC.IncrementalMarkingStartMarking', args: {'epoch': 0}, + start: 0, end: 10, cpuStart: 0, cpuEnd: 10 }, { - title: 'BlinkGC.VisitRoots', args: {}, start: 10, + title: 'BlinkGC.VisitRoots', args: {'epoch': 0}, start: 10, end: 20, cpuStart: 10, cpuEnd: 20 }, { - title: 'BlinkGC.ConcurrentMarkingStep', args: {}, + title: 'BlinkGC.ConcurrentMarkingStep', args: {'epoch': 0}, start: 20, end: 30, cpuStart: 20, cpuEnd: 30 }, { - title: 'BlinkGC.IncrementalMarkingStep', args: {}, + title: 'BlinkGC.IncrementalMarkingStep', args: {'epoch': 0}, start: 30, end: 40, cpuStart: 30, cpuEnd: 40 }, { - title: 'BlinkGC.ConcurrentMarkingStep', args: {}, + title: 'BlinkGC.ConcurrentMarkingStep', args: {'epoch': 1}, start: 40, end: 44, cpuStart: 40, cpuEnd: 44 }, { - title: 'BlinkGC.UnifiedMarkingStep', args: {}, + title: 'BlinkGC.UnifiedMarkingStep', args: {'epoch': 0}, start: 50, end: 60, cpuStart: 50, cpuEnd: 60 }, { - title: 'BlinkGC.AtomicPauseMarkPrologue', args: {}, + title: 'BlinkGC.AtomicPauseMarkPrologue', args: {'epoch': 1}, start: 60, end: 66, cpuStart: 60, cpuEnd: 66 }, { - title: 'BlinkGC.AtomicPauseMarkRoots', args: {}, + title: 'BlinkGC.AtomicPauseMarkRoots', args: {'epoch': 0}, start: 70, end: 80, cpuStart: 70, cpuEnd: 80 }, { - title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {}, + title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {'epoch': 1}, start: 80, end: 87, cpuStart: 80, cpuEnd: 87 }, { - title: 'BlinkGC.AtomicPauseMarkEpilogue', args: {}, + title: 'BlinkGC.AtomicPauseMarkEpilogue', args: {'epoch': 2}, start: 90, end: 100, cpuStart: 90, cpuEnd: 100 } ]; @@ -288,6 +361,34 @@ tr.b.unittest.testSuite(function() { assert.strictEqual(closueValue.numValues, 3); assert.closeTo(closueValue.average, 9, 1e-6); assert.strictEqual(closueValue.running.max, 10); + + const foregroundValuePerEpoch = actual.getHistogramNamed( + 'blink:gc:main_thread:cycle:full:mark'); + assert.strictEqual(foregroundValuePerEpoch.running.sum, 63); + assert.strictEqual(foregroundValuePerEpoch.numValues, 3); + assert.closeTo(foregroundValuePerEpoch.average, 21, 1e-6); + assert.strictEqual(foregroundValuePerEpoch.running.max, 40); + + const backgroundValuePerEpoch = actual.getHistogramNamed( + 'blink:gc:concurrent_thread:cycle:full:mark'); + assert.strictEqual(backgroundValuePerEpoch.running.sum, 14); + assert.strictEqual(backgroundValuePerEpoch.numValues, 2); + assert.closeTo(backgroundValuePerEpoch.average, 7, 1e-6); + assert.strictEqual(backgroundValuePerEpoch.running.max, 10); + + const rootsValuePerEpoch = actual.getHistogramNamed( + 'blink:gc:main_thread:cycle:full:mark:roots'); + assert.strictEqual(rootsValuePerEpoch.running.sum, 10); + assert.strictEqual(rootsValuePerEpoch.numValues, 1); + assert.closeTo(rootsValuePerEpoch.average, 10, 1e-6); + assert.strictEqual(rootsValuePerEpoch.running.max, 10); + + const closueValuePerEpoch = actual.getHistogramNamed( + 'blink:gc:main_thread:cycle:full:mark:transitive_closure'); + assert.strictEqual(closueValuePerEpoch.running.sum, 27); + assert.strictEqual(closueValuePerEpoch.numValues, 2); + assert.closeTo(closueValuePerEpoch.average, 13.5, 1e-6); + assert.strictEqual(closueValuePerEpoch.running.max, 20); }); test('totalTimeForUnifiedGC', function() { @@ -512,15 +613,15 @@ tr.b.unittest.testSuite(function() { const histograms = new tr.v.HistogramSet(); const slices = [ { - title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {}, + title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {'epoch': 0}, start: 10, end: 20, cpuStart: 10, cpuEnd: 20 }, { - title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {}, + title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {'epoch': 0}, start: 40, end: 60, cpuStart: 40, cpuEnd: 60 }, { - title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {}, + title: 'BlinkGC.AtomicPauseMarkTransitiveClosure', args: {'epoch': 1}, start: 70, end: 75, cpuStart: 70, cpuEnd: 75 }, ]; @@ -529,7 +630,12 @@ tr.b.unittest.testSuite(function() { const value = actual.getHistogramNamed( 'blink-gc-atomic-pause-mark-transitive-closure'); assert.strictEqual(value.running.sum, 35); - assert.strictEqual(value.numValues, 1); + assert.strictEqual(value.numValues, 3); + + const valuePerEpoch = actual.getHistogramNamed( + 'blink:gc:main_thread:cycle:full:atomic:mark:transitive_closure'); + assert.strictEqual(valuePerEpoch.running.sum, 35); + assert.strictEqual(valuePerEpoch.numValues, 2); }); }); diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/console_error_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/console_error_metric.html index 5ed27d0f6be..13e1fef405f 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/console_error_metric.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/console_error_metric.html @@ -7,6 +7,7 @@ found in the LICENSE file. + diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/wasm_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/wasm_metric_test.html new file mode 100644 index 00000000000..0681b6ddf3b --- /dev/null +++ b/chromium/third_party/catapult/tracing/tracing/metrics/v8/wasm_metric_test.html @@ -0,0 +1,169 @@ + + + + + + + + + diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html index e5eda52721f..bf3abe52814 100644 --- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html +++ b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html @@ -28,6 +28,9 @@ tr.exportTo('tr.model.helpers', function() { this.dedicatedWorkerThreads_ = process.findAllThreadsMatching(function(t) { return t.name && t.name.startsWith('DedicatedWorker'); }); + this.serviceWorkerThreads_ = process.findAllThreadsMatching(function(t) { + return t.name && t.name.startsWith('ServiceWorker'); + }); this.foregroundWorkerThreads_ = process.findAllThreadsMatching(function(t) { return t.name && t.name.startsWith('ThreadPoolForegroundWorker'); }); @@ -74,6 +77,10 @@ tr.exportTo('tr.model.helpers', function() { return this.dedicatedWorkerThreads_; }, + get serviceWorkerThreads() { + return this.serviceWorkerThreads_; + }, + get foregroundWorkerThreads() { return this.foregroundWorkerThreads_; }, diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html b/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html index c0324f96335..7e4b80cf950 100644 --- a/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html +++ b/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html @@ -61,7 +61,11 @@ tr.exportTo('tr.ui.b', function() { } const linkEl = ownerDocument.createElement('a'); if (opt_args) { - if (opt_args.href) linkEl.href = opt_args.href; + if (opt_args.href) { + linkEl.href = opt_args.href; + // Open link in a new tab so people don't lose their Trace Viewer state. + linkEl.target = '_blank'; + } if (opt_args.tooltip) linkEl.title = opt_args.tooltip; if (opt_args.color) linkEl.style.color = opt_args.color; if (opt_args.bold) linkEl.style.fontWeight = 'bold'; diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html index 3590c525407..26d01ad27cf 100644 --- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html +++ b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html @@ -295,27 +295,32 @@ tr.exportTo('tr.ui.e.about_tracing', function() { this.saveButton_.disabled = true; }, + detectFileExtension_(filename) { + let fileExtension = /[.]pftrace/.test(filename) ? '.pftrace' : '.json'; + if (/[.]gz$/.test(filename)) { + fileExtension += '.gz'; + } else if (/[.]zip$/.test(filename)) { + fileExtension += '.zip'; + } + return fileExtension; + }, + requestFilename_() { // unsafe filename patterns: const illegalRe = /[\/\?<>\\:\*\|":]/g; const controlRe = /[\x00-\x1f\x80-\x9f]/g; const reservedRe = /^\.+$/; - const defaultName = this.activeTrace_.filename; - let fileExtension = '.json'; - let fileRegex = /\.json$/; - if (/[.]pftrace/.test(defaultName)) { - fileExtension = '.pftrace'; - fileRegex = /\.pftrace$/; - } - if (/[.]gz$/.test(defaultName)) { - fileExtension += '.gz'; - fileRegex = new RegExp(fileExtension + '[.]gz$'); - } else if (/[.]zip$/.test(defaultName)) { - fileExtension = '.zip'; - fileRegex = /\.zip$/; - } + const fileExtension = this.detectFileExtension_(defaultName); + const escapedExtension = fileExtension.replace('.', '\\.'); + const extensionRegex = new RegExp(escapedExtension + '$'); + // |defaultName| is usually trace.json.gz, so |defaultNameWithoutExt| + // becomes 'trace'. + const defaultNameWithoutExt = defaultName.replace(extensionRegex, ''); + + // If |custom| is 'foo', the final name eventually becomes + // something like 'trace_foo.json.gz'. const custom = prompt('Filename? (' + fileExtension + ' appended) Or leave blank:'); if (custom === null) { @@ -324,15 +329,20 @@ tr.exportTo('tr.ui.e.about_tracing', function() { let name; if (custom) { - name = ' ' + custom; + // Strip the extension from |custom| if it matches up with default + // extension of the trace. If |custom| is 'foo.json.gz', we don't + // want filename to be 'foo.json.gz.json.gz'. + name = custom.replace(extensionRegex, ''); } else { const date = new Date(); - const dateText = ' ' + date.toDateString() + + const dateText = date.toDateString() + ' ' + date.toLocaleTimeString(); name = dateText; } - const filename = defaultName.replace(fileRegex, name) + fileExtension; + // filename will be something like 'trace foo.json.gz'. All spaces will be + // changed to '_' later. + const filename = defaultNameWithoutExt + ' ' + name + fileExtension; return filename .replace(illegalRe, '.') diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_infos.py b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_infos.py index 1a52a0f3053..e3087e5719f 100644 --- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_infos.py +++ b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_infos.py @@ -40,6 +40,7 @@ CHROMIUM_REVISIONS = _Info('chromiumRevisions', 'GenericSet', str) DESCRIPTION = _Info('description', 'GenericSet', str) DEVICE_IDS = _Info('deviceIds', 'GenericSet', str) DOCUMENTATION_URLS = _Info('documentationLinks', 'GenericSet', str) +INFO_BLURB = _Info('infoBlurb', 'GenericSet', str) FUCHSIA_GARNET_REVISIONS = _Info('fuchsiaGarnetRevisions', 'GenericSet', str) FUCHSIA_PERIDOT_REVISIONS = _Info('fuchsiaPeridotRevisions', 'GenericSet', str) FUCHSIA_TOPAZ_REVISIONS = _Info('fuchsiaTopazRevisions', 'GenericSet', str) diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_names.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_names.html index 77bb9681016..e1f7c686d23 100644 --- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_names.html +++ b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/reserved_names.html @@ -33,6 +33,7 @@ tr.exportTo('tr.v.d', function() { DESCRIPTION: {name: 'description', type: tr.v.d.GenericSet}, DEVICE_IDS: {name: 'deviceIds', type: tr.v.d.GenericSet}, DOCUMENTATION_URLS: {name: 'documentationUrls', type: tr.v.d.GenericSet}, + INFO_BLURB: {name: 'infoBlurb', type: tr.v.d.GenericSet}, FUCHSIA_GARNET_REVISIONS: { name: 'fuchsiaGarnetRevisions', type: tr.v.d.GenericSet}, FUCHSIA_PERIDOT_REVISIONS: { -- cgit v1.2.1