diff --git a/frontend/app/common/utils/utils.ts b/frontend/app/common/utils/utils.ts index 5a2627c8..d248dfb9 100644 --- a/frontend/app/common/utils/utils.ts +++ b/frontend/app/common/utils/utils.ts @@ -413,3 +413,18 @@ export function getStringColumnValue( } return String((row[columnIndex] || {}).v || ''); } + +/** + * Format the duration in picoseconds to a string with proper unit. + * durationPs: duration in picoseconds + * dp: number of decimal places to display, default is 2 + */ +export function formatDurationPs(durationPs: number, dp = 2) { + const units = ['ps', 'ns', 'us', 'ms', 's']; + let i = 0; + while (durationPs >= 1000 && i < units.length - 1) { + durationPs /= 1000; + i++; + } + return `${durationPs.toFixed(dp)} ${units[i]}`; +} diff --git a/frontend/app/components/op_profile/op_details/op_details.ng.html b/frontend/app/components/op_profile/op_details/op_details.ng.html index 7097a9aa..27a85251 100644 --- a/frontend/app/components/op_profile/op_details/op_details.ng.html +++ b/frontend/app/components/op_profile/op_details/op_details.ng.html @@ -39,9 +39,9 @@ -
{{avgTimeMs}}
+ {{avgTime}}