Updated the alternate pc_system.{cc,h} files to add the ID string
parameter so we know which source modules are requesting timers. Also added a SpewPeriodicTimerInfo #define in case somebody is still having guest OS hang problems. If enabled, this macro will force a brief dump of the active timers list to the bochsout.txt file, every 5Million ticks. If the lowest timer's period is extremely low, that would be suspect.
This commit is contained in:
parent
83c9d266d0
commit
1aeb4c71b1
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: pc_system.cc-kpl,v 1.1 2002-10-01 21:27:33 kevinlawton Exp $
|
// $Id: pc_system.cc-kpl,v 1.2 2002-10-02 05:54:34 kevinlawton Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
@ -47,11 +47,18 @@ double m_ips; // Millions of Instructions Per Second
|
|||||||
// Option for turning off BX_TIMER_DEBUG?
|
// Option for turning off BX_TIMER_DEBUG?
|
||||||
// Check out m_ips and ips
|
// Check out m_ips and ips
|
||||||
|
|
||||||
|
#define SpewPeriodicTimerInfo 0
|
||||||
#define MinAllowableTimerPeriod 1
|
#define MinAllowableTimerPeriod 1
|
||||||
|
|
||||||
|
|
||||||
|
#if SpewPeriodicTimerInfo
|
||||||
|
// If debugging, set the heartbeat to 5M cycles. Each heartbeat
|
||||||
|
// spews the active timer info.
|
||||||
|
const Bit64u bx_pc_system_c::NullTimerInterval = 5000000;
|
||||||
|
#else
|
||||||
// This must be the maximum 32-bit unsigned int value, NOT (Bit64u) -1.
|
// This must be the maximum 32-bit unsigned int value, NOT (Bit64u) -1.
|
||||||
const Bit64u bx_pc_system_c::NullTimerInterval = 0xffffffff;
|
const Bit64u bx_pc_system_c::NullTimerInterval = 0xffffffff;
|
||||||
|
#endif
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
bx_pc_system_c::bx_pc_system_c(void)
|
bx_pc_system_c::bx_pc_system_c(void)
|
||||||
@ -232,19 +239,19 @@ bx_pc_system_c::exit(void)
|
|||||||
|
|
||||||
int
|
int
|
||||||
bx_pc_system_c::register_timer( void *this_ptr, void (*funct)(void *),
|
bx_pc_system_c::register_timer( void *this_ptr, void (*funct)(void *),
|
||||||
Bit32u useconds, Boolean continuous, Boolean active)
|
Bit32u useconds, Boolean continuous, Boolean active, const char *id)
|
||||||
{
|
{
|
||||||
Bit64u ticks;
|
Bit64u ticks;
|
||||||
|
|
||||||
// Convert useconds to number of ticks.
|
// Convert useconds to number of ticks.
|
||||||
ticks = (Bit64u) (double(useconds) * m_ips);
|
ticks = (Bit64u) (double(useconds) * m_ips);
|
||||||
|
|
||||||
return register_timer_ticks(this_ptr, funct, ticks, continuous, active);
|
return register_timer_ticks(this_ptr, funct, ticks, continuous, active, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bx_pc_system_c::register_timer_ticks(void* this_ptr, bx_timer_handler_t funct,
|
bx_pc_system_c::register_timer_ticks(void* this_ptr, bx_timer_handler_t funct,
|
||||||
Bit64u ticks, Boolean continuous, Boolean active)
|
Bit64u ticks, Boolean continuous, Boolean active, const char *id)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
@ -274,6 +281,8 @@ bx_pc_system_c::register_timer_ticks(void* this_ptr, bx_timer_handler_t funct,
|
|||||||
timer[i].continuous = continuous;
|
timer[i].continuous = continuous;
|
||||||
timer[i].funct = funct;
|
timer[i].funct = funct;
|
||||||
timer[i].this_ptr = this_ptr;
|
timer[i].this_ptr = this_ptr;
|
||||||
|
strncpy(timer[i].id, id, BxMaxTimerIDLen);
|
||||||
|
timer[i].id[BxMaxTimerIDLen-1] = 0; // Null terminate if not already.
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
if (ticks < currCountdown) {
|
if (ticks < currCountdown) {
|
||||||
@ -371,6 +380,17 @@ bx_pc_system_c::nullTimer(void* this_ptr)
|
|||||||
// the host computer's wall clock.
|
// the host computer's wall clock.
|
||||||
|
|
||||||
UNUSED(this_ptr);
|
UNUSED(this_ptr);
|
||||||
|
|
||||||
|
#if SpewPeriodicTimerInfo
|
||||||
|
BX_INFO(("==================================="));
|
||||||
|
for (unsigned i=0; i < bx_pc_system.numTimers; i++) {
|
||||||
|
if (bx_pc_system.timer[i].active) {
|
||||||
|
BX_INFO(("BxTimer(%s): period=%llu, continuous=%u",
|
||||||
|
bx_pc_system.timer[i].id, bx_pc_system.timer[i].period,
|
||||||
|
bx_pc_system.timer[i].continuous));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BX_DEBUGGER
|
#if BX_DEBUGGER
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: pc_system.h-kpl,v 1.1 2002-10-01 21:27:34 kevinlawton Exp $
|
// $Id: pc_system.h-kpl,v 1.2 2002-10-02 05:54:34 kevinlawton Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
@ -61,6 +61,8 @@ private:
|
|||||||
// timer fires.
|
// timer fires.
|
||||||
void *this_ptr; // The this-> pointer for C++ callbacks
|
void *this_ptr; // The this-> pointer for C++ callbacks
|
||||||
// has to be stored as well.
|
// has to be stored as well.
|
||||||
|
#define BxMaxTimerIDLen 32
|
||||||
|
char id[BxMaxTimerIDLen]; // String ID of timer.
|
||||||
} timer[BX_MAX_TIMERS];
|
} timer[BX_MAX_TIMERS];
|
||||||
|
|
||||||
unsigned numTimers; // Number of currently allocated timers.
|
unsigned numTimers; // Number of currently allocated timers.
|
||||||
@ -94,7 +96,7 @@ public:
|
|||||||
|
|
||||||
void init_ips(Bit32u ips);
|
void init_ips(Bit32u ips);
|
||||||
int register_timer( void *this_ptr, bx_timer_handler_t, Bit32u useconds,
|
int register_timer( void *this_ptr, bx_timer_handler_t, Bit32u useconds,
|
||||||
Boolean continuous, Boolean active);
|
Boolean continuous, Boolean active, const char *id);
|
||||||
void start_timers(void);
|
void start_timers(void);
|
||||||
void activate_timer( unsigned timer_index, Bit32u useconds,
|
void activate_timer( unsigned timer_index, Bit32u useconds,
|
||||||
Boolean continuous );
|
Boolean continuous );
|
||||||
@ -128,8 +130,10 @@ public:
|
|||||||
bx_pc_system.currCountdown -= n;
|
bx_pc_system.currCountdown -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int register_timer_ticks(void* this_ptr, bx_timer_handler_t, Bit64u ticks, Boolean continuous, Boolean active);
|
int register_timer_ticks(void* this_ptr, bx_timer_handler_t, Bit64u ticks,
|
||||||
void activate_timer_ticks(unsigned index, Bit64u instructions, Boolean continuous);
|
Boolean continuous, Boolean active, const char *id);
|
||||||
|
void activate_timer_ticks(unsigned index, Bit64u instructions,
|
||||||
|
Boolean continuous);
|
||||||
Bit64u time_usec();
|
Bit64u time_usec();
|
||||||
static BX_CPP_INLINE Bit64u time_ticks() {
|
static BX_CPP_INLINE Bit64u time_ticks() {
|
||||||
return bx_pc_system.ticksTotal +
|
return bx_pc_system.ticksTotal +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user