X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=metrics.c;h=ad7ea3a330cc27b6354e13a8070209b0b406bd13;hb=refs%2Fheads%2Fframe-timings;hp=8f961331707569e0759bb635e3826af94bb1697a;hpb=f450c677e794d6bc46409332c8515e64977f1eb7;p=fips diff --git a/metrics.c b/metrics.c index 8f96133..ad7ea3a 100644 --- a/metrics.c +++ b/metrics.c @@ -185,7 +185,6 @@ metrics_fini (metrics_t *metrics) /* Discard and cleanup any outstanding queries. */ if (metrics->timer_begun_id) { - glEndQuery (GL_TIME_ELAPSED); glDeleteQueries (1, &metrics->timer_begun_id); metrics->timer_begun_id = 0; } @@ -204,7 +203,6 @@ metrics_fini (metrics_t *metrics) if (metrics->info->have_perfmon) { if (metrics->monitor_begun_id) { - glEndPerfMonitorAMD (metrics->monitor_begun_id); glDeletePerfMonitorsAMD (1, &metrics->monitor_begun_id); metrics->monitor_begun_id = 0; } @@ -560,6 +558,7 @@ print_per_stage_metrics (metrics_t *metrics, const char *op_string; unsigned group_index, counter; double value; + int program_name_length = 0; /* Don't print anything for stages with no alloted time. */ if (per_stage->time_ns == 0.0) @@ -567,13 +566,29 @@ print_per_stage_metrics (metrics_t *metrics, op_string = metrics_op_string (op_metrics->op); - printf ("%21s", op_string); - if (op_metrics->op >= METRICS_OP_SHADER) { - printf (" %3d", op_metrics->op - METRICS_OP_SHADER); - } else { - printf (" "); + int program = op_metrics->op - METRICS_OP_SHADER; + glGetObjectLabel (GL_PROGRAM, program, 0, + &program_name_length, NULL); + if (program_name_length) { + char *program_name; + + program_name = malloc(program_name_length + 1); + if (program_name == 0) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + glGetObjectLabel (GL_PROGRAM, program, + program_name_length + 1, + NULL, program_name); + printf ("%21s ", program_name); + } else { + printf ("%21s %3d", op_string, program); + } + } + else { + printf ("%21s ", op_string); } if (per_stage->stage) @@ -929,7 +944,7 @@ metrics_end_frame_post_swap (metrics_t *metrics) frames++; - if (frames % 15 == 0) { + if (frames) { double fps; gettimeofday (&tv_now, NULL);