X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=metrics.c;h=09083e639ab966d6e80c36845c8da3c76f447059;hb=917ee542ec53e422b189023c681478780761af81;hp=327c270bd5dc002d9b65a91c223f1b0418cce20c;hpb=61b4545d541527ca2bd76811195b964595db7ed1;p=fips diff --git a/metrics.c b/metrics.c index 327c270..09083e6 100644 --- a/metrics.c +++ b/metrics.c @@ -29,6 +29,7 @@ #include "fips-dispatch-gl.h" #include "metrics.h" +#include "xmalloc.h" typedef struct counter { @@ -116,11 +117,7 @@ metrics_counter_start (void) { counter_t *counter; - counter = malloc (sizeof(counter_t)); - if (counter == NULL) { - fprintf (stderr, "Out of memory\n"); - exit (1); - } + counter = xmalloc (sizeof(counter_t)); glGenQueries (1, &counter->id); @@ -150,6 +147,12 @@ metrics_set_current_op (metrics_op_t op) current_context.op = op; } +metrics_op_t +metrics_get_current_op (void) +{ + return current_context.op; +} + static void accumulate_program_time (metrics_op_t op, unsigned time_ns) {