1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

feat: use console.time in all places

Remove `microtime` and console log in favour of `console.time`
This commit is contained in:
Tomas Chmelevskij 2021-02-14 07:25:19 +01:00
parent cb0d9f3a66
commit 934e648e18
3 changed files with 6 additions and 7 deletions

View file

@ -86,8 +86,10 @@ function generateData(firmware, input, startAddress) {
firmware.bytes_total += input.length;
}
const CONFIG_LABEL = `Custom defaults inserted in`;
ConfigInserter.prototype.insertConfig = function (firmware, input) {
const timeParsingStart = microtime(); // track time
console.time(CONFIG_LABEL);
const customDefaultsArea = getCustomDefaultsArea(firmware);
@ -99,7 +101,7 @@ ConfigInserter.prototype.insertConfig = function (firmware, input) {
generateData(firmware, input, customDefaultsArea.startAddress);
console.log(`Custom defaults inserted in: ${microtime() - timeParsingStart.toFixed(4)} seconds.`);
console.timeEnd(CONFIG_LABEL);
return true;
}

View file

@ -1,9 +1,5 @@
import semver from "semver";
export function microtime() {
return new Date().getTime() / 1000;
}
export function millitime() {
return new Date().getTime();
}
@ -85,3 +81,4 @@ window.degToRad = degToRad;
window.bytesToSize = bytesToSize;
window.checkChromeRuntimeError = checkChromeRuntimeError;
window.generateVirtualApiVersions = generateVirtualApiVersions;
window.millitime = millitime;

View file

@ -96,7 +96,7 @@ function read_hex_file(data) {
const TIME_LABEL = 'HEX_PARSER - File parsed in';
onmessage = function(event) {
console.time(TIME_LABEL)
console.time(TIME_LABEL);
read_hex_file(event.data);