#ifndef VG_PROFILER_H
#define VG_PROFILER_H
+#define VG_GAME
#include "vg.h"
#include "vg_platform.h"
{
const char *name;
- u32 samples[ VG_PROFILE_SAMPLE_COUNT ];
+ u64 samples[ VG_PROFILE_SAMPLE_COUNT ];
u32 buffer_count, buffer_current;
enum profile_mode
if( profile->buffer_current >= VG_PROFILE_SAMPLE_COUNT )
profile->buffer_current = 0;
- profile->samples[ profile->buffer_current ] = 0.0f;
+ profile->samples[ profile->buffer_current ] = 0;
}
VG_STATIC void vg_profile_end( struct vg_profile *profile )
{
- u64 time_end;
-
- time_end = SDL_GetPerformanceCounter();
- u64 delta = profile->start - time_end;
+ u64 time_end = SDL_GetPerformanceCounter(),
+ delta = time_end - profile->start;
if( profile->mode == k_profile_mode_frame )
{
u32 colours[] = { 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000,
0xffff00ff, 0xffffff00 };
- float rate_mul = 1.0f / (float)SDL_GetPerformanceFrequency();
+ double rate_mul = 1000.0 / (double)SDL_GetPerformanceFrequency();
for( int i=0; i<VG_PROFILE_SAMPLE_COUNT-1; i++ )
{
if( ptrs[j] < 0 )
ptrs[j] = VG_PROFILE_SAMPLE_COUNT-1;
- float sample = (float)profiles[j]->samples[ptrs[j]] * rate_mul,
+ float sample = (double)profiles[j]->samples[ptrs[j]] * rate_mul,
px = (total / (budget)) * sw,
wx = (sample / (budget)) * sw;