imlib2_load: Show load time per load too

This commit is contained in:
Kim Woelders 2022-03-29 06:50:39 +02:00
parent ac0d69863b
commit 4892864735
1 changed files with 8 additions and 1 deletions

View File

@ -94,6 +94,7 @@ main(int argc, char **argv)
Imlib_Image im; Imlib_Image im;
int err; int err;
unsigned int t0; unsigned int t0;
double dt;
char nbuf[4096]; char nbuf[4096];
int frame; int frame;
int verbose; int verbose;
@ -164,6 +165,8 @@ main(int argc, char **argv)
imlib_context_set_progress_granularity(10); imlib_context_set_progress_granularity(10);
} }
if (load_cnt < 0)
load_cnt = 1;
t0 = 0; t0 = 0;
for (; argc > 0; argc--, argv++) for (; argc > 0; argc--, argv++)
@ -217,7 +220,11 @@ main(int argc, char **argv)
} }
if (show_time) if (show_time)
printf("Elapsed time: %.3f ms\n", 1e-3 * (time_us() - t0)); {
dt = 1e-3 * (time_us() - t0);
printf("Elapsed time: %.3f ms (%.3f ms per load)\n",
dt, dt / load_cnt);
}
if (check_progress && !progress_called) if (check_progress && !progress_called)
{ {