/[cebix]/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp
ViewVC logotype

Diff of /SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.43 by gbeauche, Mon May 31 10:08:31 2004 UTC revision 1.44 by gbeauche, Sat Jun 5 07:09:38 2004 UTC
# Line 52  Line 52 
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;
# Line 596  sheepshaver_cpu::interrupt_context::~int Line 598  sheepshaver_cpu::interrupt_context::~int
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    
# Line 988  void exit_emul_ppc(void) Line 990  void exit_emul_ppc(void)
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);             \
# Line 1074  void sheepshaver_cpu::handle_interrupt(v Line 1078  void sheepshaver_cpu::handle_interrupt(v
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);
# Line 1113  void sheepshaver_cpu::handle_interrupt(v Line 1120  void sheepshaver_cpu::handle_interrupt(v
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;
# Line 1138  void sheepshaver_cpu::handle_interrupt(v Line 1148  void sheepshaver_cpu::handle_interrupt(v
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

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15