summaryrefslogtreecommitdiff
path: root/src/profiler.h
blob: f6b1a853464c53213329516764aedd5878f9e18e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef PROFILER_H
#define PROFILER_H

extern u64 osClockRate;

struct ProfilerFrameData {
    /* 0x00 */ s16 numSoundTimes;
    /* 0x02 */ s16 numVblankTimes;
    // gameTimes:
    // 0: thread 5 start
    // 1: level script execution
    // 2: render
    // 3: display lists
    // 4: thread 4 end (0 terminated)
    /* 0x08 */ OSTime gameTimes[5];
    // gfxTimes:
    // 0: processors queued
    // 1: rsp completed
    // 2: rdp completed
    /* 0x30 */ OSTime gfxTimes[3];
    /* 0x48 */ OSTime soundTimes[8];
    /* 0x88 */ OSTime vblankTimes[8];
};

// thread event IDs
enum ProfilerGameEvent { THREAD5_START, LEVEL_SCRIPT_EXECUTE, BEFORE_DISPLAY_LISTS, AFTER_DISPLAY_LISTS, THREAD5_END };

enum ProfilerGfxEvent { TASKS_QUEUED, RSP_COMPLETE, RDP_COMPLETE };

void profiler_log_thread5_time(enum ProfilerGameEvent eventID);
void profiler_log_thread4_time(void);
void profiler_log_gfx_time(enum ProfilerGfxEvent eventID);
void profiler_log_vblank_time(void);
void draw_profiler(void);
void resource_display(void);

extern s32 gEnableResourceMeters;

#endif /* PROFILER_H */