4a0921704a
Add common TimelineTrackStackedBase base class for TimelineTrackTick and TimelineTrackTimer for visualising stacked time ranges that only need rescaling when zooming in. Additional changes: - Highlight matching registers in disassembly - Simplify CodeLogEntry summary for script code - Show event for array items in the property-link-table Bug: v8:10644 Change-Id: I0b37274e12ba55f1c6251b90d39d996ffae7f37e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2992716 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#75437}
56 lines
1.2 KiB
JavaScript
56 lines
1.2 KiB
JavaScript
// Copyright 2021 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
import {formatDurationMicros} from '../helper.mjs';
|
|
|
|
import {LogEntry} from './log.mjs';
|
|
|
|
export class TimerLogEntry extends LogEntry {
|
|
constructor(type, startTime, endTime = -1) {
|
|
super(type, startTime);
|
|
this._endTime = endTime;
|
|
this.depth = 0;
|
|
}
|
|
|
|
end(time) {
|
|
if (this.isInitialized) throw new Error('Invalid timer change');
|
|
this._endTime = time;
|
|
}
|
|
|
|
get isInitialized() {
|
|
return this._endTime !== -1;
|
|
}
|
|
|
|
get startTime() {
|
|
return this._time;
|
|
}
|
|
|
|
get endTime() {
|
|
return this._endTime;
|
|
}
|
|
|
|
get duration() {
|
|
return this._endTime - this._time;
|
|
}
|
|
|
|
covers(time) {
|
|
return this._time <= time && time <= this._endTime;
|
|
}
|
|
|
|
get toolTipDict() {
|
|
const dict = super.toolTipDict;
|
|
dict.startTime = formatDurationMicros(dict.startTime);
|
|
dict.endTime = formatDurationMicros(dict.endTime);
|
|
dict.duration = formatDurationMicros(dict.duration);
|
|
return dict;
|
|
}
|
|
|
|
static get propertyNames() {
|
|
return [
|
|
'type',
|
|
'startTime',
|
|
'endTime',
|
|
'duration',
|
|
];
|
|
}
|
|
} |