// File : profile.h // Coded by : Scotte // History : Created 12/03/00 17:13:03 // // Description : CPU and GPU profiling // Notes : None #ifndef _PROFILE_H_ #define _PROFILE_H_ #include #include "gtypes.h" // Profile bar dimensions #define BAR_H 6 #define MARKER_W 4 #define MARKER_H 16 // Maximum CPU readings #define MAX_READINGS 128 // Macro : mSetRCnt1_COUNT() // Coded by : Scotte // History : Created 14/03/00 21:59:34 // // Description : Set value of root counter 1 // // Parameters : n - new count value // // Returns : None // // Notes : None #define mSetRCnt1_COUNT(n)\ *(u_hword *)0x1f801110=(n) // Macro : mGetRCnt1_COUNT() // Coded by : Scotte // History : Created 14/03/00 21:59:34 // // Description : Get value of root counter 1 // // Parameters : None // // Returns : Counter value // // Notes : None #define mGetRCnt1_COUNT()\ (*(u_hword *)0x1f801110) // Macro : mSetRCnt1_MODE() // Coded by : Scotte // History : Created 14/03/00 21:59:34 // // Description : Set root counter 1 mode // // Parameters : n - new mode // // Returns : None // // Notes : Root counter 1 counts scanlines (default) #define mSetRCnt1_MODE(n)\ *(u_hword *)0x1f801114=(n) // Macro : mSetRCnt1_TARGET() // Coded by : Scotte // History : Created 14/03/00 21:59:34 // // Description : Set root counter 1 target value // // Parameters : n - new mode // // Returns : None // // Notes : None #define mSetRCnt1_TARGET(n)\ *(u_hword *)0x1f801118=(n) typedef struct { // Screen position u_hword px,py; // Initial count u_hword start_count; // Number of scanlines in a frame u_hword frametime; // Scale profile bars to fit screen u_hword scale; // Number of readings u_hword readings; // Number of frames to profile u_hword nframes; u_hword pad; // CPU times u_hword cpu_count[MAX_READINGS]; // Profile bar colours CVECTOR colours[MAX_READINGS]; }sPROFILE; void PROFILE_Initialise(const u_hword,const u_hword,const u_hword); void PROFILE_Start(void); void PROFILE_Read(const u_byte,const u_byte,const u_byte); void PROFILE_Draw(GsOT *); u_word PROFILE_Frametime(void); void PROFILE_Position(const u_hword,const u_hword); #ifdef PROFILE // Macro : PROFILE_INIT() // Coded by : Scotte // History : Created 12/03/00 17:21:30 // // Description : Set up the profiler // // Parameters : sw - screen width // sh - screen height // n- number of frames // // Returns : None // // Notes : None #define mPROFILE_INIT(sw,sh,n)\ PROFILE_Initialise(sw,sh,n) // Macro : mPROFILE_START() // Coded by : Scotte // History : Created 12/03/00 18:13:55 // // Description : Start profiling // // Parameters : None // // Returns : None // // Notes : None #define mPROFILE_START()\ PROFILE_Start(); // Macro : PROFILE_READ() // Coded by : Scotte // History : Created 12/03/00 18:14:53 // // Description : None // // Parameters : r,g,b - colour of profile bar // // Returns : None // // Notes : None #define mPROFILE_READ(r,g,b)\ PROFILE_Read(r,g,b) // Macro : PROFILE_DRAW() // Coded by : Scotte // History : Created 12/03/00 19:21:17 // // Description : Draw the profile bars // // Parameters : ot - ordering table // // Returns : None // // Notes : None #define mPROFILE_DRAW(ot)\ PROFILE_Draw(ot) #else #define mPROFILE_INIT(sw,sh,n)\ // #define mPROFILE_START()\ // #define mPROFILE_READ(r,g,b)\ // #define mPROFILE_DRAW(ot)\ // #endif #endif