Avoid globals
This commit is contained in:
parent
adb17b7ce4
commit
91f9a8a1c8
|
@ -141,7 +141,7 @@ const print_stats = {
|
|||
text += "JIT_CACHE_SIZE=" + cpu.wm.exports["jit_get_cache_size"]() + "\n";
|
||||
text += "FLAT_SEGMENTS=" + cpu.wm.exports["has_flat_segmentation"]() + "\n";
|
||||
|
||||
text += "do_many_cycles avg: " + (do_many_cycles_total / do_many_cycles_count || 0) + "\n";
|
||||
text += "do_many_cycles avg: " + (cpu.do_many_cycles_total / cpu.do_many_cycles_count || 0) + "\n";
|
||||
text += "wasm memory size: " + (cpu.wasm_memory.buffer.byteLength >> 20) + "m\n";
|
||||
|
||||
text += "Config:\n";
|
||||
|
|
13
src/cpu.js
13
src/cpu.js
|
@ -170,6 +170,12 @@ function CPU(bus, wm)
|
|||
|
||||
this.debug_init();
|
||||
|
||||
if(DEBUG)
|
||||
{
|
||||
this.do_many_cycles_count = 0;
|
||||
this.do_many_cycles_total = 0;
|
||||
}
|
||||
|
||||
//Object.seal(this);
|
||||
}
|
||||
|
||||
|
@ -1208,9 +1214,6 @@ CPU.prototype.do_run = function()
|
|||
}
|
||||
};
|
||||
|
||||
let do_many_cycles_count = 0;
|
||||
let do_many_cycles_total = 0;
|
||||
|
||||
CPU.prototype.do_many_cycles = function()
|
||||
{
|
||||
if(DEBUG)
|
||||
|
@ -1222,8 +1225,8 @@ CPU.prototype.do_many_cycles = function()
|
|||
|
||||
if(DEBUG)
|
||||
{
|
||||
do_many_cycles_total += v86.microtick() - start_time;
|
||||
do_many_cycles_count++;
|
||||
this.do_many_cycles_total += v86.microtick() - start_time;
|
||||
this.do_many_cycles_count++;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue