Skip to content

Commit

Permalink
Merge "ui: change raw timestmap format to trace nanoseconds" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
LalitMaganti authored and Gerrit Code Review committed Sep 9, 2024
2 parents ecfdfaf + f3ad59e commit d87ca5c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions ui/src/core/timestamp_format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {isEnumValue} from '../base/object_utils';

export enum TimestampFormat {
Timecode = 'timecode',
Raw = 'raw',
RawLocale = 'rawLocale',
TraceNs = 'traceNs',
TraceNsLocale = 'traceNsLocale',
Seconds = 'seconds',
UTC = 'utc',
TraceTz = 'traceTz',
Expand Down
4 changes: 2 additions & 2 deletions ui/src/frontend/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ class Globals {
case TimestampFormat.Timecode:
case TimestampFormat.Seconds:
return this.traceContext.start;
case TimestampFormat.Raw:
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNs:
case TimestampFormat.TraceNsLocale:
return Time.ZERO;
case TimestampFormat.UTC:
return this.traceContext.utcOffset;
Expand Down
4 changes: 2 additions & 2 deletions ui/src/frontend/overview_timeline_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ function renderTimestamp(
case TimestampFormat.Timecode:
renderTimecode(ctx, time, x, y, minWidth);
break;
case TimestampFormat.Raw:
case TimestampFormat.TraceNs:
ctx.fillText(time.toString(), x, y, minWidth);
break;
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNsLocale:
ctx.fillText(time.toLocaleString(), x, y, minWidth);
break;
case TimestampFormat.Seconds:
Expand Down
8 changes: 4 additions & 4 deletions ui/src/frontend/time_axis_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class TimeAxisPanel implements Panel {
private renderOffsetTimestamp(ctx: CanvasRenderingContext2D): void {
const offset = globals.timestampOffset();
switch (timestampFormat()) {
case TimestampFormat.Raw:
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNs:
case TimestampFormat.TraceNsLocale:
break;
case TimestampFormat.Seconds:
case TimestampFormat.Timecode:
Expand Down Expand Up @@ -122,9 +122,9 @@ function renderTimestamp(
case TimestampFormat.TraceTz:
case TimestampFormat.Timecode:
return renderTimecode(ctx, time, x, y, minWidth);
case TimestampFormat.Raw:
case TimestampFormat.TraceNs:
return renderRawTimestamp(ctx, time.toString(), x, y, minWidth);
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNsLocale:
return renderRawTimestamp(ctx, time.toLocaleString(), x, y, minWidth);
case TimestampFormat.Seconds:
return renderRawTimestamp(ctx, Time.formatSeconds(time), x, y, minWidth);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/frontend/time_selection_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ function stringifyTimestamp(time: time): string {
case TimestampFormat.Timecode:
const THIN_SPACE = '\u2009';
return Time.toTimecode(time).toString(THIN_SPACE);
case TimestampFormat.Raw:
case TimestampFormat.TraceNs:
return time.toString();
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNsLocale:
return time.toLocaleString();
case TimestampFormat.Seconds:
return Time.formatSeconds(time);
Expand Down
6 changes: 3 additions & 3 deletions ui/src/frontend/ui_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export class UiMain implements m.ClassComponent {
displayName: 'Realtime (Trace TZ)',
},
{key: TimestampFormat.Seconds, displayName: 'Seconds'},
{key: TimestampFormat.Raw, displayName: 'Raw'},
{key: TimestampFormat.TraceNs, displayName: 'Trace nanoseconds'},
{
key: TimestampFormat.RawLocale,
displayName: 'Raw (with locale-specific formatting)',
key: TimestampFormat.TraceNsLocale,
displayName: 'Trace nanoseconds (with locale-specific formatting)',
},
];
const promptText = 'Select format...';
Expand Down
8 changes: 4 additions & 4 deletions ui/src/frontend/widgets/duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export class DurationWidget implements m.ClassComponent<DurationWidgetAttrs> {
menuItemForFormat(TimestampFormat.UTC, 'Realtime (UTC)'),
menuItemForFormat(TimestampFormat.TraceTz, 'Realtime (Trace TZ)'),
menuItemForFormat(TimestampFormat.Seconds, 'Seconds'),
menuItemForFormat(TimestampFormat.Raw, 'Raw'),
menuItemForFormat(TimestampFormat.TraceNs, 'Raw'),
menuItemForFormat(
TimestampFormat.RawLocale,
TimestampFormat.TraceNsLocale,
'Raw (with locale-specific formatting)',
),
),
Expand Down Expand Up @@ -113,9 +113,9 @@ export function renderDuration(dur: duration): string {
case TimestampFormat.TraceTz:
case TimestampFormat.Timecode:
return renderFormattedDuration(dur);
case TimestampFormat.Raw:
case TimestampFormat.TraceNs:
return dur.toString();
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNsLocale:
return dur.toLocaleString();
case TimestampFormat.Seconds:
return Duration.formatSeconds(dur);
Expand Down
8 changes: 4 additions & 4 deletions ui/src/frontend/widgets/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export class Timestamp implements m.ClassComponent<TimestampAttrs> {
menuItemForFormat(TimestampFormat.UTC, 'Realtime (UTC)'),
menuItemForFormat(TimestampFormat.TraceTz, 'Realtime (Trace TZ)'),
menuItemForFormat(TimestampFormat.Seconds, 'Seconds'),
menuItemForFormat(TimestampFormat.Raw, 'Raw'),
menuItemForFormat(TimestampFormat.TraceNs, 'Raw'),
menuItemForFormat(
TimestampFormat.RawLocale,
TimestampFormat.TraceNsLocale,
'Raw (with locale-specific formatting)',
),
),
Expand Down Expand Up @@ -109,9 +109,9 @@ function renderTimestamp(time: time): m.Children {
case TimestampFormat.TraceTz:
case TimestampFormat.Timecode:
return renderTimecode(domainTime);
case TimestampFormat.Raw:
case TimestampFormat.TraceNs:
return domainTime.toString();
case TimestampFormat.RawLocale:
case TimestampFormat.TraceNsLocale:
return domainTime.toLocaleString();
case TimestampFormat.Seconds:
return Time.formatSeconds(domainTime);
Expand Down

0 comments on commit d87ca5c

Please sign in to comment.