projects
/
vg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
heisenbug
[vg.git]
/
src
/
vg
/
vg_profiler.h
diff --git
a/src/vg/vg_profiler.h
b/src/vg/vg_profiler.h
index 6c9530c07dc36cc7ce298aa9313136a4598d9275..fded3302523be9442f8c161b62e4df5b42d7241c 100644
(file)
--- a/
src/vg/vg_profiler.h
+++ b/
src/vg/vg_profiler.h
@@
-1,7
+1,6
@@
#ifndef VG_PROFILER_H
#define VG_PROFILER_H
#ifndef VG_PROFILER_H
#define VG_PROFILER_H
-#include <alloca.h>
#include "vg_platform.h"
#define VG_PROFILE_SAMPLE_COUNT 128
#include "vg_platform.h"
#define VG_PROFILE_SAMPLE_COUNT 128
@@
-25,12
+24,12
@@
struct vg_profile
struct timespec start;
};
struct timespec start;
};
-
static
void vg_profile_begin( struct vg_profile *profile )
+
VG_STATIC
void vg_profile_begin( struct vg_profile *profile )
{
clock_gettime( CLOCK_REALTIME, &profile->start );
}
{
clock_gettime( CLOCK_REALTIME, &profile->start );
}
-
static
void vg_profile_increment( struct vg_profile *profile )
+
VG_STATIC
void vg_profile_increment( struct vg_profile *profile )
{
profile->buffer_current ++;
{
profile->buffer_current ++;
@@
-43,7
+42,7
@@
static void vg_profile_increment( struct vg_profile *profile )
profile->samples[ profile->buffer_current ] = 0.0f;
}
profile->samples[ profile->buffer_current ] = 0.0f;
}
-
static
void vg_profile_end( struct vg_profile *profile )
+
VG_STATIC
void vg_profile_end( struct vg_profile *profile )
{
struct timespec time_end;
{
struct timespec time_end;
@@
-62,7
+61,7
@@
static void vg_profile_end( struct vg_profile *profile )
}
}
}
}
-
static
void vg_profile_drawn( struct vg_profile **profiles, u32 count,
+
VG_STATIC
void vg_profile_drawn( struct vg_profile **profiles, u32 count,
float budget, ui_rect panel, u32 colour_offset )
{
if( !vg_profiler )
float budget, ui_rect panel, u32 colour_offset )
{
if( !vg_profiler )
@@
-77,8
+76,11
@@
static void vg_profile_drawn( struct vg_profile **profiles, u32 count,
float sh = panel[3] / VG_PROFILE_SAMPLE_COUNT,
sw = panel[2];
float sh = panel[3] / VG_PROFILE_SAMPLE_COUNT,
sw = panel[2];
- float *avgs = alloca( count * sizeof(float) );
- int *ptrs = alloca( count * sizeof(int) );
+ ui_fill_rect( panel, 0xa0000000 );
+
+ assert( count <= 8 );
+ float avgs[8];
+ int ptrs[8];
for( int i=0; i<count; i++ )
{
for( int i=0; i<count; i++ )
{
@@
-101,14
+103,14
@@
static void vg_profile_drawn( struct vg_profile **profiles, u32 count,
ptrs[j] = VG_PROFILE_SAMPLE_COUNT-1;
float sample = profiles[j]->samples[ptrs[j]],
ptrs[j] = VG_PROFILE_SAMPLE_COUNT-1;
float sample = profiles[j]->samples[ptrs[j]],
- px = (total / (budget
*0.25f
)) * sw,
- wx = (sample / (budget
*0.25f
)) * sw;
+ px = (total / (budget)) * sw,
+ wx = (sample / (budget)) * sw;
ui_rect block = { panel[0] + px, panel[1] + (float)i*sh,
wx, sh };
u32 colour = colours[ (j+colour_offset) % vg_list_size(colours) ];
ui_rect block = { panel[0] + px, panel[1] + (float)i*sh,
wx, sh };
u32 colour = colours[ (j+colour_offset) % vg_list_size(colours) ];
- ui_fill_rect(
&ui_global_ctx,
block, colour );
+ ui_fill_rect( block, colour );
total += sample;
avgs[j] += sample;
total += sample;
avgs[j] += sample;
@@
-123,15
+125,15
@@
static void vg_profile_drawn( struct vg_profile **profiles, u32 count,
avgs[i] * (1.0f/(VG_PROFILE_SAMPLE_COUNT-1)),
profiles[i]->name );
avgs[i] * (1.0f/(VG_PROFILE_SAMPLE_COUNT-1)),
profiles[i]->name );
- ui_text(
&ui_global_ctx,
(ui_rect){ panel[0] + panel[2] + 4,
-
panel[1] + i * 14, 0, 0 },
-
infbuf,
-
1,
-
k_text_align_left );
+ ui_text( (ui_rect){ panel[0] + panel[2] + 4,
+ panel[1] + i * 14, 0, 0 },
+ infbuf,
+ 1,
+ k_text_align_left );
}
}
}
}
-
static
void vg_profiler_init(void)
+
VG_STATIC
void vg_profiler_init(void)
{
vg_convar_push( (struct vg_convar){
.name = "vg_profiler",
{
vg_convar_push( (struct vg_convar){
.name = "vg_profiler",