Created
August 11, 2017 20:26
-
-
Save coreylight/76e9fae3c62fd8c2ff5ea1571ab706fa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function hrMillis(measure) { | |
return (measure[0] * 1000) + (measure[1] / 1e6); | |
} | |
const databaseStartTime = process.hrtime(); | |
await runTheDatabaseCall(); | |
const databaseMeasure = process.hrtime(databaseStartTime); | |
const analyticsStartTime = process.hrtime(); | |
await analyticsCall(); | |
const analyticsMeasure = process.hrtime(analyticsStartTime); | |
const databaseMillis = hrMillis(databaseMeasure); | |
const analyticsMillis = hrMillis(analyticsMeasure); | |
console.log([databaseMillis, analyticsMillis]); | |
// [ 791.209319, 321.346743 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment