-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
25 lines (24 loc) · 958 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var statsConsole = require("statsConsole");
// sample data format ["Name for Stat", variableForStat]
let myStats = [
["Creep Managers", CreepManagersCPUUsage],
["Towers", towersCPUUsage],
["Links", linksCPUUsage],
["Setup Roles", SetupRolesCPUUsage],
["Creeps", CreepsCPUUsage],
["Init", initCPUUsage],
["Stats", statsCPUUsage],
["Total", totalCPUUsage]
];
statsConsole.run(myStats); // Run Stats collection
if (totalTime > Game.cpu.limit) {
statsConsole.log("Tick: " + Game.time + " CPU OVERRUN: " + Game.cpu.getUsed().toFixed(2) + " Bucket:" + Game.cpu.bucket, 5);
}
if ((Game.time % 5) === 0) {
console.log(statsConsole.displayHistogram());
console.log(statsConsole.displayStats());
console.log(statsConsole.displayLogs());
//console.log(statsConsole.displayMaps()); // Don't use as it will consume ~30-40 CPU
totalTime = (Game.cpu.getUsed() - totalTime);
console.log("Time to Draw: " + totalTime.toFixed(2));
}