perlin
[vg.git] / vg_profiler.h
index 944a5bb2a02155e571b9e0b1781bf31e3bce7a7d..5c0690c9186b6010a0ecee9515fc9528cc2397a0 100644 (file)
@@ -13,8 +13,8 @@ struct vg_profile
 {
    const char *name;
 
-   u64 samples[ VG_PROFILE_SAMPLE_COUNT ];
-   u32 buffer_count, buffer_current;
+   u64    samples[ VG_PROFILE_SAMPLE_COUNT ];
+   u32    buffer_count, buffer_current;
 
    enum profile_mode
    {
@@ -78,8 +78,8 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
    ui_fill_rect( panel, 0xa0000000 );
 
    assert( count <= 8 );
-   float avgs[8];
-   int   ptrs[8];
+   double avgs[8];
+   int    ptrs[8];
 
    for( int i=0; i<count; i++ )
    {
@@ -94,7 +94,7 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
 
    for( int i=0; i<VG_PROFILE_SAMPLE_COUNT-1; i++ )
    {
-      float total = 0.0f;
+      double total = 0.0;
 
       for( int j=0; j<count; j++ )
       {
@@ -103,9 +103,9 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
          if( ptrs[j] < 0 )
             ptrs[j] = VG_PROFILE_SAMPLE_COUNT-1;
 
-         float sample  = (double)profiles[j]->samples[ptrs[j]] * rate_mul,
-               px      = (total  / (budget)) * sw,
-               wx      = (sample / (budget)) * sw;
+         double sample  = (double)profiles[j]->samples[ptrs[j]] * rate_mul,
+                px      = (total  / (budget)) * sw,
+                wx      = (sample / (budget)) * sw;
 
          ui_rect block = { panel[0] + px, panel[1] + (float)i*sh,
                            wx,            sh };
@@ -120,6 +120,13 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
 
    char infbuf[64];
 
+   snprintf( infbuf, 64, "accuracy: %.7fms", rate_mul );
+   ui_text( (ui_rect){ panel[0] + 4,
+                       panel[1] + 0 * 14, 0, 0 }, 
+                       infbuf,
+                       1,
+                       k_text_align_left );
+
    for( int i=0; i<count; i++ )
    {
       snprintf( infbuf, 64, "%.4fms %s",