Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly use hrtime in Instrumentation #375

Open
seawatts opened this issue Aug 27, 2017 · 2 comments
Open

Properly use hrtime in Instrumentation #375

seawatts opened this issue Aug 27, 2017 · 2 comments

Comments

@seawatts
Copy link
Contributor

https://github.com/denali-js/denali/blob/accbe4bdea7fdf710d05ede5c4e8d451afc2fa44/lib/metal/instrumentation.ts#L92

https://nodejs.org/api/process.html#process_process_hrtime_time

It should be used like the example:

const NS_PER_SEC = 1e9;
const time = process.hrtime();
// [ 1800216, 25 ]

setTimeout(() => {
  const diff = process.hrtime(time);
  // [ 1, 552 ]

  console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
  // benchmark took 1000000552 nanoseconds
}, 1000);
@seawatts seawatts changed the title This does not properly use hrtime Properly use hrtime in Instrumentation Aug 27, 2017
@davewasmer
Copy link
Collaborator

Is it just that we aren't using the seconds from the resulting array?

@seawatts
Copy link
Contributor Author

seawatts commented Aug 28, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants