]> git.cworth.org Git - fips/blobdiff - metrics.c
Add xmalloc function
[fips] / metrics.c
index 327c270bd5dc002d9b65a91c223f1b0418cce20c..09083e639ab966d6e80c36845c8da3c76f447059 100644 (file)
--- 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)
 {