X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=context.c;fp=context.c;h=9e4979fd1b6191e98d8d50f5a89f1ca37783b640;hb=43fa296375ee35d811b7fed4537312ce9d08feac;hp=284e4ae8d8e7ce246e37246fc616ad77b6d3713f;hpb=316481c29241d6ba004f644d4b0d3198b2a2ec3f;p=fips diff --git a/context.c b/context.c index 284e4ae..9e4979f 100644 --- a/context.c +++ b/context.c @@ -37,6 +37,7 @@ context_create (fips_api_t api, void *system_context_id) fips_dispatch_init (api); metrics_info_init (&ctx->metrics_info); + metrics_init (&ctx->metrics); return ctx; } @@ -68,49 +69,11 @@ void context_leave (void) { context_t *ctx = current_context; - timer_query_t *timer, *timer_next; - monitor_t *monitor, *monitor_next; if (ctx == NULL) return; - metrics_collect_available (); - - if (ctx->timer_begun_id) { - glEndQuery (GL_TIME_ELAPSED); - glDeleteQueries (1, &ctx->timer_begun_id); - ctx->timer_begun_id = 0; - } - - for (timer = ctx->timer_head; - timer; - timer = timer_next) - { - glDeleteQueries (1, &timer->id); - timer_next = timer->next; - free (timer); - } - ctx->timer_head = NULL; - ctx->timer_tail = NULL; - - if (ctx->monitor_begun_id) { - glEndPerfMonitorAMD (ctx->monitor_begun_id); - glDeletePerfMonitorsAMD (1, &ctx->monitor_begun_id); - ctx->monitor_begun_id = 0; - } - - for (monitor = ctx->monitor_head; - monitor; - monitor = monitor_next) - { - glDeletePerfMonitorsAMD (1, &monitor->id); - monitor_next = monitor->next; - free (monitor); - } - ctx->monitor_head = NULL; - ctx->monitor_tail = NULL; - - ctx->monitors_in_flight = 0; + metrics_fini (&ctx->metrics); } context_t *