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*/));
}

View File

@ -34,6 +34,8 @@
#define MULTIPLE_SNAPSHOTS 0
#define MULTIPLE_SNAPSHOTS_DISTANCE 1000000
#define TIMER_GRANULARITY 10 // microseconds
using namespace std;
using namespace fail;
@ -183,7 +185,7 @@ bool EcosKernelTestExperiment::performTrace(guest_address_t addr_entry, guest_ad
unsigned instr_counter = 0;
// on the way, count elapsed time
TimerListener time_step(10); //TODO: granularity?
TimerListener time_step(TIMER_GRANULARITY); //TODO: granularity?
//elapsed_time.setCounter(0xFFFFFFFFU); // not working for TimerListener
simulator.addListener(&time_step);
unsigned elapsed_time = 1; // always run 1 step
@ -237,7 +239,7 @@ bool EcosKernelTestExperiment::performTrace(guest_address_t addr_entry, guest_ad
log << dec << "tracing finished after " << instr_counter << " instructions" << endl;
log << hex << "all memory accesses within [ 0x" << lowest_addr << " , 0x" << highest_addr << " ]" << endl;
log << dec << "elapsed time: " << estimated_timeout << " [TimerListener units]" << endl;
log << dec << "elapsed simulated time (plus safety margin): " << (estimated_timeout * TIMER_GRANULARITY / 1000000.0) << "s" << endl;
// save these values for experiment STEP 3
EcosKernelTestCampaign::writeTraceInfo(instr_counter, estimated_timeout, lowest_addr, highest_addr);

View File

@ -128,7 +128,7 @@ BaseListener *L4SysExperiment::singleStep(bool preserveAddressSpace) {
/* prepare for the case that the kernel panics and never
switches back to this thread by introducing a scheduling timeout
of 10 seconds */
TimerListener schedTimeout(10000);
TimerListener schedTimeout(10000000);
simulator.addListener(&schedTimeout);
BaseListener *ev = waitIOOrOther(false);
simulator.removeListener(&singlestepping_event);
@ -168,7 +168,7 @@ unsigned L4SysExperiment::calculateTimeout(unsigned instr_left) {
// [instr] / [instr / s] = [s]
unsigned seconds = instr_left / L4SYS_BOCHS_IPS + 1;
// 1.1 (+10 percent) * 1000 ms/s * [s]
return 1100 * seconds;
return 1100000 * seconds;
}
L4SysExperiment::L4SysExperiment()

View File

@ -8,7 +8,7 @@
#define NANOJPEG_RESULTS "nanojpeg.csv"
//#define NANOJPEG_INSTR_LIMIT 999999999 // currently "unlimited"
#define NANOJPEG_INSTR_LIMIT 1000000
#define NANOJPEG_TIMEOUT 1000 // 1s
#define NANOJPEG_TIMEOUT 1000000 // 1s
#define NANOJPEG_GOLDEN_PPM "golden.ppm"
#define NANOJPEG_STATE "bochs.state"

View File

@ -73,14 +73,14 @@ bool RAMpageCampaign::run()
d->msg.set_errortype(d->msg.ERROR_STUCK_AT_1);
//d->msg.set_empty_passes(2);
d->msg.set_empty_passes(4);
//d->msg.set_local_timeout(1000*60*10); // 10m
//d->msg.set_global_timeout(1000*60*50); // 50m
//d->msg.set_local_timeout(1000*60*20); // 20m
//d->msg.set_global_timeout(1000*60*90); // 90m
//d->msg.set_local_timeout(1000*60*20); // 20m
//d->msg.set_global_timeout(1000*60*120); // 120m
d->msg.set_local_timeout(1000*60*30); // 30m
d->msg.set_global_timeout(1000*60*120); // 120m
//d->msg.set_local_timeout(1000000*60*10); // 10m
//d->msg.set_global_timeout(1000000*60*50); // 50m
//d->msg.set_local_timeout(1000000*60*20); // 20m
//d->msg.set_global_timeout(1000000*60*90); // 90m
//d->msg.set_local_timeout(1000000*60*20); // 20m
//d->msg.set_global_timeout(1000000*60*120); // 120m
d->msg.set_local_timeout(1000000*60*30); // 30m
d->msg.set_global_timeout(1000000*60*120); // 120m
campaignmanager.addParam(d);
}
campaignmanager.noMoreParameters();