Round reported UI latency metrics time values
Change-Id: I516101c0e9ab2166fa63ed12a42a4834da414a21
This commit is contained in:
@@ -178,7 +178,7 @@
|
||||
*/
|
||||
timeEnd(name) {
|
||||
const baseTime = this._baselines[name] || 0;
|
||||
const time = this.now() - baseTime;
|
||||
const time = Math.round(this.now() - baseTime);
|
||||
this.reporter(TIMING.TYPE, TIMING.CATEGORY, name, time);
|
||||
delete this._baselines[name];
|
||||
},
|
||||
|
||||
@@ -79,14 +79,14 @@ limitations under the License.
|
||||
test('time and timeEnd', () => {
|
||||
const nowStub = sandbox.stub(element, 'now').returns(0);
|
||||
element.time('foo');
|
||||
nowStub.returns(1);
|
||||
nowStub.returns(1.1);
|
||||
element.time('bar');
|
||||
nowStub.returns(2);
|
||||
element.timeEnd('bar');
|
||||
nowStub.returns(3.123);
|
||||
nowStub.returns(3.511);
|
||||
element.timeEnd('foo');
|
||||
assert.isTrue(element.reporter.calledWithExactly(
|
||||
'timing-report', 'UI Latency', 'foo', 3.123
|
||||
'timing-report', 'UI Latency', 'foo', 4
|
||||
));
|
||||
assert.isTrue(element.reporter.calledWithExactly(
|
||||
'timing-report', 'UI Latency', 'bar', 1
|
||||
|
||||
Reference in New Issue
Block a user