added spacing debugging

This commit is contained in:
Miodec 2022-02-03 12:44:51 +01:00
parent 60d35a2a45
commit 029a17cf4d
3 changed files with 40 additions and 0 deletions

View file

@ -19,3 +19,5 @@ global.enableTimerDebug = TestTimer.enableTimerDebug;
global.getTimerStats = TestTimer.getTimerStats;
global.toggleUnsmoothedRaw = Result.toggleUnsmoothedRaw;
global.enableSpacingDebug = TestStats.enableSpacingDebug;

View file

@ -703,6 +703,14 @@ $(document).keydown((event) => {
return;
}
if (TestStats.spacingDebug)
console.log(
"spacing debug",
"keypress",
event.key,
"length",
TestStats.keypressTimings.spacing.array.length
);
TestStats.recordKeypressSpacing();
TestStats.setKeypressDuration(performance.now());
TestStats.setKeypressNotAfk();

View file

@ -42,6 +42,12 @@ export let keypressTimings = {
},
};
export let spacingDebug = false;
export function enableSpacingDebug() {
spacingDebug = true;
console.clear();
}
export function getStats() {
let ret = {
start,
@ -295,8 +301,31 @@ export function recordKeypressSpacing() {
let diff = Math.abs(keypressTimings.spacing.current - now);
if (keypressTimings.spacing.current !== -1) {
pushKeypressSpacing(diff);
if (spacingDebug)
console.log(
"spacing debug",
"push",
diff,
"length",
keypressTimings.spacing.array.length
);
}
setKeypressSpacing(now);
if (spacingDebug)
console.log(
"spacing debug",
"set",
now,
"length",
keypressTimings.spacing.array.length
);
if (spacingDebug)
console.log(
"spacing debug",
"recorded",
"length",
keypressTimings.spacing.array.length
);
}
export function resetKeypressTimings() {
@ -310,6 +339,7 @@ export function resetKeypressTimings() {
array: [],
},
};
if (spacingDebug) console.clear();
}
export function pushMissedWord(word) {