util: move os_time.[ch] to src/util
[mesa.git] / src / gallium / auxiliary / hud / hud_fps.c
index 80381f54713550f13c07372aead503aae993e010..aecbaf0f6b48d8ac56b91c14d42b632be77a4fcf 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include "hud/hud_private.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_memory.h"
 
 struct fps_info {
@@ -47,7 +47,7 @@ query_fps(struct hud_graph *gr)
 
    if (info->last_time) {
       if (info->last_time + gr->pane->period <= now) {
-         double fps = (uint64_t)info->frames * 1000000 /
+         double fps = ((uint64_t)info->frames) * 1000000 /
                       (double)(now - info->last_time);
          info->frames = 0;
          info->last_time = now;
@@ -60,6 +60,12 @@ query_fps(struct hud_graph *gr)
    }
 }
 
+static void
+free_query_data(void *p)
+{
+   FREE(p);
+}
+
 void
 hud_fps_graph_install(struct hud_pane *pane)
 {
@@ -76,7 +82,11 @@ hud_fps_graph_install(struct hud_pane *pane)
    }
 
    gr->query_new_value = query_fps;
-   gr->free_query_data = free;
+
+   /* Don't use free() as our callback as that messes up Gallium's
+    * memory debugger.  Use simple free_query_data() wrapper.
+    */
+   gr->free_query_data = free_query_data;
 
    hud_pane_add_graph(pane, gr);
 }