Commit aba3d85b authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[devtools] Keep polling for coverage during performance tracing

This CL enables the coverage model to keep polling the back-end for
coverage data while performance tracing is enabled.

Bug: chromium:1004203
Change-Id: I187afa45dadae3aac0d5012fa8a293eb26d438fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814825Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699718}
parent 2f563ea8
...@@ -198,15 +198,16 @@ SDK.Target = class extends Protocol.TargetBase { ...@@ -198,15 +198,16 @@ SDK.Target = class extends Protocol.TargetBase {
} }
/** /**
* @param {string=} reason - optionally provide a reason, so models can respond accordingly
* @return {!Promise} * @return {!Promise}
*/ */
async suspend() { async suspend(reason) {
if (this._isSuspended) if (this._isSuspended)
return Promise.resolve(); return Promise.resolve();
this._isSuspended = true; this._isSuspended = true;
await Promise.all(Array.from(this.models().values(), m => m.preSuspendModel())); await Promise.all(Array.from(this.models().values(), m => m.preSuspendModel(reason)));
await Promise.all(Array.from(this.models().values(), m => m.suspendModel())); await Promise.all(Array.from(this.models().values(), m => m.suspendModel(reason)));
} }
/** /**
...@@ -285,16 +286,18 @@ SDK.SDKModel = class extends Common.Object { ...@@ -285,16 +286,18 @@ SDK.SDKModel = class extends Common.Object {
/** /**
* Override this method to perform tasks that are required to suspend the * Override this method to perform tasks that are required to suspend the
* model and that still need other models in an unsuspended state. * model and that still need other models in an unsuspended state.
* @param {string=} reason - optionally provide a reason, the model can respond accordingly
* @return {!Promise} * @return {!Promise}
*/ */
preSuspendModel() { preSuspendModel(reason) {
return Promise.resolve(); return Promise.resolve();
} }
/** /**
* @param {string=} reason - optionally provide a reason, the model can respond accordingly
* @return {!Promise} * @return {!Promise}
*/ */
suspendModel() { suspendModel(reason) {
return Promise.resolve(); return Promise.resolve();
} }
......
...@@ -19,14 +19,15 @@ SDK.TargetManager = class extends Common.Object { ...@@ -19,14 +19,15 @@ SDK.TargetManager = class extends Common.Object {
} }
/** /**
* @param {string=} reason - optionally provide a reason, so targets can respond accordingly
* @return {!Promise} * @return {!Promise}
*/ */
suspendAllTargets() { suspendAllTargets(reason) {
if (this._isSuspended) if (this._isSuspended)
return Promise.resolve(); return Promise.resolve();
this._isSuspended = true; this._isSuspended = true;
this.dispatchEventToListeners(SDK.TargetManager.Events.SuspendStateChanged); this.dispatchEventToListeners(SDK.TargetManager.Events.SuspendStateChanged);
return Promise.all(this._targets.map(target => target.suspend())); return Promise.all(this._targets.map(target => target.suspend(reason)));
} }
/** /**
......
...@@ -187,7 +187,7 @@ Timeline.TimelineController = class { ...@@ -187,7 +187,7 @@ Timeline.TimelineController = class {
// There might be a significant delay in the beginning of timeline recording // There might be a significant delay in the beginning of timeline recording
// caused by starting CPU profiler, that needs to traverse JS heap to collect // caused by starting CPU profiler, that needs to traverse JS heap to collect
// all the functions data. // all the functions data.
await SDK.targetManager.suspendAllTargets(); await SDK.targetManager.suspendAllTargets('performance-timeline');
if (enableJSSampling && Runtime.queryParam('timelineTracingJSProfileDisabled')) if (enableJSSampling && Runtime.queryParam('timelineTracingJSProfileDisabled'))
await this._startProfilingOnAllModels(); await this._startProfilingOnAllModels();
if (!this._tracingManager) if (!this._tracingManager)
......
...@@ -3,22 +3,35 @@ Tests the merge of disjoint segment lists in CoverageModel. ...@@ -3,22 +3,35 @@ Tests the merge of disjoint segment lists in CoverageModel.
A: [] A: []
B: [] B: []
merged: [] merged: []
A: [{"end":10,"count":1}] A: [{"end":10,"count":1,"stamp":100}]
B: [] B: []
merged: [{"end":10,"count":1}] merged: [{"end":10,"count":1,"stamp":100}]
A: [{"end":10,"count":1}] A: [{"end":10,"count":1,"stamp":100}]
B: [{"end":10,"count":1}] B: [{"end":10,"count":1,"stamp":100}]
merged: [{"end":10,"count":2}] merged: [{"end":10,"count":2,"stamp":100}]
A: [{"end":10,"count":1}] A: [{"end":10,"count":1,"stamp":100}]
B: [{"end":20,"count":1}] B: [{"end":20,"count":1,"stamp":100}]
merged: [{"end":10,"count":2},{"end":20,"count":1}] merged: [{"end":10,"count":2,"stamp":100},{"end":20,"count":1,"stamp":100}]
A: [{"end":10,"count":1},{"end":20,"count":1}] A: [{"end":10,"count":1,"stamp":100},{"end":20,"count":1,"stamp":100}]
B: [] B: []
merged: [{"end":10,"count":1},{"end":20,"count":1}] merged: [{"end":10,"count":1,"stamp":100},{"end":20,"count":1,"stamp":100}]
A: [{"end":30,"count":1}] A: [{"end":30,"count":1,"stamp":100}]
B: [{"end":10},{"end":20,"count":2}] B: [{"end":10,"stamp":100},{"end":20,"count":2,"stamp":100}]
merged: [{"end":10,"count":1},{"end":20,"count":3},{"end":30,"count":1}] merged: [{"end":10,"count":1,"stamp":100},{"end":20,"count":3,"stamp":100},{"end":30,"count":1,"stamp":100}]
A: [{"end":30}] A: [{"end":30,"stamp":100}]
B: [{"end":10},{"end":20,"count":2}] B: [{"end":10,"stamp":100},{"end":20,"count":2,"stamp":100}]
merged: [{"end":10},{"end":20,"count":2},{"end":30}] merged: [{"end":10,"stamp":100},{"end":20,"count":2,"stamp":100},{"end":30,"stamp":100}]
Merging different stamps should result in the minimum timestamp
A: [{"end":10,"count":1,"stamp":100}]
B: [{"end":10,"count":1,"stamp":200}]
merged: [{"end":10,"count":2,"stamp":100}]
A: [{"end":10,"count":1,"stamp":100}]
B: [{"end":20,"count":1,"stamp":200}]
merged: [{"end":10,"count":2,"stamp":100},{"end":20,"count":1,"stamp":200}]
A: [{"end":10,"count":1,"stamp":100},{"end":20,"count":1,"stamp":200}]
B: []
merged: [{"end":10,"count":1,"stamp":100},{"end":20,"count":1,"stamp":200}]
A: [{"end":30,"count":1,"stamp":100}]
B: [{"end":10,"stamp":100},{"end":20,"count":2,"stamp":200}]
merged: [{"end":10,"count":1,"stamp":100},{"end":20,"count":3,"stamp":100},{"end":30,"count":1,"stamp":100}]
...@@ -7,12 +7,18 @@ ...@@ -7,12 +7,18 @@
await TestRunner.loadModule('coverage'); await TestRunner.loadModule('coverage');
testAndDump([], []); testAndDump([], []);
testAndDump([{end: 10, count: 1}], []); testAndDump([{end: 10, count: 1, stamp: 100}], []);
testAndDump([{end: 10, count: 1}], [{end: 10, count: 1}]); testAndDump([{end: 10, count: 1, stamp: 100}], [{end: 10, count: 1, stamp: 100}]);
testAndDump([{end: 10, count: 1}], [{end: 20, count: 1}]); testAndDump([{end: 10, count: 1, stamp: 100}], [{end: 20, count: 1, stamp: 100}]);
testAndDump([{end: 10, count: 1}, {end: 20, count: 1}], []); testAndDump([{end: 10, count: 1, stamp: 100}, {end: 20, count: 1, stamp: 100}], []);
testAndDump([{end: 30, count: 1}], [{end: 10, count: undefined}, {end: 20, count: 2}]); testAndDump([{end: 30, count: 1, stamp: 100}], [{end: 10, count: undefined, stamp: 100}, {end: 20, count: 2, stamp: 100}]);
testAndDump([{end: 30, count: undefined}], [{end: 10, count: undefined}, {end: 20, count: 2}]); testAndDump([{end: 30, count: undefined, stamp: 100}], [{end: 10, count: undefined, stamp: 100}, {end: 20, count: 2, stamp: 100}]);
TestRunner.addResult(`Merging different stamps should result in the minimum timestamp`);
testAndDump([{end: 10, count: 1, stamp: 100}], [{end: 10, count: 1, stamp: 200}]);
testAndDump([{end: 10, count: 1, stamp: 100}], [{end: 20, count: 1, stamp: 200}]);
testAndDump([{end: 10, count: 1, stamp: 100}, {end: 20, count: 1, stamp: 200}], []);
testAndDump([{end: 30, count: 1, stamp: 100}], [{end: 10, count: undefined, stamp: 100}, {end: 20, count: 2, stamp: 200}]);
TestRunner.completeTest(); TestRunner.completeTest();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment