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

Unified Diff: tracing/tracing/metrics/v8/gc_metric.html

Issue 1908513002: Add mutator utilization metric. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Remove redundant semicolon Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/metrics/v8/gc_metric.html
diff --git a/tracing/tracing/metrics/v8/gc_metric.html b/tracing/tracing/metrics/v8/gc_metric.html
index 3243402f13b6da68883493752a8a9e43055aae57..39e754bae85b4d578b097f9e08a9182831e7ac32 100644
--- a/tracing/tracing/metrics/v8/gc_metric.html
+++ b/tracing/tracing/metrics/v8/gc_metric.html
@@ -15,12 +15,19 @@ found in the LICENSE file.
'use strict';
tr.exportTo('tr.metrics.v8', function() {
+ // The time window size for mutator utilization computation.
+ // It is equal to the duration of one frame corresponding to 60 FPS rendering.
+ var TARGET_FPS = 60;
+ var MS_PER_SECOND = 1000;
+ var WINDOW_SIZE_MS = MS_PER_SECOND / TARGET_FPS;
+
function gcMetric(valueList, model) {
addDurationOfTopEvents(valueList, model);
addTotalDurationOfTopEvents(valueList, model);
addDurationOfSubEvents(valueList, model);
addIdleTimesOfTopEvents(valueList, model);
addTotalIdleTimesOfTopEvents(valueList, model);
+ addMutatorUtilization(valueList, model);
}
gcMetric.prototype = {
@@ -159,7 +166,6 @@ tr.exportTo('tr.metrics.v8', function() {
var overrun = 0;
if (idleTask) {
var allottedTime = idleTask['args']['allotted_time_ms'];
- console.log(allottedTime);
if (event.duration > allottedTime) {
overrun = event.duration - allottedTime;
// Don't count time over the deadline as being inside idle time.
@@ -191,6 +197,44 @@ tr.exportTo('tr.metrics.v8', function() {
stageTitle + '-' + name + '_percentage_idle', percentage));
}
+ function addMutatorUtilization(valueList, model) {
+ groupAndProcessEvents(model,
+ tr.metrics.v8.utils.isTopV8ExecuteEvent,
+ event => 'v8.execute',
+ function(stageTitle, name, events) {
+ events.sort((a, b) => a.start - b.start);
+ var time = 0;
+ var pauses = [];
+ // Glue together the v8.execute events and adjust the GC pause
+ // times accordingly.
+ events.forEach(function(topEvent) {
+ topEvent.findTopmostSlicesRelativeToThisSlice(function(e) {
+ if (tr.metrics.v8.utils.isTopGarbageCollectionEvent(e)) {
+ pauses.push({ start: e.start - topEvent.start + time,
+ end: e.end - topEvent.start + time });
+ }
+ });
+ time += topEvent.duration;
+ });
+ // Now we have one big v8.execute interval from 0 to |time| and
+ // a list of GC pauses.
+ var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
+ 0, time, WINDOW_SIZE_MS, pauses);
+ [0.95, 0.99].forEach(function(percent) {
+ var value = new tr.v.ScalarNumeric(percentage_biggerIsBetter,
+ mutatorUtilization.percentile(1.0 - percent) * 100);
+ valueList.addValue(new tr.v.NumericValue(model.canonicalUrl,
+ stageTitle + '-mutator_utilization_pct_0' + percent * 100,
+ value));
+ });
+ var value = new tr.v.ScalarNumeric(percentage_biggerIsBetter,
+ mutatorUtilization.min);
+ valueList.addValue(new tr.v.NumericValue(model.canonicalUrl,
+ stageTitle + '-mutator_utilization_min', value));
+ }
+ );
+ }
+
/**
* Filters events using the |filterCallback|, then groups events by the user
* expectation stage title and the name computed using the |nameCallback|,
@@ -225,7 +269,8 @@ tr.exportTo('tr.metrics.v8', function() {
}
return {
- gcMetric: gcMetric
+ gcMetric: gcMetric,
+ WINDOW_SIZE_MS: WINDOW_SIZE_MS // For testing purposes only.
};
});
</script>
« no previous file with comments | « tracing/tracing/base/piecewise_linear_function_test.html ('k') | tracing/tracing/metrics/v8/gc_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698