demo: plot by decisecond instead of second #1081

pull/1181/head
nick black 4 years ago
parent 2cb8295146
commit 8091e5c7e0
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -512,8 +512,8 @@ demo_nanosleep_abstime_ns(struct notcurses* nc, uint64_t deadline){
clock_gettime(CLOCK_MONOTONIC, &now);
while(deadline > timespec_to_ns(&now)){
fsleep.tv_sec = 0;
fsleep.tv_nsec = GIG / 10;
if(deadline - timespec_to_ns(&now) < GIG / 10){
fsleep.tv_nsec = GIG / 100;
if(deadline - timespec_to_ns(&now) < GIG / 100){
fsleep.tv_nsec = deadline - timespec_to_ns(&now);
}
ncinput ni;
@ -562,7 +562,7 @@ int demo_render(struct notcurses* nc){
if(!plot_hidden){
ncplane_move_top(ncuplot_plane(plot));
}
uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / GIG;
uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / (GIG / 10);
ncuplot_add_sample(plot, ns, 1);
}
if(menu){
@ -636,8 +636,8 @@ int fpsgraph_init(struct notcurses* nc){
memset(&opts, 0, sizeof(opts));
opts.flags = NCPLOT_OPTION_LABELTICKSD | NCPLOT_OPTION_EXPONENTIALD;
opts.gridtype = NCBLIT_BRAILLE;
opts.legendstyle = NCSTYLE_ITALIC;
opts.title = "frames per second";
opts.legendstyle = NCSTYLE_ITALIC | NCSTYLE_BOLD;
opts.title = "frames per decisecond";
channels_set_fg_rgb8(&opts.minchannels, 0x80, 0x80, 0xff);
channels_set_bg_rgb(&opts.minchannels, 0x201020);
channels_set_bg_alpha(&opts.minchannels, CELL_ALPHA_BLEND);

@ -159,11 +159,13 @@ reader_post(struct notcurses* nc, struct ncselector* selector, struct ncmultisel
return ret;
}
}while(cur < targ);
struct timespec fadedelay;
ns_to_timespec(timespec_to_ns(&demodelay) * 2, &fadedelay);
if(notcurses_canfade(nc)){
if(ncplane_fadeout(ncselector_plane(selector), &demodelay, demo_fader, NULL)){
if(ncplane_fadeout(ncselector_plane(selector), &fadedelay, demo_fader, NULL)){
return -1;
}
if(ncplane_fadeout(ncmultiselector_plane(mselector), &demodelay, demo_fader, NULL)){
if(ncplane_fadeout(ncmultiselector_plane(mselector), &fadedelay, demo_fader, NULL)){
return -1;
}
}

Loading…
Cancel
Save