aboutsummaryrefslogtreecommitdiffstats
path: root/src/profiling.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-22 21:12:14 +0200
committerBad Diode <bd@badd10de.dev>2023-04-22 21:12:14 +0200
commitdeb9c48fbd3dc5854de4ae3a04dc999029c10ae0 (patch)
tree53d34672d676c5f9b9b56b2b185c511470c068a0 /src/profiling.c
parentd4fe4d95f105d8b9b47d26264c4876cbf4095a5d (diff)
downloadstepper-deb9c48fbd3dc5854de4ae3a04dc999029c10ae0.tar.gz
stepper-deb9c48fbd3dc5854de4ae3a04dc999029c10ae0.zip
Add new renderer and prepare for render overhaul
Diffstat (limited to 'src/profiling.c')
-rw-r--r--src/profiling.c106
1 files changed, 48 insertions, 58 deletions
diff --git a/src/profiling.c b/src/profiling.c
index de969d2..7a4f4ad 100644
--- a/src/profiling.c
+++ b/src/profiling.c
@@ -52,22 +52,23 @@ static bool profile_bg_show = true;
52 profile_bg_show ^= 1;\ 52 profile_bg_show ^= 1;\
53 }\ 53 }\
54 if (profile_show) {\ 54 if (profile_show) {\
55 txt_color(1);\
55 txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\ 56 txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\
56 draw_filled_rect((PROF_SHOW_X), (PROF_SHOW_X), 8 * 18, 8 * 16, 0);\ 57 if (profile_bg_show) {\
58 draw_filled_rect((PROF_SHOW_X), (PROF_SHOW_X), 8 * 18, 8 * 14, 0);\
59 }\
57 txt_printf("VIDEO\n");\ 60 txt_printf("VIDEO\n");\
58 txt_printf(">CLEAR %.8lu\n", avg_clear_cycles);\ 61 txt_printf(">CLEAR %.8lu\n", avg_clear_cycles);\
59 txt_printf(">LINES %.8lu\n", avg_line_cycles);\
60 txt_printf(">RECT %.8lu\n", avg_rect_cycles);\
61 txt_printf(">FRECT %.8lu\n", avg_fill_rect_cycles);\
62 txt_printf(">1BPP %.8lu\n", avg_icn_cycles);\
63 txt_printf(">2BPP %.8lu\n", avg_chr_cycles);\
64 txt_printf(">FLIP %.8lu\n", avg_flip_cycles);\ 62 txt_printf(">FLIP %.8lu\n", avg_flip_cycles);\
65 txt_printf("TEXT\n");\ 63 txt_printf("SEQUENCER RENDER\n");\
66 txt_printf(">DRAWF %.8lu\n", avg_txt_drawf_cycles);\ 64 txt_printf(">TRIGS %.8lu\n", avg_draw_trigs_cycles);\
67 txt_printf(">PRINTF %.8lu\n", avg_txt_printf_cycles);\ 65 txt_printf(">BTNS %.8lu\n", avg_draw_btns_cycles);\
68 txt_printf(">RENDER %.8lu\n", avg_txt_render_cycles);\ 66 txt_printf(">PARAM %.8lu\n", avg_draw_param_cycles);\
69 txt_printf(">CLEAR %.8lu\n", avg_txt_clear_cycles);\ 67 txt_printf(">PIANO %.8lu\n", avg_draw_piano_cycles);\
68 txt_printf(">CURSOR %.8lu\n", avg_draw_cursor_cycles);\
69 txt_printf(">RENDER %.8lu\n", avg_render_cycles);\
70 txt_printf("TOTAL %.8lu\n", avg_frame_cycles);\ 70 txt_printf("TOTAL %.8lu\n", avg_frame_cycles);\
71 txt_render();\
71 }\ 72 }\
72 if (profile_bg_show) {\ 73 if (profile_bg_show) {\
73 u32 frame_time =\ 74 u32 frame_time =\
@@ -80,40 +81,35 @@ static bool profile_bg_show = true;
80 FP_NUM(280896 * 60, 2),\ 81 FP_NUM(280896 * 60, 2),\
81 FP_NUM(avg_frame_cycles + 1, 2),\ 82 FP_NUM(avg_frame_cycles + 1, 2),\
82 2);\ 83 2);\
83 txt_printf("TIME %.8lu\n", frame_time >> 2);\ 84 draw_filled_rect(8 * 18, 0, 239, 16, 0);\
84 txt_printf("FPS %.8lu\n", (fps >> 2) + 1);\ 85 txt_drawf("TIME: %.6lu", 8 * 18, 0, 1, frame_time >> 2);\
86 txt_drawf("MAX FPS:%.4lu", 8 * 18, 8, 1, (fps >> 2) + 1);\
85 }\ 87 }\
86 } while (0) 88 } while (0)
87 89
88static u32 prof_frame_counter = 0; 90static u32 prof_frame_counter = 0;
89 91
90static u32 frame_cycles = 0; 92static u32 frame_cycles = 0;
91static u32 flip_cycles = 0; 93static u32 flip_cycles = 0;
92static u32 clear_cycles = 0; 94static u32 clear_cycles = 0;
93static u32 line_cycles = 0; 95static u32 input_cycles = 0;
94static u32 rect_cycles = 0; 96static u32 draw_trigs_cycles = 0;
95static u32 fill_rect_cycles = 0; 97static u32 draw_btn_cycles = 0;
96static u32 chr_cycles = 0; 98static u32 draw_piano_cycles = 0;
97static u32 icn_cycles = 0; 99static u32 draw_param_cycles = 0;
98static u32 txt_drawf_cycles = 0; 100static u32 draw_cursor_cycles = 0;
99static u32 txt_printf_cycles = 0; 101static u32 render_cycles = 0;
100static u32 txt_render_cycles = 0;
101static u32 txt_clear_cycles = 0;
102static u32 input_cycles = 0;
103 102
104static u32 avg_frame_cycles = 0; 103static u32 avg_frame_cycles = 0;
105static u32 avg_flip_cycles = 0; 104static u32 avg_flip_cycles = 0;
106static u32 avg_clear_cycles = 0; 105static u32 avg_clear_cycles = 0;
107static u32 avg_line_cycles = 0; 106static u32 avg_input_cycles = 0;
108static u32 avg_rect_cycles = 0; 107static u32 avg_draw_trigs_cycles = 0;
109static u32 avg_fill_rect_cycles = 0; 108static u32 avg_draw_btns_cycles = 0;
110static u32 avg_chr_cycles = 0; 109static u32 avg_draw_piano_cycles = 0;
111static u32 avg_icn_cycles = 0; 110static u32 avg_draw_param_cycles = 0;
112static u32 avg_txt_drawf_cycles = 0; 111static u32 avg_draw_cursor_cycles = 0;
113static u32 avg_txt_printf_cycles = 0; 112static u32 avg_render_cycles = 0;
114static u32 avg_txt_render_cycles = 0;
115static u32 avg_txt_clear_cycles = 0;
116static u32 avg_input_cycles = 0;
117 113
118#if PROF_ENABLE == 1 114#if PROF_ENABLE == 1
119#define FRAME_START()\ 115#define FRAME_START()\
@@ -122,29 +118,23 @@ static u32 avg_input_cycles = 0;
122 avg_frame_cycles = frame_cycles / prof_frame_counter;\ 118 avg_frame_cycles = frame_cycles / prof_frame_counter;\
123 avg_flip_cycles = flip_cycles / prof_frame_counter;\ 119 avg_flip_cycles = flip_cycles / prof_frame_counter;\
124 avg_clear_cycles = clear_cycles / prof_frame_counter;\ 120 avg_clear_cycles = clear_cycles / prof_frame_counter;\
125 avg_line_cycles = line_cycles / prof_frame_counter;\ 121 avg_draw_trigs_cycles = draw_trigs_cycles / prof_frame_counter;\
126 avg_rect_cycles = rect_cycles / prof_frame_counter;\ 122 avg_draw_btns_cycles = draw_btn_cycles / prof_frame_counter;\
127 avg_fill_rect_cycles = fill_rect_cycles / prof_frame_counter;\ 123 avg_draw_piano_cycles = draw_piano_cycles / prof_frame_counter;\
128 avg_chr_cycles = chr_cycles / prof_frame_counter;\ 124 avg_draw_param_cycles = draw_param_cycles / prof_frame_counter;\
129 avg_icn_cycles = icn_cycles / prof_frame_counter;\ 125 avg_draw_cursor_cycles = draw_cursor_cycles / prof_frame_counter;\
130 avg_txt_drawf_cycles = txt_drawf_cycles / prof_frame_counter;\ 126 avg_input_cycles = input_cycles / prof_frame_counter;\
131 avg_txt_printf_cycles = txt_printf_cycles / prof_frame_counter;\ 127 avg_render_cycles = render_cycles / prof_frame_counter;\
132 avg_txt_render_cycles = txt_render_cycles / prof_frame_counter;\
133 avg_txt_clear_cycles = txt_clear_cycles / prof_frame_counter;\
134 avg_input_cycles = input_cycles / prof_frame_counter;\
135 frame_cycles = 0;\ 128 frame_cycles = 0;\
136 flip_cycles = 0;\ 129 flip_cycles = 0;\
137 clear_cycles = 0;\ 130 clear_cycles = 0;\
138 line_cycles = 0;\
139 rect_cycles = 0;\
140 fill_rect_cycles = 0;\
141 chr_cycles = 0;\
142 icn_cycles = 0;\
143 txt_drawf_cycles = 0;\
144 txt_printf_cycles = 0;\
145 txt_render_cycles = 0;\
146 txt_clear_cycles = 0;\
147 input_cycles = 0;\ 131 input_cycles = 0;\
132 render_cycles = 0;\
133 draw_trigs_cycles = 0;\
134 draw_param_cycles = 0;\
135 draw_cursor_cycles = 0;\
136 draw_btn_cycles = 0;\
137 draw_piano_cycles = 0;\
148 prof_frame_counter = 0;\ 138 prof_frame_counter = 0;\
149 }\ 139 }\
150 profile_start();\ 140 profile_start();\