52#ifndef __JO_PROFILE_H__
53# define __JO_PROFILE_H__
107# define JO_PROFILE_USER(N) ((jo_profile_slot)(JO_PROFILE_FIRST_USER + (N)))
110# define JO_PROFILE_FRAMES (32)
112#ifdef JO_COMPILE_WITH_PROFILER_SUPPORT
123extern jo_profile_cpu __jo_profile_cpu[2];
136 __asm__
volatile (
"stc sr, %0" :
"=r" (sr) : :
"memory");
137 __asm__
volatile (
"ldc %0, sr" : :
"r" (sr | 0xF0) :
"memory");
138 high = *(
volatile unsigned char *)0xFFFFFE12;
139 low = *(
volatile unsigned char *)0xFFFFFE13;
140 __asm__
volatile (
"ldc %0, sr" : :
"r" (sr) :
"memory");
141 return ((high << 8) | low);
154 __asm__
volatile (
"mov r15, %0" :
"=r" (sp));
155 return (&__jo_profile_cpu[(sp & 0x000FFFFF) < 0x4000 ? 1 : 0]);
164 cpu->sum[slot] += value;
165 if (value > cpu->max[slot])
166 cpu->max[slot] = value;
179 __jo_profile_current_cpu()->start[slot] = (
unsigned short)jo_profile_ticks();
194 cpu = __jo_profile_current_cpu();
195 __jo_profile_add(cpu, slot, (jo_profile_ticks() - cpu->start[slot]) & 0xFFFF);
208 __jo_profile_add(__jo_profile_current_cpu(), slot, value);
218bool jo_profile_get(
const jo_profile_slot slot,
unsigned int *average,
unsigned int *maximum);
225unsigned int jo_profile_vdp1_last(
void);
247# define JO_PROFILE_SAMPLING_CODE_START (0x06004000)
249# define JO_PROFILE_SAMPLING_BIN_SIZE (16)
252# ifndef JO_PROFILE_SAMPLING_BINS
253# define JO_PROFILE_SAMPLING_BINS (16384)
258void jo_profile_sampling_stop(
void);
273# define jo_profile_begin(SLOT) do {} while (0)
274# define jo_profile_end(SLOT) do {} while (0)
275# define jo_profile_count(SLOT, VALUE) do {} while (0)
276# define jo_profile_set_name(SLOT, NAME) do {} while (0)
277# define jo_profile_print(X, Y) do {} while (0)
278# define jo_profile_count_pixels(ENABLED) do {} while (0)
279# define jo_profile_sampling_start(M, S) do {} while (0)
#define __JO_INDEX_IS_WRONG(INDEX, COUNT, WHAT)
Check an index given to a function of the engine (Internal usage, JO_DEBUG).
Definition core.h:55
const char * name
Definition entity.h:9
#define jo_profile_print(X, Y)
Definition profile.h:277
#define jo_profile_begin(SLOT)
Definition profile.h:273
#define jo_profile_sampling_start(M, S)
Definition profile.h:279
#define jo_profile_end(SLOT)
Definition profile.h:274
jo_profile_slot
Measures of the engine and of the program (jo_profile_begin(), jo_profile_end(), jo_profile_count()).
Definition profile.h:57
@ JO_PROFILE_3D_VERTEX_COUNT
3D vertices transformed per frame (count, both CPUs)
Definition profile.h:85
@ JO_PROFILE_3D_VERTICES
3D: transformation and projection of the vertices (both CPUs)
Definition profile.h:87
@ JO_PROFILE_CALLBACKS
Callbacks of the master CPU (jo_core_add_callback()).
Definition profile.h:61
@ JO_PROFILE_VDP1_DRAW
VDP1: from the display of a new command table to the end of its drawing.
Definition profile.h:75
@ JO_PROFILE_VBLANKS
VBLANK per frame (count, x 100).
Definition profile.h:77
@ JO_PROFILE_FIRST_USER
First measure of the program (see JO_PROFILE_USER()).
Definition profile.h:99
@ JO_PROFILE_VDP1_COPY
Copy of the VDP1 commands of a frame into the VDP1 VRAM.
Definition profile.h:69
@ JO_PROFILE_3D_LIGHT
3D: lighting of the polygons (JO_3D_USE_LIGHT), both CPUs (included in JO_PROFILE_3D_POLYGONS)
Definition profile.h:93
@ JO_PROFILE_COUNT
Measures count.
Definition profile.h:101
@ JO_PROFILE_3D_POLYGON_COUNT
3D polygons tested per frame, visible or not (count, both CPUs)
Definition profile.h:83
@ JO_PROFILE_VDP1_COMMANDS
VDP1 commands per frame (count).
Definition profile.h:79
@ JO_PROFILE_SLAVE
Slave CPU busy (all its jobs: the callbacks of jo_core_exec_on_slave() and the engine jobs).
Definition profile.h:65
@ JO_PROFILE_VDP1_WAIT
Wait for the VDP1 before the copy (previous table not displayed yet, or still drawn).
Definition profile.h:71
@ JO_PROFILE_FRAME
Frame: from the start of the callbacks of a frame to the start of the next one.
Definition profile.h:59
@ JO_PROFILE_VDP1_SORT
Sort of the VDP1 commands of a frame.
Definition profile.h:67
@ JO_PROFILE_3D_PIXELS
3D: estimate of the pixels the VDP1 draws for the polygons of a frame (count, both CPUs): the VDP1 dr...
Definition profile.h:97
@ JO_PROFILE_VSYNC
Master CPU waiting for the VBLANK at the end of the frame (JO_FRAMERATE).
Definition profile.h:73
@ JO_PROFILE_POLYGONS
3D polygons displayed per frame (count)
Definition profile.h:81
@ JO_PROFILE_3D_CLIP
3D: polygons near the camera (subdivided) or crossing the near plane (clipped), both CPUs (included i...
Definition profile.h:91
@ JO_PROFILE_WAIT_SLAVE
Master CPU waiting for the slave CPU (jo_core_wait_for_slave()).
Definition profile.h:63
@ JO_PROFILE_3D_POLYGONS
3D: polygons (visibility, clipping, lighting, VDP1 commands), both CPUs
Definition profile.h:89
#define jo_profile_set_name(SLOT, NAME)
Definition profile.h:276
#define jo_profile_count(SLOT, VALUE)
Definition profile.h:275
#define jo_profile_count_pixels(ENABLED)
Definition profile.h:278
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39