Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
ChromeRendererHelper treats Chrome_InProcRendererThread as main thread
Browse files Browse the repository at this point in the history
This allows us to collect loading metrics from webview traces.

BUG=chromium:671730,chromium:651188,catapult:#1802

Review-Url: https://codereview.chromium.org/2558743002
  • Loading branch information
irori authored and Commit bot committed Dec 9, 2016
1 parent 658d759 commit df23635
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
Binary file added tracing/test_data/webview.json.gz
Binary file not shown.
49 changes: 48 additions & 1 deletion tracing/tracing/metrics/system_health/loading_metric_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,53 @@
assert.equal(2, numeric.running.count);
assert.equal(4000, numeric.running.min);
assert.equal(15200, numeric.running.max);
});
});

test('webView', function() {
var model = tr.c.TestUtils.newModel(function(model) {
var process = model.getOrCreateProcess(1);
var rendererThread = process.getOrCreateThread(2);
rendererThread.name = 'Chrome_InProcRendererThread';
rendererThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
cat: 'blink.user_timing',
title: 'navigationStart',
start: 200,
duration: 0.0,
args: {frame: '0xdeadbeef'}
}));
process.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
{isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
documentLoaderURL: 'http://example.com'});
rendererThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
cat: 'blink.user_timing,rail',
title: 'firstContentfulPaint',
start: 600,
duration: 0.0,
args: {frame: '0xdeadbeef'}
}));
rendererThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
cat: 'loading',
title: 'firstMeaningfulPaintCandidate',
start: 1000,
duration: 0.0,
args: {frame: '0xdeadbeef'}
}));
// This lets ChromeModelHelper recognize this process as a renderer
// process.
var compositorThread = process.getOrCreateThread(3);
compositorThread.name = 'Compositor';
});
var values = new tr.v.HistogramSet();
tr.metrics.sh.loadingMetric(values, model);
var fcp = tr.b.getOnlyElement(values.getValuesNamed(
'timeToFirstContentfulPaint'));
assert.equal(1, fcp.running.count);
assert.equal(400, fcp.running.mean);
var fmp = tr.b.getOnlyElement(values.getValuesNamed(
'timeToFirstMeaningfulPaint'));
assert.equal(1, fmp.running.count);
assert.equal(800, fmp.running.mean);
});

});
</script>
3 changes: 2 additions & 1 deletion tracing/tracing/model/helpers/chrome_renderer_helper.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
tr.exportTo('tr.model.helpers', function() {
function ChromeRendererHelper(modelHelper, process) {
tr.model.helpers.ChromeProcessHelper.call(this, modelHelper, process);
this.mainThread_ = process.findAtMostOneThreadNamed('CrRendererMain');
this.mainThread_ = process.findAtMostOneThreadNamed('CrRendererMain') ||
process.findAtMostOneThreadNamed('Chrome_InProcRendererThread');
this.compositorThread_ = process.findAtMostOneThreadNamed('Compositor');
this.rasterWorkerThreads_ = process.findAllThreadsMatching(function(t) {
if (t.name === undefined)
Expand Down

0 comments on commit df23635

Please sign in to comment.