Skip to content

Commit

Permalink
Stop timer logging
Browse files Browse the repository at this point in the history
  • Loading branch information
estherkim committed Feb 15, 2019
1 parent 4b63cd7 commit cdfd719
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build-system/pr-check/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function main() {
'not affect the runtime, build system, or test files');
}

stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function main() {
}
}

stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/dist-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function main() {
}
}

stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/local-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function main() {
}
}

stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/remote-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function main() {
}

stopSauceConnect(FILENAME);
stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down
7 changes: 4 additions & 3 deletions build-system/pr-check/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,16 @@ function startTimer(functionName, fileName) {
/**
* Stops the timer for the given function and prints the execution time.
* @param {string} functionName
* @param {string} fileName
* @param {DOMHighResTimeStamp} startTime
* @return {number}
*/
function stopTimer(functionName, startTime) {
function stopTimer(functionName, fileName, startTime) {
const endTime = Date.now();
const executionTime = new Date(endTime - startTime);
const mins = executionTime.getMinutes();
const secs = executionTime.getSeconds();
const fileLogPrefix = colors.bold(colors.yellow(`${functionName}:`));
const fileLogPrefix = colors.bold(colors.yellow(`${fileName}:`));
console.log(
fileLogPrefix, 'Done running', colors.cyan(functionName),
'Total time:', colors.green(mins + 'm ' + secs + 's'));
Expand All @@ -135,7 +136,7 @@ function timedExec(cmd) {
function timedExecOrDie(cmd, fileName = 'utils.js') {
const startTime = startTimer(cmd, fileName);
execOrDie(cmd);
stopTimer(cmd, startTime);
stopTimer(cmd, fileName, startTime);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/validator-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function main() {
'not affect the validator or validator web UI.');
}

stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/visual-diff-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function main() {
}
}

stopTimer(FILENAME, startTime);
stopTimer(FILENAME, FILENAME, startTime);
return 0;
}

Expand Down

0 comments on commit cdfd719

Please sign in to comment.