From d6db829f9d98bb909107f08b0461272b2c21ab0e Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 2 Jul 2021 10:25:56 +0200 Subject: Debug simulator --- src/Inputs.cc | 6 ++++-- src/simulator.cc | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Inputs.cc b/src/Inputs.cc index 0781be8..e9f48f0 100644 --- a/src/Inputs.cc +++ b/src/Inputs.cc @@ -101,6 +101,7 @@ double Inputs::GetHintTS(double clock){ if(wake_ts[i]>=(clock+hintdist)) return(wake_ts[i]); } + return(wake_ts.back()); } return(GetNextTS()); } @@ -111,6 +112,7 @@ double Inputs::GetHintDuration(double clock){ if(wake_ts[i]>=(clock+hintdist)) return(wake_duration[i]); } + return(wake_duration.back()); } return GetNextDuration(); } @@ -122,9 +124,9 @@ void Inputs::GotoNextEvent(){ void Inputs::ResetEvents(double clock){ wake_ts=wake_ts_backup; - wake_duration=wake_duration_backup;; + wake_duration=wake_duration_backup; // Restore current event - while(HasNext() && (GetTS()+GetNextDuration()) < clock){ + while(HasNext() && (GetNextTS()+GetNextDuration()) < clock){ GotoNextEvent(); } } diff --git a/src/simulator.cc b/src/simulator.cc index 865aabc..a0b55bd 100644 --- a/src/simulator.cc +++ b/src/simulator.cc @@ -285,6 +285,9 @@ static void obs_node(std::vector args) { } if(i.shutdown_on_rcv) upuntil=CLOCK; + // Check if we use unschedule_on_rcv + if(i.unschedule_on_rcv) + i.ResetEvents(CLOCK); nDataRcv++; isObserver=true; is_sender=false; @@ -344,11 +347,9 @@ static void obs_node(std::vector args) { uptime=upuntil-CLOCK; // Note that uptime can be < 0 in extended mode uptime=uptime > 0 ? uptime : 0; // Just in case } - // Check if we use unschedule_on_rcv - if(i.unschedule_on_rcv) - i.ResetEvents(CLOCK); // Load next event i.GotoNextEvent(); + nWakeUp++; // Increase the number of wake up totalUptime+=CLOCK-upsince; // Synchronize total uptime } -- cgit v1.2.3