MCPcopy Index your code
hub / github.com/nodejs/node / hrtime

Function hrtime

lib/internal/process/per_thread.js:78–97  ·  view source on GitHub ↗
(time)

Source from the content-addressed store, hash-verified

76const hrBigintValues = new BigUint64Array(binding.hrtimeBuffer.buffer, 0, 1);
77
78function hrtime(time) {
79 binding.hrtime();
80
81 if (time !== undefined) {
82 validateArray(time, 'time');
83 if (time.length !== 2) {
84 throw new ERR_OUT_OF_RANGE('time', 2, time.length);
85 }
86
87 const sec = (hrValues[0] * 0x100000000 + hrValues[1]) - time[0];
88 const nsec = hrValues[2] - time[1];
89 const needsBorrow = nsec < 0;
90 return [needsBorrow ? sec - 1 : sec, needsBorrow ? nsec + 1e9 : nsec];
91 }
92
93 return [
94 hrValues[0] * 0x100000000 + hrValues[1],
95 hrValues[2],
96 ];
97}
98
99function hrtimeBigInt() {
100 binding.hrtimeBigInt();

Callers 15

constructorMethod · 0.85
runMethod · 0.85
postRunMethod · 0.85
clearExecutionTimeMethod · 0.85
postRunMethod · 0.85
runMethod · 0.85
createTestTreeFunction · 0.85
mainFunction · 0.85
loopFunction · 0.85
makeReqFunction · 0.85
loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…