dusting
[vg.git] / vg_profiler.h
index 5c0690c9186b6010a0ecee9515fc9528cc2397a0..ca79e18d0bf77df3da6421de40176b916ff83d5c 100644 (file)
@@ -49,13 +49,11 @@ VG_STATIC void vg_profile_end( struct vg_profile *profile )
    u64 time_end = SDL_GetPerformanceCounter(),
        delta    = time_end - profile->start;
 
-   if( profile->mode == k_profile_mode_frame )
-   {
+   if( profile->mode == k_profile_mode_frame ){
       profile->samples[ profile->buffer_current ] = delta;
       vg_profile_increment( profile );
    }
-   else
-   {
+   else{
       profile->samples[ profile->buffer_current ] += delta;
    }
 }
@@ -81,8 +79,7 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
    double avgs[8];
    int    ptrs[8];
 
-   for( int i=0; i<count; i++ )
-   {
+   for( int i=0; i<count; i++ ){
       ptrs[i] = profiles[i]->buffer_current;
       avgs[i] = 0.0f;
    }
@@ -92,12 +89,10 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
 
    double rate_mul = 1000.0 / (double)SDL_GetPerformanceFrequency();
 
-   for( int i=0; i<VG_PROFILE_SAMPLE_COUNT-1; i++ )
-   {
+   for( int i=0; i<VG_PROFILE_SAMPLE_COUNT-1; i++ ){
       double total = 0.0;
 
-      for( int j=0; j<count; j++ )
-      {
+      for( int j=0; j<count; j++ ){
          ptrs[j] --;
 
          if( ptrs[j] < 0 )
@@ -127,8 +122,7 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
                        1,
                        k_text_align_left );
 
-   for( int i=0; i<count; i++ )
-   {
+   for( int i=0; i<count; i++ ){
       snprintf( infbuf, 64, "%.4fms %s", 
                         avgs[i] * (1.0f/(VG_PROFILE_SAMPLE_COUNT-1)),
                         profiles[i]->name );
@@ -143,13 +137,7 @@ VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
 
 VG_STATIC void vg_profiler_init(void)
 {
-   vg_var_push( (struct vg_var){
-      .name = "vg_profiler",
-      .data = &vg_profiler,
-      .data_type = k_var_dtype_i32,
-      .opt_i32 = { .min=0, .max=1, .clamp=1 },
-      .persistent = 1
-   });
+   VG_VAR_I32( vg_profiler, flags=VG_VAR_PERSISTENT );
 }
 
 #endif /* VG_PROFILER_H */