From 1aeb4c71b1640dc6ec3271311273e260c72ef2d8 Mon Sep 17 00:00:00 2001 From: Kevin Lawton Date: Wed, 2 Oct 2002 05:54:34 +0000 Subject: [PATCH] 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. --- bochs/patches/pc_system.cc-kpl | 28 ++++++++++++++++++++++++---- bochs/patches/pc_system.h-kpl | 12 ++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/bochs/patches/pc_system.cc-kpl b/bochs/patches/pc_system.cc-kpl index 8c978535f..a3379c5e7 100644 --- a/bochs/patches/pc_system.cc-kpl +++ b/bochs/patches/pc_system.cc-kpl @@ -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. @@ -47,11 +47,18 @@ double m_ips; // Millions of Instructions Per Second // Option for turning off BX_TIMER_DEBUG? // Check out m_ips and ips +#define SpewPeriodicTimerInfo 0 #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. const Bit64u bx_pc_system_c::NullTimerInterval = 0xffffffff; +#endif // constructor bx_pc_system_c::bx_pc_system_c(void) @@ -232,19 +239,19 @@ bx_pc_system_c::exit(void) int 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; // Convert useconds to number of ticks. 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 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; @@ -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].funct = funct; 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 (ticks < currCountdown) { @@ -371,6 +380,17 @@ bx_pc_system_c::nullTimer(void* this_ptr) // the host computer's wall clock. 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 diff --git a/bochs/patches/pc_system.h-kpl b/bochs/patches/pc_system.h-kpl index e089b0438..687806bf0 100644 --- a/bochs/patches/pc_system.h-kpl +++ b/bochs/patches/pc_system.h-kpl @@ -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. @@ -61,6 +61,8 @@ private: // timer fires. void *this_ptr; // The this-> pointer for C++ callbacks // has to be stored as well. +#define BxMaxTimerIDLen 32 + char id[BxMaxTimerIDLen]; // String ID of timer. } timer[BX_MAX_TIMERS]; unsigned numTimers; // Number of currently allocated timers. @@ -94,7 +96,7 @@ public: void init_ips(Bit32u ips); 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 activate_timer( unsigned timer_index, Bit32u useconds, Boolean continuous ); @@ -128,8 +130,10 @@ public: bx_pc_system.currCountdown -= n; } - int register_timer_ticks(void* this_ptr, bx_timer_handler_t, Bit64u ticks, Boolean continuous, Boolean active); - void activate_timer_ticks(unsigned index, Bit64u instructions, Boolean continuous); + int register_timer_ticks(void* this_ptr, bx_timer_handler_t, Bit64u ticks, + Boolean continuous, Boolean active, const char *id); + void activate_timer_ticks(unsigned index, Bit64u instructions, + Boolean continuous); Bit64u time_usec(); static BX_CPP_INLINE Bit64u time_ticks() { return bx_pc_system.ticksTotal +