TimerListener: microsecond granularity (ms is too coarse)

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1952 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-11-23 15:35:08 +00:00
parent b9fcba33ac
commit 5135c79c05
6 changed files with 19 additions and 17 deletions

View File

@ -584,14 +584,14 @@ public:
*/
class TimerListener : public BaseListener {
protected:
unsigned m_Timeout; //!< timeout interval in milliseconds
unsigned m_Timeout; //!< timeout interval in microseconds
GenericTimerEvent m_Data;
public:
/**
* Creates a new timer listener. This can be used to implement a timeout-
* mechanism in the experiment-flow. The timer starts automatically when
* added to the simulator backend.
* @param timeout the time interval in milliseconds (ms)
* @param timeout the (simulated) time interval in microseconds
* @see SimulatorController::addListener
*/
TimerListener(unsigned timeout) : m_Timeout(timeout) { }
@ -608,7 +608,7 @@ public:
void setId(timer_id_t id) { m_Data.setId(id); }
/**
* Retrieves the timer's timeout value.
* @return the timout in milliseconds
* @return the timout in microseconds
*/
unsigned getTimeout() const { return m_Timeout; }
};

View File

@ -40,7 +40,7 @@ aspect BochsListener {
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
return static_cast<timer_id_t>(
bx_pc_system.register_timer(pev, fail::onTimerTrigger,
pev->getTimeout() * 1000 /*timeout in microseconds*/,
pev->getTimeout() /*timeout in microseconds*/,
false /*non-continuous*/,
true /*start immediately*/, "Fail*: BochsController"/*name*/));
}