@@ -27,6 +27,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
27
27
#include < thirdparty/loguru/loguru.hpp>
28
28
#include < debugger/debugger.h>
29
29
30
+ void ppc_exception_handler (Except_Type exception_type, uint32_t srr1_bits) {
31
+ power_on = false ;
32
+ }
33
+
30
34
uint32_t cs_code[] = {
31
35
0x3863FFFC , 0x7C861671 , 0x41820090 , 0x70600002 , 0x41E2001C , 0xA0030004 ,
32
36
0x3884FFFE , 0x38630002 , 0x5486F0BF , 0x7CA50114 , 0x41820070 , 0x70C60003 ,
@@ -36,7 +40,7 @@ uint32_t cs_code[] = {
36
40
0x80C30008 , 0x7CA50114 , 0x80E3000C , 0x7CA53114 , 0x85030010 , 0x7CA53914 ,
37
41
0x4200FFE0 , 0x7CA54114 , 0x70800002 , 0x41E20010 , 0xA0030004 , 0x38630002 ,
38
42
0x7CA50114 , 0x70800001 , 0x41E20010 , 0x88030004 , 0x5400402E , 0x7CA50114 ,
39
- 0x7C650194 , 0x4E800020
43
+ 0x7C650194 , /* 0x4E800020 */ 0x00005AF0
40
44
};
41
45
42
46
// 0x7FFFFFFC is the max
@@ -123,26 +127,29 @@ int main(int argc, char** argv) {
123
127
}
124
128
LOG_F (INFO, " Overhead Time: %lld ns" , overhead);
125
129
126
- for (i = 0 ; i < test_iterations; i++) {
127
- uint64_t best_sample = -1 ;
128
- for (j = 0 ; j < test_samples; j++) {
129
- ppc_state.pc = 0 ;
130
- ppc_state.gpr [3 ] = 0x1000 ; // buf
131
- ppc_state.gpr [4 ] = test_size; // len
132
- ppc_state.gpr [5 ] = 0 ; // sum
133
- power_on = true ;
134
-
135
- auto start_time = std::chrono::steady_clock::now ();
136
- ppc_exec_until (0xC4 );
137
- auto end_time = std::chrono::steady_clock::now ();
138
- auto time_elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time);
139
- if (time_elapsed.count () < best_sample)
140
- best_sample = time_elapsed.count ();
130
+ for (int theproc = 0 ; theproc < 2 ; theproc++) {
131
+ LOG_F (INFO, " Doing %s" , theproc ? " ppc_exec_until" : " ppc_exec" );
132
+ for (i = 0 ; i < test_iterations; i++) {
133
+ uint64_t best_sample = -1 ;
134
+ for (j = 0 ; j < test_samples; j++) {
135
+ ppc_state.pc = 0 ;
136
+ ppc_state.gpr [3 ] = 0x1000 ; // buf
137
+ ppc_state.gpr [4 ] = test_size; // len
138
+ ppc_state.gpr [5 ] = 0 ; // sum
139
+ power_on = true ;
140
+
141
+ auto start_time = std::chrono::steady_clock::now ();
142
+ (theproc) ? ppc_exec_until (0xC4 ) : ppc_exec ();
143
+ auto end_time = std::chrono::steady_clock::now ();
144
+ auto time_elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time);
145
+ if (time_elapsed.count () < best_sample)
146
+ best_sample = time_elapsed.count ();
147
+ }
148
+ if (ppc_state.gpr [3 ] != checksum)
149
+ LOG_F (INFO, " Checksum: 0x%08X" , ppc_state.gpr [3 ]);
150
+ best_sample -= overhead;
151
+ LOG_F (INFO, " (%d) %lld ns, %.4lf MiB/s" , i+1 , best_sample, 1E9 * test_size / (best_sample * 1024 * 1024 ));
141
152
}
142
- if (ppc_state.gpr [3 ] != checksum)
143
- LOG_F (INFO, " Checksum: 0x%08X" , ppc_state.gpr [3 ]);
144
- best_sample -= overhead;
145
- LOG_F (INFO, " (run #%d) Time: %lld ns Performance: %.4lf MiB/s" , i, best_sample, 1E9 * test_size / (best_sample * 1024 * 1024 ));
146
153
}
147
154
148
155
delete (grackle_obj);
0 commit comments