-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Schüler
committed
Mar 1, 2024
1 parent
ef32d62
commit 4836fc7
Showing
4 changed files
with
26 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
export function addRuntime(input: { durationInNanos: number }): string { | ||
return input.durationInNanos > 1e7 ? `(${(input.durationInNanos / 1e9).toFixed(3)}s)` : ""; | ||
export function addRuntimeInSeconds(durationInNanos: number ): string { | ||
return addRuntime(durationInNanos, 1e7, 1e9, "s"); | ||
} | ||
|
||
export function addRuntimeInMiliseconds(durationInNanos: number): string { | ||
return addRuntime(durationInNanos, 1e4, 1e6, "ms"); | ||
} | ||
|
||
function addRuntime(durationInNanos: number, treshhold: number, divisor: number, unitOfMeasure: string): string { | ||
return durationInNanos > treshhold ? `(${(durationInNanos / divisor).toFixed(3)}${unitOfMeasure})` : ""; | ||
} | ||
|