remove spurious profiling lines

This commit is contained in:
John Alanbrook 2024-07-25 08:38:10 -05:00
parent cb6f64925e
commit 55ae7e2171
6 changed files with 19 additions and 18 deletions

View file

@ -211,16 +211,6 @@ debug.api.print_doc = function(name)
return mdoc; return mdoc;
} }
debug.log = {};
debug.log.time = function(fn, name, avg=0)
{
debug.log.time[name] ??= [];
var start = profile.now();
fn();
debug.log.time[name].push(profile.now()-start);
}
debug.kill = function() debug.kill = function()
{ {
assert = function() {}; assert = function() {};

View file

@ -652,6 +652,8 @@ prosperon.touchrelease = function (touches) {};
prosperon.touchmove = function (touches) {}; prosperon.touchmove = function (touches) {};
prosperon.clipboardpaste = function (str) {}; prosperon.clipboardpaste = function (str) {};
prosperon.quit = function () { prosperon.quit = function () {
if (profile.disabled) return;
say("===START CACHE REPORTS===\n"); say("===START CACHE REPORTS===\n");
for (var i in profile.report_cache) { for (var i in profile.report_cache) {
say(profile.printreport(profile.report_cache[i],i)); say(profile.printreport(profile.report_cache[i],i));
@ -662,10 +664,6 @@ prosperon.quit = function () {
say("\n"); say("\n");
profile.print_cpu_instr(); profile.print_cpu_instr();
console.info("QUITTING");
for (var i in debug.log.time)
say(debug.log.time[i].map((x) => profile.ms(x)));
}; };
window.size = [640, 480]; window.size = [640, 480];

View file

@ -176,3 +176,12 @@ profile.printreport = function (cache, name) {
return report; return report;
}; };
var null_fn = function(){};
profile.disable = function()
{
profile.gather_stop();
profile.frame = null_fn;
profile.endframe = null_fn;
profile.disabled = true;
}

View file

@ -194,7 +194,7 @@ render.make_shader = function(shader)
} }
} }
profile.report(st, `CACHE make shader from ${file}`); profile.addreport("shader [cached]", file, st);
var shaderobj = json.decode(io.slurp(writejson)); var shaderobj = json.decode(io.slurp(writejson));
var obj = shaderobj[os.sys()]; var obj = shaderobj[os.sys()];
obj.pipe = render.pipeline(obj); obj.pipe = render.pipeline(obj);
@ -310,7 +310,7 @@ render.make_shader = function(shader)
compiled.files = files; compiled.files = files;
io.slurpwrite(writejson, json.encode(compiled)); io.slurpwrite(writejson, json.encode(compiled));
profile.report(st, `make shader from ${file}`); profile.addreport('shader', file, st);
var obj = compiled[os.sys()]; var obj = compiled[os.sys()];
obj.pipe = render.pipeline(obj); obj.pipe = render.pipeline(obj);

View file

@ -104,7 +104,6 @@ struct sFont *MakeFont(const char *fontfile, int height) {
newfont->descent = descent*emscale; newfont->descent = descent*emscale;
newfont->linegap = linegap*emscale; newfont->linegap = linegap*emscale;
newfont->linegap = ((newfont->ascent - newfont->descent) - newfont->linegap); newfont->linegap = ((newfont->ascent - newfont->descent) - newfont->linegap);
printf("newfont : %g, %g, %g\n", newfont->ascent, newfont->descent, newfont->linegap);
newfont->texture = malloc(sizeof(texture)); newfont->texture = malloc(sizeof(texture));
newfont->texture->id = sg_make_image(&(sg_image_desc){ newfont->texture->id = sg_make_image(&(sg_image_desc){

View file

@ -1327,10 +1327,15 @@ JSC_CCALL(profile_gather_rate,
JS_SetInterruptRate(js2number(argv[0])); JS_SetInterruptRate(js2number(argv[0]));
) )
JSC_CCALL(profile_gather_stop,
JS_SetInterruptHandler(rt,NULL,NULL,10000);
)
static const JSCFunctionListEntry js_profile_funcs[] = { static const JSCFunctionListEntry js_profile_funcs[] = {
MIST_FUNC_DEF(profile,now,0), MIST_FUNC_DEF(profile,now,0),
MIST_FUNC_DEF(profile,gather,2), MIST_FUNC_DEF(profile,gather,2),
MIST_FUNC_DEF(profile,gather_rate,1) MIST_FUNC_DEF(profile,gather_rate,1),
MIST_FUNC_DEF(profile,gather_stop,0),
}; };
JSC_SCALL(io_exists, ret = boolean2js(fexists(str))) JSC_SCALL(io_exists, ret = boolean2js(fexists(str)))