diff options
Diffstat (limited to 'ui/src/tracks/expected_frames/index.ts')
-rw-r--r-- | ui/src/tracks/expected_frames/index.ts | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/ui/src/tracks/expected_frames/index.ts b/ui/src/tracks/expected_frames/index.ts index f2ab086b4..f7e5121d8 100644 --- a/ui/src/tracks/expected_frames/index.ts +++ b/ui/src/tracks/expected_frames/index.ts @@ -19,8 +19,8 @@ export const EXPECTED_FRAMES_SLICE_TRACK_KIND = 'ExpectedFramesSliceTrack'; import {NewTrackArgs, Track} from '../../frontend/track'; import {ChromeSliceTrack} from '../chrome_slices'; -import {NUM, NUM_NULL, STR} from '../../common/query_result'; -import {fromNs, toNs} from '../../common/time'; +import {LONG_NULL, NUM, STR} from '../../common/query_result'; +import {TPDuration, TPTime, fromNs} from '../../common/time'; import { TrackController, } from '../../controller/track_controller'; @@ -46,27 +46,25 @@ export interface Data extends TrackData { class ExpectedFramesSliceTrackController extends TrackController<Config, Data> { static readonly kind = EXPECTED_FRAMES_SLICE_TRACK_KIND; - private maxDurNs = 0; + private maxDurNs: TPDuration = 0n; - async onBoundsChange(start: number, end: number, resolution: number): + async onBoundsChange(start: TPTime, end: TPTime, resolution: TPDuration): Promise<Data> { - const startNs = toNs(start); - const endNs = toNs(end); - const pxSize = this.pxSize(); // ns per quantization bucket (i.e. ns per pixel). /2 * 2 is to force it to // be an even number, so we can snap in the middle. - const bucketNs = Math.max(Math.round(resolution * 1e9 * pxSize / 2) * 2, 1); + const bucketNs = + Math.max(Math.round(Number(resolution) * pxSize / 2) * 2, 1); - if (this.maxDurNs === 0) { + if (this.maxDurNs === 0n) { const maxDurResult = await this.query(` select max(iif(dur = -1, (SELECT end_ts FROM trace_bounds) - ts, dur)) as maxDur from experimental_slice_layout where filter_track_ids = '${this.config.trackIds.join(',')}' `); - this.maxDurNs = maxDurResult.firstRow({maxDur: NUM_NULL}).maxDur || 0; + this.maxDurNs = maxDurResult.firstRow({maxDur: LONG_NULL}).maxDur || 0n; } const queryRes = await this.query(` @@ -82,8 +80,8 @@ class ExpectedFramesSliceTrackController extends TrackController<Config, Data> { from experimental_slice_layout where filter_track_ids = '${this.config.trackIds.join(',')}' and - ts >= ${startNs - this.maxDurNs} and - ts <= ${endNs} + ts >= ${start - this.maxDurNs} and + ts <= ${end} group by tsq, layout_depth order by tsq, layout_depth `); |