Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
This commit is contained in:
1 parent
84a896a250
commit
76cad5e2ce
2 files changed
+8
-8
No files matched your search
@@ -243,7 +243,7 @@ DcfManager::DcfManager ()
|
||||
m_lastSwitchingStart (MicroSeconds (0)),
|
||||
m_lastSwitchingDuration (MicroSeconds (0)),
|
||||
m_rxing (false),
|
||||
m_slotTime (Seconds (0.0)),
|
||||
m_slotTimeUs (0),
|
||||
m_sifs (Seconds (0.0)),
|
||||
m_phyListener (0),
|
||||
m_lowListener (0)
|
||||
@@ -273,7 +273,7 @@ DcfManager::SetupLowListener (Ptr<MacLow> low)
|
||||
void
|
||||
DcfManager::SetSlot (Time slotTime)
|
||||
{
|
||||
m_slotTime = slotTime;
|
||||
m_slotTimeUs = slotTime.GetMicroSeconds ();
|
||||
}
|
||||
void
|
||||
DcfManager::SetSifs (Time sifs)
|
||||
@@ -493,7 +493,7 @@ Time
|
||||
DcfManager::GetBackoffStartFor (DcfState *state)
|
||||
{
|
||||
Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
|
||||
GetAccessGrantStart () + Scalar (state->GetAifsn ()) * m_slotTime);
|
||||
GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
|
||||
|
||||
return mostRecentEvent;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ DcfManager::GetBackoffStartFor (DcfState *state)
|
||||
Time
|
||||
DcfManager::GetBackoffEndFor (DcfState *state)
|
||||
{
|
||||
return GetBackoffStartFor (state) + Scalar (state->GetBackoffSlots ()) * m_slotTime;
|
||||
return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -515,11 +515,11 @@ DcfManager::UpdateBackoff (void)
|
||||
Time backoffStart = GetBackoffStartFor (state);
|
||||
if (backoffStart <= Simulator::Now ())
|
||||
{
|
||||
Scalar nSlots = (Simulator::Now () - backoffStart) / m_slotTime;
|
||||
uint32_t nIntSlots = lrint (nSlots.GetDouble ());
|
||||
uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds ();
|
||||
uint32_t nIntSlots = nus / m_slotTimeUs;
|
||||
uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ());
|
||||
MY_DEBUG ("dcf " << k << " dec backoff slots=" << n);
|
||||
Time backoffUpdateBound = backoffStart + Scalar (n) * m_slotTime;
|
||||
Time backoffUpdateBound = backoffStart + MicroSeconds (n * m_slotTimeUs);
|
||||
state->UpdateBackoffSlotsNow (n, backoffUpdateBound);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ private:
|
||||
bool m_sleeping;
|
||||
Time m_eifsNoDifs;
|
||||
EventId m_accessTimeout;
|
||||
Time m_slotTime;
|
||||
uint32_t m_slotTimeUs;
|
||||
Time m_sifs;
|
||||
class PhyListener *m_phyListener;
|
||||
class LowDcfListener *m_lowListener;
|
||||
|
||||
Reference in new issue
Block a user