| 52 |
#include "debug.h" |
#include "debug.h" |
| 53 |
|
|
| 54 |
// Emulation time statistics |
// Emulation time statistics |
| 55 |
#define EMUL_TIME_STATS 1 |
#ifndef EMUL_TIME_STATS |
| 56 |
|
#define EMUL_TIME_STATS 0 |
| 57 |
|
#endif |
| 58 |
|
|
| 59 |
#if EMUL_TIME_STATS |
#if EMUL_TIME_STATS |
| 60 |
static clock_t emul_start_time; |
static clock_t emul_start_time; |
| 61 |
static uint32 interrupt_count = 0; |
static uint32 interrupt_count = 0, ppc_interrupt_count = 0; |
| 62 |
static clock_t interrupt_time = 0; |
static clock_t interrupt_time = 0; |
| 63 |
static uint32 exec68k_count = 0; |
static uint32 exec68k_count = 0; |
| 64 |
static clock_t exec68k_time = 0; |
static clock_t exec68k_time = 0; |
| 598 |
void sheepshaver_cpu::interrupt(uint32 entry) |
void sheepshaver_cpu::interrupt(uint32 entry) |
| 599 |
{ |
{ |
| 600 |
#if EMUL_TIME_STATS |
#if EMUL_TIME_STATS |
| 601 |
interrupt_count++; |
ppc_interrupt_count++; |
| 602 |
const clock_t interrupt_start = clock(); |
const clock_t interrupt_start = clock(); |
| 603 |
#endif |
#endif |
| 604 |
|
|
| 990 |
printf("Total emulation time : %.1f sec\n", double(emul_time) / double(CLOCKS_PER_SEC)); |
printf("Total emulation time : %.1f sec\n", double(emul_time) / double(CLOCKS_PER_SEC)); |
| 991 |
printf("Total interrupt count: %d (%2.1f Hz)\n", interrupt_count, |
printf("Total interrupt count: %d (%2.1f Hz)\n", interrupt_count, |
| 992 |
(double(interrupt_count) * CLOCKS_PER_SEC) / double(emul_time)); |
(double(interrupt_count) * CLOCKS_PER_SEC) / double(emul_time)); |
| 993 |
|
printf("Total ppc interrupt count: %d (%2.1f %%)\n", ppc_interrupt_count, |
| 994 |
|
(double(ppc_interrupt_count) * 100.0) / double(interrupt_count)); |
| 995 |
|
|
| 996 |
#define PRINT_STATS(LABEL, VAR_PREFIX) do { \ |
#define PRINT_STATS(LABEL, VAR_PREFIX) do { \ |
| 997 |
printf("Total " LABEL " count : %d\n", VAR_PREFIX##_count); \ |
printf("Total " LABEL " count : %d\n", VAR_PREFIX##_count); \ |
| 1078 |
// Current interrupt nest level |
// Current interrupt nest level |
| 1079 |
static int interrupt_depth = 0; |
static int interrupt_depth = 0; |
| 1080 |
++interrupt_depth; |
++interrupt_depth; |
| 1081 |
|
#if EMUL_TIME_STATS |
| 1082 |
|
interrupt_count++; |
| 1083 |
|
#endif |
| 1084 |
|
|
| 1085 |
// Disable MacOS stack sniffer |
// Disable MacOS stack sniffer |
| 1086 |
WriteMacInt32(0x110, 0); |
WriteMacInt32(0x110, 0); |
| 1120 |
// 68k emulator active, within EMUL_OP routine, execute 68k interrupt routine directly when interrupt level is 0 |
// 68k emulator active, within EMUL_OP routine, execute 68k interrupt routine directly when interrupt level is 0 |
| 1121 |
if ((ReadMacInt32(XLM_68K_R25) & 7) == 0) { |
if ((ReadMacInt32(XLM_68K_R25) & 7) == 0) { |
| 1122 |
interrupt_context ctx(this, "68k mode"); |
interrupt_context ctx(this, "68k mode"); |
| 1123 |
|
#if EMUL_TIME_STATS |
| 1124 |
|
const clock_t interrupt_start = clock(); |
| 1125 |
|
#endif |
| 1126 |
#if 1 |
#if 1 |
| 1127 |
// Execute full 68k interrupt routine |
// Execute full 68k interrupt routine |
| 1128 |
M68kRegisters r; |
M68kRegisters r; |
| 1148 |
} |
} |
| 1149 |
} |
} |
| 1150 |
#endif |
#endif |
| 1151 |
|
#if EMUL_TIME_STATS |
| 1152 |
|
interrupt_time += (clock() - interrupt_start); |
| 1153 |
|
#endif |
| 1154 |
} |
} |
| 1155 |
break; |
break; |
| 1156 |
#endif |
#endif |