Skip to content

Commit 7027eab

Browse files
authored
Merge pull request #4955 from parca-dev/add-query-duration
ui: Add text showing the timeframe of the query
2 parents f7fd413 + 8c16254 commit 7027eab

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ui/packages/shared/profile/src/ProfileSource.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
Timestamp,
2121
} from '@parca/client';
2222
import {Matcher, NewParser, ProfileType, Query} from '@parca/parser';
23-
import {formatDate} from '@parca/utilities';
23+
import {formatDate, formatDuration} from '@parca/utilities';
2424

2525
export interface ProfileSource {
2626
QueryRequest: () => QueryRequest;
@@ -255,11 +255,13 @@ export class MergedProfileSource implements ProfileSource {
255255

256256
let timePart = '';
257257
if (this.mergeFrom !== 0) {
258-
timePart = ` from ${formatDate(
259-
this.mergeFrom,
258+
timePart = `over ${formatDuration({
259+
milliseconds: this.mergeTo - this.mergeFrom,
260+
})} from ${formatDate(this.mergeFrom, timeFormat(timezone), timezone)} to ${formatDate(
261+
this.mergeTo,
260262
timeFormat(timezone),
261263
timezone
262-
)} to ${formatDate(this.mergeTo, timeFormat(timezone), timezone)}`;
264+
)}`;
263265
}
264266

265267
return `merged profiles${queryPart}${timePart}`;

0 commit comments

Comments
 (0)