Skip to content

Commit

Permalink
Make benchmark driver properly report playback status
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Dec 10, 2023
1 parent e6e9fde commit 66e8262
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/driver/benchmark.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import parseAsciicast from '../parser/asciicast';


function benchmark({ url, iterations = 10 }, { feed, now }) {
function benchmark({ url, iterations = 10 }, { feed, setState, now }) {
let data;
let byteCount = 0;

Expand Down Expand Up @@ -38,8 +38,10 @@ function benchmark({ url, iterations = 10 }, { feed, now }) {
const duration = (endTime - startTime) / 1000;
const throughput = (byteCount * iterations) / duration;
const throughputMbs = (byteCount / (1024 * 1024) * iterations) / duration;

console.info('benchmark: result', { byteCount, iterations, duration, throughput, throughputMbs });
setTimeout(() => { setState('stopped', { reason: 'ended' }); }, 0);

return true;
}
}
}
Expand Down

0 comments on commit 66e8262

Please sign in to comment.