9#if defined(USE_PROFILER) && defined(PUPPYPRINT_DEBUG)
13#define AUDIO_PROFILING
19#define OS_GET_COUNT_INLINE(x) asm volatile("mfc0 %0, $9" : "=r"(x): )
21#define PROFILING_BUFFER_SIZE 64
23#define AUDIO_SUBSET_ENTRIES \
24 PROFILER_TIME_SUB_AUDIO_START, \
25 PROFILER_TIME_SUB_AUDIO_SEQUENCES = PROFILER_TIME_SUB_AUDIO_START, \
26 PROFILER_TIME_SUB_AUDIO_SEQUENCES_SCRIPT, \
27 PROFILER_TIME_SUB_AUDIO_SEQUENCES_RECLAIM, \
28 PROFILER_TIME_SUB_AUDIO_SEQUENCES_PROCESSING, \
29 PROFILER_TIME_SUB_AUDIO_SYNTHESIS, \
30 PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING, \
31 PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB, \
32 PROFILER_TIME_SUB_AUDIO_SYNTHESIS_DMA, \
33 PROFILER_TIME_SUB_AUDIO_UPDATE, \
34 PROFILER_TIME_SUB_AUDIO_END
36#define GFX_SUBSET_ENTRIES \
37 PROFILER_TIME_SUB_GFX_START, \
38 PROFILER_TIME_SUB_GFX_UPDATE, \
39 PROFILER_TIME_SUB_GFX__DUMMY, \
40 PROFILER_TIME_SUB_GFX_ENTITIES, \
41 PROFILER_TIME_SUB_GFX_MODELS, \
42 PROFILER_TIME_SUB_GFX_PLAYER, \
43 PROFILER_TIME_SUB_GFX_NPCS, \
44 PROFILER_TIME_SUB_GFX_WORKERS, \
45 PROFILER_TIME_SUB_GFX_EFFECTS, \
46 PROFILER_TIME_SUB_GFX_RENDER_TASKS, \
47 PROFILER_TIME_SUB_GFX_HUD_ELEMENTS, \
48 PROFILER_TIME_SUB_GFX_BACK_UI, \
49 PROFILER_TIME_SUB_GFX_FRONT_UI, \
50 PROFILER_TIME_SUB_GFX_END
62#ifdef PUPPYPRINT_DEBUG
105#ifdef PUPPYPRINT_DEBUG
111#ifndef PUPPYPRINT_DEBUG
112#define PROFILER_TIME_PUPPYPRINT1 0
113#define PROFILER_TIME_PUPPYPRINT2 0
114#define PROFILER_DELTA_PUPPYPRINT1 0
115#define PROFILER_DELTA_PUPPYPRINT2 0
131void profiler_gfx_started();
132void profiler_gfx_completed();
135#ifdef PUPPYPRINT_DEBUG
140#define profiler_collision_reset()
141#define profiler_collision_completed()
142#define profiler_collision_update(time)
151#define PROFILER_GET_SNAPSHOT() u32 first = osGetCount()
152#define PROFILER_GET_SNAPSHOT_TYPE(type) u32 first = profiler_get_delta(type)
155#define PROFILER_GET_SNAPSHOT()
156#define PROFILER_GET_SNAPSHOT_TYPE(type)
157#define profiler_update(which, delta)
158#define profiler_print_times()
159#define profiler_frame_setup()
160#define profiler_rsp_started(which)
161#define profiler_rsp_completed(which)
162#define profiler_rsp_resumed()
163#define profiler_audio_started()
164#define profiler_audio_completed()
165#define profiler_rsp_yielded()
166#define profiler_collision_reset()
167#define profiler_collision_completed()
168#define profiler_collision_update(time)
169#define profiler_get_delta(which) 0
170#define profiler_get_cpu_microseconds() 0
171#define profiler_get_rsp_microseconds() 0
172#define profiler_get_rdp_microseconds() 0
176#define GFX_SUBSET_SIZE PROFILER_TIME_SUB_GFX_END - PROFILER_TIME_SUB_GFX_START
212#define GFX_PROFILER_SWITCH(complete, begin) profiler_gfx_subset_switch_func(complete - PROFILER_TIME_SUB_GFX_START, begin - PROFILER_TIME_SUB_GFX_START)
213#define GFX_PROFILER_COMPLETE_AND_SWITCH(complete1, complete2, begin) profiler_gfx_subset_complete_and_switch_func(complete1 - PROFILER_TIME_SUB_GFX_START, \
214 complete2 - PROFILER_TIME_SUB_GFX_START, begin - PROFILER_TIME_SUB_GFX_START)
215#define GFX_PROFILER_START_SHARED(first, new) profiler_gfx_subset_start_shared_func(first - PROFILER_TIME_SUB_GFX_START, new - PROFILER_TIME_SUB_GFX_START)
216#define GFX_PROFILER_START(which) profiler_gfx_subset_start_func(which - PROFILER_TIME_SUB_GFX_START)
217#define GFX_PROFILER_COMPLETE(which) profiler_gfx_subset_complete_func(which - PROFILER_TIME_SUB_GFX_START)
219enum ProfilerTimeGFXUnused {
222#define GFX_PROFILER_SWITCH(complete, begin)
223#define GFX_PROFILER_COMPLETE_AND_SWITCH(complete1, complete2, begin)
224#define GFX_PROFILER_START_SHARED(first, new)
225#define GFX_PROFILER_START(which)
226#define GFX_PROFILER_COMPLETE(which)
229#ifdef AUDIO_PROFILING
230#define AUDIO_SUBSET_SIZE PROFILER_TIME_SUB_AUDIO_END - PROFILER_TIME_SUB_AUDIO_START
231extern u32 audio_subset_starts[AUDIO_SUBSET_SIZE];
232extern u32 audio_subset_tallies[AUDIO_SUBSET_SIZE];
238 audio_subset_tallies[complete] += time - audio_subset_starts[complete];
239 audio_subset_starts[start] = time;
246 audio_subset_tallies[complete1] += time - audio_subset_starts[complete1];
247 audio_subset_tallies[complete2] += time - audio_subset_starts[complete2];
248 audio_subset_starts[start] = time;
252 audio_subset_starts[
new] = audio_subset_starts[first];
263 audio_subset_tallies[index] += time - audio_subset_starts[index];
266#define AUDIO_PROFILER_SWITCH(complete, begin) profiler_audio_subset_switch_func(complete - PROFILER_TIME_SUB_AUDIO_START, begin - PROFILER_TIME_SUB_AUDIO_START)
267#define AUDIO_PROFILER_COMPLETE_AND_SWITCH(complete1, complete2, begin) profiler_audio_subset_complete_and_switch_func(complete1 - PROFILER_TIME_SUB_AUDIO_START, \
268 complete2 - PROFILER_TIME_SUB_AUDIO_START, begin - PROFILER_TIME_SUB_AUDIO_START)
269#define AUDIO_PROFILER_START_SHARED(first, new) profiler_audio_subset_start_shared_func(first - PROFILER_TIME_SUB_AUDIO_START, new - PROFILER_TIME_SUB_AUDIO_START)
272#define AUDIO_PROFILER_START(which) profiler_audio_subset_start_func(which - PROFILER_TIME_SUB_AUDIO_START)
273#define AUDIO_PROFILER_COMPLETE(which) profiler_audio_subset_complete_func(which - PROFILER_TIME_SUB_AUDIO_START)
278#define AUDIO_PROFILER_SWITCH(complete, begin)
279#define AUDIO_PROFILER_COMPLETE_AND_SWITCH(complete1, complete2, begin)
280#define AUDIO_PROFILER_START_SHARED(first, new)
283#define AUDIO_PROFILER_START(which)
284#define AUDIO_PROFILER_COMPLETE(which)
#define profiler_get_cpu_microseconds()
#define AUDIO_SUBSET_ENTRIES
#define profiler_frame_setup()
#define PROFILING_BUFFER_SIZE
#define profiler_update(which, delta)
#define profiler_rsp_resumed()
#define profiler_collision_completed()
u32 gfx_subset_starts[PROFILER_TIME_SUB_GFX_END - PROFILER_TIME_SUB_GFX_START]
#define PROFILER_DELTA_PUPPYPRINT1
@ PROFILER_DELTA_COLLISION
#define profiler_get_rsp_microseconds()
#define PROFILER_TIME_PUPPYPRINT2
@ PROFILE_TIME_WORLD_PLAYER
@ PROFILER_TIME_CONTROLLERS
@ PROFILE_TIME_WORLD_EFFECTS
@ PROFILER_TIME_RSP_AUDIO
@ PROFILE_TIME_WORLD_ENCOUNTERS
@ PROFILE_TIME_WORLD_ITEM_ENTITIES
@ PROFILER_TIME_HUD_ELEMENTS
@ PROFILE_TIME_WORLD_NPCS
@ PROFILER_TIME_SUB_GFX_END
@ PROFILER_TIME_STEP_GAME_MODE
@ PROFILE_TIME_WORLD_CAMERAS
#define OS_GET_COUNT_INLINE(x)
#define profiler_collision_update(time)
#define profiler_rsp_started(which)
u32 gfx_subset_tallies[PROFILER_TIME_SUB_GFX_END - PROFILER_TIME_SUB_GFX_START]
#define profiler_print_times()
#define profiler_rsp_completed(which)
#define PROFILER_DELTA_PUPPYPRINT2
#define GFX_SUBSET_ENTRIES
#define profiler_get_delta(which)
#define profiler_audio_completed()
@ PROFILER_TIME_SUB_AUDIO_END
#define profiler_get_rdp_microseconds()
#define profiler_collision_reset()
#define profiler_audio_started()
#define PROFILER_TIME_PUPPYPRINT1
#define profiler_rsp_yielded()