- for (i = 0; i < ctx->num_program_metrics; i++) {
- if (ctx->program_metrics[i].ticks == 0.0)
- continue;
- printf ("Program %d:\t%7.2f mega-ticks\n",
- i, ctx->program_metrics[i].ticks / 1e6);
- }
-}
-
-void
-glwrap_end_frame (void)
-{
- static int initialized = 0;
- static int frames;
- static struct timeval tv_start, tv_now;
-
- if (! initialized) {
- frames = 0;
- gettimeofday (&tv_start, NULL);
- initialized = 1;
- }
-
-
- frames++;
-
- if (frames % 60 == 0) {
- double fps;
- gettimeofday (&tv_now, NULL);
-
- fps = (double) frames / (tv_now.tv_sec - tv_start.tv_sec +
- (tv_now.tv_usec - tv_start.tv_usec) / 1.0e6);
-
- printf("FPS: %.3f\n", fps);
-
- print_program_metrics ();
- }
-
- /* Consume all counters that are ready. */
- counter_t *counter = current_context.counter_head;
-
- while (counter) {
- GLint available;
- GLuint elapsed;
-
- glGetQueryObjectiv (counter->id, GL_QUERY_RESULT_AVAILABLE,
- &available);
- if (! available)
- break;
-
- glGetQueryObjectuiv (counter->id, GL_QUERY_RESULT, &elapsed);
-
- accumulate_program_ticks (counter->program, elapsed);
-
- current_context.counter_head = counter->next;
- if (current_context.counter_head == NULL)
- current_context.counter_tail = NULL;
-
- glDeleteQueries (1, &counter->id);
-
- free (counter);
- counter = current_context.counter_head;
- }