]> git.cworth.org Git - fips/commitdiff
stash: This adds the reset code, but to a bogusly hard-coded frame number reset-metrics
authorCarl Worth <cworth@cworth.org>
Fri, 1 Nov 2013 17:15:21 +0000 (10:15 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 1 Nov 2013 17:15:21 +0000 (10:15 -0700)
Needs to instead be attached to an environment variable or a
command-line option.

metrics.c

index 6e81fae4714753608b454f6968d6ef56c147cecb..ad73fe6e26202ae2d1785548fbe8ea1fe730997d 100644 (file)
--- a/metrics.c
+++ b/metrics.c
@@ -771,6 +771,38 @@ time_compare(const void *in_a, const void *in_b, void *arg unused)
        return 0;
 }
 
+static void
+op_metrics_reset (op_metrics_t *op)
+{
+       context_t *ctx = &current_context;
+       metrics_info_t *info = &ctx->metrics_info;
+       unsigned group_index, counter;
+       metrics_group_info_t *group;
+
+       op->time_ns = 0.0;
+
+       for (group_index = 0; group_index < info->num_groups; group_index++) {
+               group = &info->groups[group_index];
+               for (counter = 0; counter < group->num_counters; counter++)
+               {
+                       op->counters[group_index][counter] = 0.0;
+               }
+       }
+}
+
+static void
+reset_metrics (void)
+{
+       context_t *ctx = &current_context;
+       unsigned i;
+
+       for (i = 0; i < ctx->num_op_metrics; i++) {
+
+               op_metrics_reset (&ctx->op_metrics[i]);
+
+       }
+}
+
 static void
 print_program_metrics (void)
 {
@@ -1021,4 +1053,7 @@ metrics_end_frame (void)
 
                print_program_metrics ();
        }
+
+       if (frames == 208)
+               reset_metrics ();
 }