Skip to content

Commit

Permalink
fix: human readable formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kidroca committed May 21, 2021
1 parent e9c8477 commit 74809be
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/decorateWithMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ function getMetrics() {
}

function toHumanReadableDuration(millis) {
const minute = 60 * 60 * 1000;
const minute = 60 * 1000;
if (millis > minute) {
return `${(millis / minute).toFixed(1)}min`;
}

const second = 60 * 1000;
const second = 1000;
if (millis > second) {
return `${(millis / second).toFixed(2)}sec`;
}
Expand All @@ -121,8 +121,8 @@ function printMetrics() {

/* eslint-disable no-console */
console.group('Onyx Benchmark');
console.info('Total: ', toHumanReadableDuration(totalTime));
console.info('Average: ', toHumanReadableDuration(averageTime));
console.info(' Total: ', toHumanReadableDuration(totalTime));
console.info(' Average: ', toHumanReadableDuration(averageTime));

_.chain(summaries)
.sortBy('avg')
Expand All @@ -134,7 +134,7 @@ function printMetrics() {
console.table(calls.map(call => ({
startTime: toHumanReadableDuration(call.startTime),
endTime: toHumanReadableDuration(call.endTime),
duration: toHumanReadableDuration(call.endTime - call.startTime),
duration: toHumanReadableDuration(call.duration),
args: JSON.stringify(call.args)
})));
console.groupEnd();
Expand Down

0 comments on commit 74809be

Please sign in to comment.