Round reported UI latency metrics time values

Change-Id: I516101c0e9ab2166fa63ed12a42a4834da414a21
This commit is contained in:
Viktar Donich
2018-04-19 15:17:58 -07:00
parent 1bf5543c03
commit b277ad6c9b
2 changed files with 4 additions and 4 deletions

View File

@@ -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];
},

View File

@@ -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