Merge "Generate real timestamp for WM dumps"

This commit is contained in:
Kean Mariotti
2023-01-18 16:22:46 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 5 deletions

View File

@@ -48,10 +48,12 @@ class ParserWindowManagerDump extends Parser {
}
override getTimestamp(type: TimestampType, entryProto: any): undefined | Timestamp {
if (type !== TimestampType.ELAPSED) {
return undefined;
if (type === TimestampType.ELAPSED) {
return new Timestamp(TimestampType.ELAPSED, 0n);
} else if (type === TimestampType.REAL) {
return new Timestamp(TimestampType.REAL, 0n);
}
return new Timestamp(TimestampType.ELAPSED, 0n);
return undefined;
}
override processDecodedEntry(

View File

@@ -35,8 +35,9 @@ describe('ParserWindowManagerDump', () => {
expect(parser.getTimestamps(TimestampType.ELAPSED)).toEqual(expected);
});
it("doesn't provide real timestamp (never)", () => {
expect(parser.getTimestamps(TimestampType.REAL)).toEqual(undefined);
it('provides real timestamp (always zero)', () => {
const expected = [new Timestamp(TimestampType.REAL, 0n)];
expect(parser.getTimestamps(TimestampType.REAL)).toEqual(expected);
});
it('retrieves trace entry from elapsed timestamp', () => {