some timing info

This commit is contained in:
Florian Stecker 2019-01-07 10:48:21 +01:00
parent e631dee661
commit 80957d590e

View File

@ -611,7 +611,6 @@ int main()
DrawingContext *ctx = info->context;
ctx->matrix.xx = 837.930824;
ctx->matrix.xy = -712.651341;
ctx->matrix.x0 = 180.427716;
@ -638,17 +637,22 @@ int main()
return 0;
else if(result == STATUS_REDRAW) {
struct timeval current_time;
double start_time, intermediate_time, end_time;
gettimeofday(&current_time, 0);
double start_time = current_time.tv_sec + current_time.tv_usec*1e-6;
start_time = current_time.tv_sec + current_time.tv_usec*1e-6;
updateDimensions(info->context);
draw(info->context);
gettimeofday(&current_time, 0);
intermediate_time = current_time.tv_sec + current_time.tv_usec*1e-6;
cairo_set_source_surface(info->front_context, info->buffer_surface, 0, 0);
cairo_paint(info->front_context);
gettimeofday(&current_time, 0);
double end_time = current_time.tv_sec + current_time.tv_usec*1e-6;
printf("drawing finished in %g seconds\n", end_time - start_time);
end_time = current_time.tv_sec + current_time.tv_usec*1e-6;
printf("drawing finished in %.2f milliseconds, of which %.2f milliseconds were buffer switching\n", (end_time - start_time) * 1000, (end_time - intermediate_time) * 1000);
}
waitUpdateTimer(info);
}