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

Unified Diff: tracing/tracing/metrics/system_health/expected_queueing_time_metric.html

Issue 2769643002: Speed up the EQT metric computation. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | tracing/tracing/metrics/system_health/expected_queueing_time_metric_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/system_health/expected_queueing_time_metric.html
diff --git a/tracing/tracing/metrics/system_health/expected_queueing_time_metric.html b/tracing/tracing/metrics/system_health/expected_queueing_time_metric.html
index 28a4dcb4faaa812bf0ed1e81fed78123f323e731..aa090f65233a4eb6d270cb9518eede966485565a 100644
--- a/tracing/tracing/metrics/system_health/expected_queueing_time_metric.html
+++ b/tracing/tracing/metrics/system_health/expected_queueing_time_metric.html
@@ -93,20 +93,22 @@ tr.exportTo('tr.metrics.sh', function() {
* Each renderer process adds one sample to the histograms.
*/
function expectedQueueingTimeMetric(histograms, model) {
- let chromeHelper = model.getOrCreateHelper(
+ const chromeHelper = model.getOrCreateHelper(
tr.model.helpers.ChromeModelHelper);
- let totalHistogram = createHistogramForEQT_(
+ const totalHistogram = createHistogramForEQT_(
`total:${WINDOW_SIZE_MS}ms_window:renderer_eqt`,
`The maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window` +
' for a given renderer');
- let interactiveHistogram = createHistogramForEQT_(
+ const interactiveHistogram = createHistogramForEQT_(
`interactive:${WINDOW_SIZE_MS}ms_window:renderer_eqt`,
`The maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window` +
' for a given renderer while the page is interactive');
- let rendererHelpers = tr.b.dictionaryValues(chromeHelper.rendererHelpers);
+ const rendererHelpers = tr.b.dictionaryValues(chromeHelper.rendererHelpers);
+ const rendererToInteractiveTimestamps =
ulan 2017/03/22 12:29:49 This is the main change.
+ tr.e.chrome.getInteractiveTimestamps(model);
for (let rendererHelper of rendererHelpers) {
if (rendererHelper.isChromeTracingUI) continue;
- let tasks = rendererHelper.mainThread.sliceGroup.topLevelSlices
+ const tasks = rendererHelper.mainThread.sliceGroup.topLevelSlices
.filter(slice => slice.duration > 0 && !containsForcedGC_(slice))
.map(slice => {return {start: slice.start, end: slice.end};});
totalHistogram.addSample(
@@ -114,15 +116,15 @@ tr.exportTo('tr.metrics.sh', function() {
rendererHelper.mainThread.bounds.min,
rendererHelper.mainThread.bounds.max,
WINDOW_SIZE_MS, tasks));
- let interactiveTimestamps =
- tr.e.chrome.getInteractiveTimestamps(model).get(rendererHelper.pid);
+ const interactiveTimestamps =
+ rendererToInteractiveTimestamps.get(rendererHelper.pid);
if (interactiveTimestamps.length === 0) continue;
if (interactiveTimestamps.length > 1) {
// TODO(ulan): Support multiple interactive time windows when
// https://crbug.com/692112 is fixed.
continue;
}
- let interactiveWindow =
+ const interactiveWindow =
tr.b.Range.fromExplicitRange(interactiveTimestamps[0], Infinity)
.findIntersection(rendererHelper.mainThread.bounds);
interactiveHistogram.addSample(
@@ -131,7 +133,8 @@ tr.exportTo('tr.metrics.sh', function() {
WINDOW_SIZE_MS, tasks));
}
addV8ContributionToExpectedQueueingTime(
- totalHistogram, interactiveHistogram, histograms, model);
+ totalHistogram, interactiveHistogram, rendererToInteractiveTimestamps,
+ histograms, model);
histograms.addHistogram(totalHistogram);
histograms.addHistogram(interactiveHistogram);
}
@@ -144,15 +147,21 @@ tr.exportTo('tr.metrics.sh', function() {
* - total:500ms_window:renderer_eqt:v8:gc,
* - interactive:500ms_window:renderer_eqt:v8:gc:scavenger,
* - interactive:500ms_window:renderer_eqt:v8:compile.
+ * @param totalEqtHistogram the main total EQT histogram.
+ * @param interactiveEqtHistogram the main interactive EQT histogram.
+ * @param rendererToInteractiveTimestamps a map from renderer pid to an array
+ * of interactive timestamps.
*/
function addV8ContributionToExpectedQueueingTime(
- totalEqtHistogram, interactiveEqtHistogram, histograms, model) {
+ totalEqtHistogram, interactiveEqtHistogram,
+ rendererToInteractiveTimestamps, histograms, model) {
if (!model.categories.includes('v8')) return;
const breakdownForTotal = new tr.v.d.RelatedHistogramMap();
const breakdownForInteractive = new tr.v.d.RelatedHistogramMap();
for (let [eventName, filter] of V8_EVENT_NAMES_TO_FILTERS) {
const contribution = contributionToExpectedQueueingTime(
- filter, eventName, histograms, model);
+ filter, eventName, rendererToInteractiveTimestamps,
+ histograms, model);
breakdownForTotal.set(eventName, contribution.total);
breakdownForInteractive.set(eventName, contribution.interactive);
}
@@ -191,28 +200,31 @@ tr.exportTo('tr.metrics.sh', function() {
* @param eventPredicate the predicate for selecting events.
* @param eventName the name describing the selected events. This name will be
* added to metric names.
+ * @param rendererToInteractiveTimestamps a map from renderer pid to an array
+ * of interactive timestamps.
* @returns {{total: !tr.v.Histogram, interactive: !tr.v.Histogram}}
*/
function contributionToExpectedQueueingTime(
- eventPredicate, eventName, histograms, model) {
- let chromeHelper = model.getOrCreateHelper(
+ eventPredicate, eventName, rendererToInteractiveTimestamps, histograms,
+ model) {
+ const chromeHelper = model.getOrCreateHelper(
tr.model.helpers.ChromeModelHelper);
- let totalHistogram = createHistogramForEQT_(
+ const totalHistogram = createHistogramForEQT_(
`total:${WINDOW_SIZE_MS}ms_window:renderer_eqt:${eventName}`,
`Contribution to the expected queueing time by ${eventName}` +
' for a given renderer. It is computed as the maximum EQT in' +
` a ${WINDOW_SIZE_MS}ms sliding window after shrinking top-level` +
` tasks to contain only ${eventName} subevents`);
- let interactiveHistogram = createHistogramForEQT_(
+ const interactiveHistogram = createHistogramForEQT_(
`interactive:${WINDOW_SIZE_MS}ms_window:renderer_eqt:${eventName}`,
`Contribution to the expected queueing time by ${eventName}` +
' for a given renderer while the page is interactive. It is computed' +
` as the maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window after` +
` shrinking top-level tasks to contain only ${eventName} subevents`);
- let rendererHelpers = tr.b.dictionaryValues(chromeHelper.rendererHelpers);
+ const rendererHelpers = tr.b.dictionaryValues(chromeHelper.rendererHelpers);
for (let rendererHelper of rendererHelpers) {
if (rendererHelper.isChromeTracingUI) continue;
- let tasks = rendererHelper.mainThread.sliceGroup.topLevelSlices
+ const tasks = rendererHelper.mainThread.sliceGroup.topLevelSlices
.filter(slice => slice.duration > 0 && !containsForcedGC_(slice))
.map(slice => {
return {
@@ -226,15 +238,15 @@ tr.exportTo('tr.metrics.sh', function() {
rendererHelper.mainThread.bounds.min,
rendererHelper.mainThread.bounds.max,
WINDOW_SIZE_MS, tasks));
- let interactiveTimestamps =
- tr.e.chrome.getInteractiveTimestamps(model).get(rendererHelper.pid);
+ const interactiveTimestamps =
+ rendererToInteractiveTimestamps.get(rendererHelper.pid);
if (interactiveTimestamps.length === 0) continue;
if (interactiveTimestamps.length > 1) {
// TODO(ulan): Support multiple interactive time windows when
// https://crbug.com/692112 is fixed.
continue;
}
- let interactiveWindow =
+ const interactiveWindow =
tr.b.Range.fromExplicitRange(interactiveTimestamps[0], Infinity)
.findIntersection(rendererHelper.mainThread.bounds);
interactiveHistogram.addSample(
« no previous file with comments | « no previous file | tracing/tracing/metrics/system_health/expected_queueing_time_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698