MCPcopy
hub / github.com/ampproject/amphtml / stopTimer

Function stopTimer

build-system/pr-check/utils.js:144–157  ·  view source on GitHub ↗

* Stops the timer for the given job / command and prints the execution time. * @param {string} jobNameOrCmd * @param {DOMHighResTimeStamp} startTime

(jobNameOrCmd, startTime)

Source from the content-addressed store, hash-verified

142 * @param {DOMHighResTimeStamp} startTime
143 */
144function stopTimer(jobNameOrCmd, startTime) {
145 const endTime = Date.now();
146 const executionTime = endTime - startTime;
147 const mins = Math.floor(executionTime / 60000);
148 const secs = Math.floor((executionTime % 60000) / 1000);
149 const loggingPrefix = getLoggingPrefix();
150 logWithoutTimestamp(
151 loggingPrefix,
152 'Done running',
153 cyan(jobNameOrCmd),
154 'Total time:',
155 green(mins + 'm ' + secs + 's')
156 );
157}
158
159/**
160 * Aborts the process after stopping the timer for a given job

Callers 6

runReleaseJobFunction · 0.85
runCiJobFunction · 0.85
abortTimedJobFunction · 0.85
timedExecFnFunction · 0.85
runCheckFunction · 0.85
prCheckFunction · 0.85

Calls 5

getLoggingPrefixFunction · 0.85
logWithoutTimestampFunction · 0.85
cyanFunction · 0.85
greenFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected