Node.js measure execution time
(Last Updated On: April 29, 2021)
nodejs에서 작업 걸린 시간재기
ms (microsecond)로 가져오기기
const newTimeStart = () => { return process.hrtime(); } const getTimeElapsed = (startHr) => { const now = process.hrtime(startHr); return Math.round((now[0] * 1000) + (now[1] / 1000000)); } let startTime = newTimeStart(); setTimeout(() => { console.log(getTimeElapsed(startTime)); }, 1000); // output : 1003