INNER CODE UNIT · JavaScript
statsForEvent
puppeteer/examples · code_coverage.js:221
const statsForEvent = eventStatsForUrl.filter(stat => stat.eventType === event)[0];
// TODO: need to sum max totalBytes. Currently ignores stats if event didn't
// have an entry. IOW, all total numerators should be max totalBytes seen for that event.
if (statsForEvent) {
totalBytes += statsForEvent.totalBytes;
totalUsedBytes += statsForEvent.usedBytes;
}
});
const percentUsed = Math.round(totalUsedBytes / totalBytes * 100);
console.log(`Total used @ ${chalk.magenta(event)}: ${formatBytesToKB(totalUsedBytes)}/${formatBytesToKB(totalBytes)} (${percentUsed}%)`);
});
})();