Optimize SHOW_IPS calculation, now it does not require additional ips_count++ operation after every instruction execution
This commit is contained in:
parent
01d8a97613
commit
f93bd1c664
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.289 2005-04-16 19:37:38 sshwarts Exp $
|
||||
// $Id: main.cc,v 1.290 2005-07-04 18:02:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -1010,7 +1010,7 @@ int bx_atexit(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bx_signal_handler( int signum)
|
||||
void bx_signal_handler(int signum)
|
||||
{
|
||||
// in a multithreaded environment, a signal such as SIGINT can be sent to all
|
||||
// threads. This function is only intended to handle signals in the
|
||||
@ -1033,13 +1033,15 @@ void bx_signal_handler( int signum)
|
||||
#endif
|
||||
|
||||
#if BX_SHOW_IPS
|
||||
extern unsigned long ips_count;
|
||||
static Bit64u ticks_count = 0;
|
||||
|
||||
if (signum == SIGALRM)
|
||||
{
|
||||
// amount of system ticks passed from last time the handler was called
|
||||
Bit64u ips_count = bx_pc_system.time_ticks() - ticks_count;
|
||||
if (ips_count) {
|
||||
BX_INFO(("ips = %lu", ips_count));
|
||||
ips_count = 0;
|
||||
BX_INFO(("ips = %lu", (unsigned long) ips_count));
|
||||
ticks_count = bx_pc_system.time_ticks();
|
||||
}
|
||||
#ifndef __MINGW32__
|
||||
signal(SIGALRM, bx_signal_handler);
|
||||
@ -1057,5 +1059,6 @@ void bx_signal_handler( int signum)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BX_PANIC(("SIGNAL %u caught", signum));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.cc,v 1.42 2005-06-16 20:35:31 sshwarts Exp $
|
||||
// $Id: pc_system.cc,v 1.43 2005-07-04 18:02:37 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -37,10 +37,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BX_SHOW_IPS
|
||||
unsigned long ips_count=0;
|
||||
#endif
|
||||
|
||||
#if defined(PROVIDE_M_IPS)
|
||||
double m_ips; // Millions of Instructions Per Second
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.h,v 1.32 2005-04-29 21:28:41 sshwarts Exp $
|
||||
// $Id: pc_system.h,v 1.33 2005-07-04 18:02:37 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -26,16 +26,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#define BX_MAX_TIMERS 64
|
||||
#define BX_NULL_TIMER_HANDLE 10000
|
||||
|
||||
|
||||
#if BX_SHOW_IPS
|
||||
extern unsigned long ips_count;
|
||||
#endif
|
||||
|
||||
|
||||
typedef void (*bx_timer_handler_t)(void *);
|
||||
|
||||
|
||||
@ -110,17 +104,11 @@ public:
|
||||
return triggeredTimer;
|
||||
}
|
||||
static BX_CPP_INLINE void tick1(void) {
|
||||
#if BX_SHOW_IPS
|
||||
ips_count++;
|
||||
#endif
|
||||
if (--bx_pc_system.currCountdown == 0) {
|
||||
bx_pc_system.countdownEvent();
|
||||
}
|
||||
}
|
||||
static BX_CPP_INLINE void tickn(Bit64u n) {
|
||||
#if BX_SHOW_IPS
|
||||
ips_count += n;
|
||||
#endif
|
||||
while (n >= Bit64u(bx_pc_system.currCountdown)) {
|
||||
n -= Bit64u(bx_pc_system.currCountdown);
|
||||
bx_pc_system.currCountdown = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user