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,15 +1294,14 @@
if(DEBUG) if(DEBUG)
{ {
debug_start(emulator); debug_start(emulator);
}
if(emulator.v86.cpu.wm.exports["profiler_is_enabled"]())
{
const CLEAR_STATS = false; const CLEAR_STATS = false;
var panel = document.createElement("pre"); var panel = document.createElement("pre");
document.body.appendChild(panel); document.body.appendChild(panel);
if(ENABLE_PROFILER)
{
setInterval(function() setInterval(function()
{ {
if(!emulator.is_running()) if(!emulator.is_running())
@ -1316,6 +1315,7 @@
CLEAR_STATS && emulator.v86.cpu.wm.exports["_profiler_init"](); CLEAR_STATS && emulator.v86.cpu.wm.exports["_profiler_init"]();
}, CLEAR_STATS ? 5000 : 1000); }, CLEAR_STATS ? 5000 : 1000);
} }
}
init_ui(settings, emulator); init_ui(settings, emulator);

View file

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

View file

@ -1352,14 +1352,14 @@ let do_many_cycles_total = 0;
CPU.prototype.do_many_cycles = function() CPU.prototype.do_many_cycles = function()
{ {
if(ENABLE_PROFILER) if(DEBUG)
{ {
var start_time = v86.microtick(); var start_time = v86.microtick();
} }
this.do_many_cycles_native(); this.do_many_cycles_native();
if(ENABLE_PROFILER) if(DEBUG)
{ {
do_many_cycles_total += v86.microtick() - start_time; do_many_cycles_total += v86.microtick() - start_time;
do_many_cycles_count++; 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] #[no_mangle]
pub fn profiler_stat_increment_do_run() { stat_increment(stat::DO_RUN); } pub fn profiler_stat_increment_do_run() { stat_increment(stat::DO_RUN); }