demo: support 100k+ frames in HUD

pull/296/head
nick black 5 years ago
parent 2cad2bbfd5
commit 24fc43fab5
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -286,7 +286,6 @@ summary_table(struct ncdirect* nc, const char* spec){
qprefix(results[i].timens, GIG, timebuf, 0);
qprefix(results[i].stats.render_ns, GIG, rtimebuf, 0);
bprefix(results[i].stats.render_bytes, 1, totalbuf, 0);
double avg = results[i].stats.render_ns / (double)results[i].stats.renders;
printf("%2zu│%c│%*ss│%6lu│%*s│ %*ss│%3ld│%7.1f│%7.1f║%s\n", i,
results[i].selector,
PREFIXSTRLEN, timebuf,
@ -295,8 +294,10 @@ summary_table(struct ncdirect* nc, const char* spec){
PREFIXSTRLEN, rtimebuf,
results[i].timens ?
results[i].stats.render_ns * 100 / results[i].timens : 0,
results[i].stats.renders / ((double)results[i].timens / GIG),
GIG / avg,
results[i].timens ?
results[i].stats.renders / ((double)results[i].timens / GIG) : 0.0,
results[i].stats.renders ?
GIG * (double)results[i].stats.renders / results[i].stats.render_ns : 0.0,
results[i].result < 0 ? "***FAILED" :
results[i].result > 0 ? "***ABORTED" :
!results[i].stats.renders ? "***SKIPPED" : "");
@ -316,8 +317,10 @@ summary_table(struct ncdirect* nc, const char* spec){
totalframes, BPREFIXSTRLEN, totalbuf, PREFIXSTRLEN, rtimebuf,
nsdelta ? totalrenderns * 100 / nsdelta : 0,
nsdelta ? totalframes / ((double)nsdelta / GIG) : 0);
ncdirect_fg_rgb8(nc, 0xff, 0xb0, 0xb0);
fflush(stdout); // in case we print to stderr below, we want color from above
if(failed){
fprintf(stderr, " Error running demo. Is \"%s\" the correct data path?\n", datadir);
fprintf(stderr, "\nError running demo. Is \"%s\" the correct data path?\n", datadir);
}
return failed;
}

@ -158,7 +158,7 @@ int hud_schedule(const char* demoname){
int plen = HUD_COLS - 4 - NSLEN;
while(e){
hook = &e->next;
if(ncplane_printf_yx(hud, line, 0, "%-5d %*ju.%02jus %-*.*s", e->frames,
if(ncplane_printf_yx(hud, line, 0, "%-6d %*ju.%02jus %-*.*s", e->frames,
NSLEN - 3, e->totalns / GIG,
(e->totalns % GIG) / (GIG / 100),
plen, plen, e->name) < 0){
@ -176,7 +176,7 @@ int hud_schedule(const char* demoname){
clock_gettime(CLOCK_MONOTONIC, &cur);
cure->startns = timespec_to_ns(&cur);
running = cure;
if(ncplane_printf_yx(hud, line, 0, "%-5d %*ju.%02jus %-*.*s", cure->frames,
if(ncplane_printf_yx(hud, line, 0, "%-6d %*ju.%02jus %-*.*s", cure->frames,
NSLEN - 3, cure->totalns / GIG,
(cure->totalns % GIG) / (GIG / 100),
plen, plen, cure->name) < 0){
@ -218,7 +218,7 @@ int demo_render(struct notcurses* nc){
clock_gettime(CLOCK_MONOTONIC, &ts);
uint64_t ns = timespec_to_ns(&ts) - running->startns;
++running->frames;
if(ncplane_printf_yx(hud, HUD_ROWS - 1, 0, "%-5d %*ju.%02jus %-*.*s",
if(ncplane_printf_yx(hud, HUD_ROWS - 1, 0, "%-6d %*ju.%02jus %-*.*s",
running->frames,
NSLEN - 3, ns / GIG, (ns % GIG) / (GIG / 100),
plen, plen, running->name) < 0){

Loading…
Cancel
Save