Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
profile.h File Reference

Jo Engine profiler: time spent by the CPUs and the VDP1 in each frame. More...

Go to the source code of this file.

Macros

#define JO_PROFILE_USER(N)
 Measure of the program.
#define JO_PROFILE_FRAMES
 Frames of the averages and of the maximums.
#define jo_profile_begin(SLOT)
#define jo_profile_end(SLOT)
#define jo_profile_count(SLOT, VALUE)
#define jo_profile_set_name(SLOT, NAME)
#define jo_profile_print(X, Y)
#define jo_profile_count_pixels(ENABLED)
#define jo_profile_sampling_start(M, S)
#define __jo_profile_slave_job()

Enumerations

enum  jo_profile_slot {
  JO_PROFILE_FRAME , JO_PROFILE_CALLBACKS , JO_PROFILE_WAIT_SLAVE , JO_PROFILE_SLAVE ,
  JO_PROFILE_VDP1_SORT , JO_PROFILE_VDP1_COPY , JO_PROFILE_VDP1_WAIT , JO_PROFILE_VSYNC ,
  JO_PROFILE_VDP1_DRAW , JO_PROFILE_VBLANKS , JO_PROFILE_VDP1_COMMANDS , JO_PROFILE_POLYGONS ,
  JO_PROFILE_3D_POLYGON_COUNT , JO_PROFILE_3D_VERTEX_COUNT , JO_PROFILE_3D_VERTICES , JO_PROFILE_3D_POLYGONS ,
  JO_PROFILE_3D_CLIP , JO_PROFILE_3D_LIGHT , JO_PROFILE_3D_PIXELS , JO_PROFILE_FIRST_USER ,
  JO_PROFILE_COUNT
}
 Measures of the engine and of the program (jo_profile_begin(), jo_profile_end(), jo_profile_count()). More...

Detailed Description

Jo Engine profiler: time spent by the CPUs and the VDP1 in each frame.

Author
Johannes Fetz
Remarks
Compile with JO_COMPILE_WITH_PROFILER_MODULE = 1 in the makefile. Without it, the functions of this file do nothing (no cost)
The times are measured with the free running timer of each CPU (1 tick = 32 CPU clocks, about 1.2 us). An interval must be shorter than 65535 ticks (about 78 ms)
The averages and the maximums are computed over JO_PROFILE_FRAMES frames

Example:

static void my_draw(void)
{
draw_terrain();
}
...
jo_profile_set_name(JO_PROFILE_USER(0), "terrain");
#define jo_profile_print(X, Y)
Definition profile.h:258
#define jo_profile_begin(SLOT)
Definition profile.h:254
#define jo_profile_end(SLOT)
Definition profile.h:255
#define JO_PROFILE_USER(N)
Measure of the program.
Definition profile.h:107

Macro Definition Documentation

◆ __jo_profile_slave_job

#define __jo_profile_slave_job ( )

◆ jo_profile_begin

#define jo_profile_begin ( SLOT)

◆ jo_profile_count

#define jo_profile_count ( SLOT,
VALUE )

◆ jo_profile_count_pixels

#define jo_profile_count_pixels ( ENABLED)

◆ jo_profile_end

#define jo_profile_end ( SLOT)

◆ JO_PROFILE_FRAMES

#define JO_PROFILE_FRAMES

Frames of the averages and of the maximums.

◆ jo_profile_print

#define jo_profile_print ( X,
Y )

◆ jo_profile_sampling_start

#define jo_profile_sampling_start ( M,
S )

◆ jo_profile_set_name

#define jo_profile_set_name ( SLOT,
NAME )

◆ JO_PROFILE_USER

#define JO_PROFILE_USER ( N)

Measure of the program.

Parameters
N0 to 7

Enumeration Type Documentation

◆ jo_profile_slot

Measures of the engine and of the program (jo_profile_begin(), jo_profile_end(), jo_profile_count()).

Enumerator
JO_PROFILE_FRAME 

Frame: from the start of the callbacks of a frame to the start of the next one.

JO_PROFILE_CALLBACKS 

Callbacks of the master CPU (jo_core_add_callback()).

JO_PROFILE_WAIT_SLAVE 

Master CPU waiting for the slave CPU (jo_core_wait_for_slave()).

JO_PROFILE_SLAVE 

Slave CPU busy (all its jobs: the callbacks of jo_core_exec_on_slave() and the engine jobs).

JO_PROFILE_VDP1_SORT 

Sort of the VDP1 commands of a frame.

JO_PROFILE_VDP1_COPY 

Copy of the VDP1 commands of a frame into the VDP1 VRAM.

JO_PROFILE_VDP1_WAIT 

Wait for the VDP1 before the copy (previous table not displayed yet, or still drawn).

JO_PROFILE_VSYNC 

Master CPU waiting for the VBLANK at the end of the frame (JO_FRAMERATE).

JO_PROFILE_VDP1_DRAW 

VDP1: from the display of a new command table to the end of its drawing.

JO_PROFILE_VBLANKS 

VBLANK per frame (count, x 100).

JO_PROFILE_VDP1_COMMANDS 

VDP1 commands per frame (count).

JO_PROFILE_POLYGONS 

3D polygons displayed per frame (count)

JO_PROFILE_3D_POLYGON_COUNT 

3D polygons tested per frame, visible or not (count, both CPUs)

JO_PROFILE_3D_VERTEX_COUNT 

3D vertices transformed per frame (count, both CPUs)

JO_PROFILE_3D_VERTICES 

3D: transformation and projection of the vertices (both CPUs)

JO_PROFILE_3D_POLYGONS 

3D: polygons (visibility, clipping, lighting, VDP1 commands), both CPUs

JO_PROFILE_3D_CLIP 

3D: polygons near the camera (subdivided) or crossing the near plane (clipped), both CPUs (included in JO_PROFILE_3D_POLYGONS)

JO_PROFILE_3D_LIGHT 

3D: lighting of the polygons (JO_3D_USE_LIGHT), both CPUs (included in JO_PROFILE_3D_POLYGONS)

JO_PROFILE_3D_PIXELS 

3D: estimate of the pixels the VDP1 draws for the polygons of a frame (count, both CPUs): the VDP1 draws about max(lines, texture height) x max(pixels per line, texture width) pixels for a polygon, even smaller on the screen, even hidden by the next polygons or outside of the screen (about 28 pixels per microsecond)

JO_PROFILE_FIRST_USER 

First measure of the program (see JO_PROFILE_USER()).

JO_PROFILE_COUNT 

Measures count.