Remove ENABLE_PROFILER (is configured via cargo.toml)

This commit is contained in:
Fabian 2020-12-31 19:14:30 -06:00
parent ee542c5f84
commit 693b905013
4 changed files with 20 additions and 22 deletions

View file

@ -1294,27 +1294,27 @@
if(DEBUG)
{
debug_start(emulator);
}
const CLEAR_STATS = false;
if(emulator.v86.cpu.wm.exports["profiler_is_enabled"]())
{
const CLEAR_STATS = false;
var panel = document.createElement("pre");
document.body.appendChild(panel);
var panel = document.createElement("pre");
document.body.appendChild(panel);
if(ENABLE_PROFILER)
{
setInterval(function()
{
if(!emulator.is_running())
setInterval(function()
{
return;
}
if(!emulator.is_running())
{
return;
}
const text = print_stats.stats_to_string(emulator.v86.cpu);
panel.textContent = text;
const text = print_stats.stats_to_string(emulator.v86.cpu);
panel.textContent = text;
CLEAR_STATS && emulator.v86.cpu.wm.exports["_profiler_init"]();
}, CLEAR_STATS ? 5000 : 1000);
CLEAR_STATS && emulator.v86.cpu.wm.exports["_profiler_init"]();
}, CLEAR_STATS ? 5000 : 1000);
}
}
init_ui(settings, emulator);

View file

@ -9,11 +9,6 @@
*/
var DEBUG = true;
/** @const
* Also needs to be set in cargo.toml
*/
var ENABLE_PROFILER = false;
/** @const */
var LOG_TO_FILE = false;

View file

@ -1352,14 +1352,14 @@ let do_many_cycles_total = 0;
CPU.prototype.do_many_cycles = function()
{
if(ENABLE_PROFILER)
if(DEBUG)
{
var start_time = v86.microtick();
}
this.do_many_cycles_native();
if(ENABLE_PROFILER)
if(DEBUG)
{
do_many_cycles_total += v86.microtick() - start_time;
do_many_cycles_count++;

View file

@ -101,5 +101,8 @@ pub fn profiler_stat_get(stat: stat) -> f64 {
}
}
#[no_mangle]
pub fn profiler_is_enabled() -> bool { cfg!(feature = "profiler") }
#[no_mangle]
pub fn profiler_stat_increment_do_run() { stat_increment(stat::DO_RUN); }