Skip to content

Commit 0ec4d06

Browse files
committed
[ui] Print slice duration on tooltip
The duration format follows the global duration timestamp settings. Screenshot: https://screenshot.googleplex.com/3nX3WZ3kZwrZEpM.png Bug: #622 Change-Id: I4e29bffef3f18e82cf003efbbbfbf6ff408b7f8c
1 parent f2ab58c commit 0ec4d06

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Diff for: ui/src/frontend/named_slice_track.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ import {
2424
BaseSliceTrackTypes,
2525
OnSliceClickArgs,
2626
OnSliceOverArgs,
27+
SLICE_FLAGS_INCOMPLETE,
28+
SLICE_FLAGS_INSTANT,
2729
} from './base_slice_track';
2830
import {globals} from './globals';
2931
import {NewTrackArgs} from './track';
32+
import {renderDuration} from './widgets/duration';
3033

3134
export const NAMED_ROW = {
3235
// Base columns (tsq, ts, dur, id, depth).
@@ -63,8 +66,16 @@ export abstract class NamedSliceTrack<
6366
}
6467

6568
onSliceOver(args: OnSliceOverArgs<T['slice']>) {
66-
const name = args.slice.title;
67-
args.tooltip = [name];
69+
const {title, dur, flags} = args.slice;
70+
let duration;
71+
if (flags & SLICE_FLAGS_INCOMPLETE) {
72+
duration = 'Incomplete';
73+
} else if (flags & SLICE_FLAGS_INSTANT) {
74+
duration = 'Instant';
75+
} else {
76+
duration = renderDuration(dur);
77+
}
78+
args.tooltip = [`${title} - [${duration}]`];
6879
}
6980

7081
onSliceClick(args: OnSliceClickArgs<T['slice']>) {

0 commit comments

Comments
 (0)