Skip to content

Commit 288f7da

Browse files
committed
Show relative time values in pq marker info too
1 parent 0e7bd12 commit 288f7da

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

src/profile-query-cli/formatters.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,16 @@ Marker ${result.markerHandle}: ${result.name}`;
256256
output += `Category: ${result.category.name}\n`;
257257

258258
// Time and duration
259-
const startStr = result.start.toFixed(3);
259+
// result.start/end are absolute profile-internal ms timestamps.
260+
// Compute relative offsets from profile start for display.
261+
const rootStart = result.context.rootRange.start;
262+
const relStart = result.start - rootStart;
263+
const relStartStr = relStart.toFixed(3);
264+
const absStartStr = result.start.toFixed(3);
260265
if (result.end !== null) {
261-
const endStr = result.end.toFixed(3);
266+
const relEnd = result.end - rootStart;
267+
const relEndStr = relEnd.toFixed(3);
268+
const absEndStr = result.end.toFixed(3);
262269
const durationMs = result.duration!;
263270
let durationStr: string;
264271
if (durationMs < 1) {
@@ -268,9 +275,11 @@ Marker ${result.markerHandle}: ${result.name}`;
268275
} else {
269276
durationStr = `${(durationMs / 1000).toFixed(3)}s`;
270277
}
271-
output += `Time: ${startStr}ms - ${endStr}ms (${durationStr})\n`;
278+
output += `Time: ${relStartStr}ms - ${relEndStr}ms (${durationStr})\n`;
279+
output += ` Absolute: ${absStartStr}ms - ${absEndStr}ms (use with: pq zoom push ${absStartStr},${absEndStr} --absolute)\n`;
272280
} else {
273-
output += `Time: ${startStr}ms (instant)\n`;
281+
output += `Time: ${relStartStr}ms (instant)\n`;
282+
output += ` Absolute: ${absStartStr}ms\n`;
274283
}
275284

276285
output += `Thread: ${result.threadHandle} (${result.friendlyThreadName})\n`;

src/profile-query-cli/guide.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,8 @@ ZOOM: FOCUS ON A TIME RANGE
8080
10% Percentage through the profile duration
8181
ts-6 Named timestamp handle (from command output)
8282
m-158 Marker handle -- zooms to that marker's start/end times
83-
84-
ABSOLUTE VS. RELATIVE TIMESTAMPS:
85-
"marker info" reports timestamps in absolute milliseconds (e.g. Time: 3349892.250ms).
86-
These are NOT relative offsets -- they are raw profile-internal timestamps.
87-
88-
DO NOT use them directly as bare numbers: "pq zoom push 3349892,3354100" is WRONG
89-
because bare numbers are treated as seconds from profile start.
90-
91-
Instead, use --absolute to pass them directly:
92-
pq zoom push 3349892.250,3354100 --absolute
93-
94-
Or compute the relative offset by subtracting the profile start time shown in "pq status":
95-
pq zoom push 892.250ms,4100ms (if profile starts at ~3349000ms)
83+
--absolute Treat bare numbers and ms values as absolute profile-internal ms
84+
(use with the absolute values shown by "marker info")
9685

9786

9887
JSON OUTPUT

0 commit comments

Comments
 (0)