LEFT | RIGHT |
1 // /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 // /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright © 2011 Marcos Talau | 3 * Copyright © 2011 Marcos Talau |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 m_lastSet = now; | 662 m_lastSet = now; |
663 } | 663 } |
664 } | 664 } |
665 | 665 |
666 // Compute the average queue size | 666 // Compute the average queue size |
667 double | 667 double |
668 RedQueueDisc::Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW) | 668 RedQueueDisc::Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW) |
669 { | 669 { |
670 NS_LOG_FUNCTION (this << nQueued << m << qAvg << qW); | 670 NS_LOG_FUNCTION (this << nQueued << m << qAvg << qW); |
671 | 671 |
672 double newAve = (double)(qAvg * pow(1.0-qW, m)); | 672 double newAve = qAvg * std::pow(1.0 - qW, m); |
673 newAve += qW * nQueued; | 673 newAve += qW * nQueued; |
674 | 674 |
675 Time now = Simulator::Now (); | 675 Time now = Simulator::Now (); |
676 if (m_isAdaptMaxP && now > m_lastSet + m_interval) | 676 if (m_isAdaptMaxP && now > m_lastSet + m_interval) |
677 { | 677 { |
678 UpdateMaxP (newAve); | 678 UpdateMaxP (newAve); |
679 } | 679 } |
680 else if (m_isFengAdaptive) | 680 else if (m_isFengAdaptive) |
681 { | 681 { |
682 UpdateMaxPFeng (newAve); // Update m_curMaxP in MIMD fashion. | 682 UpdateMaxPFeng (newAve); // Update m_curMaxP in MIMD fashion. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 961 |
962 if ((m_isARED || m_isAdaptMaxP) && m_isFengAdaptive) | 962 if ((m_isARED || m_isAdaptMaxP) && m_isFengAdaptive) |
963 { | 963 { |
964 NS_LOG_ERROR ("m_isAdaptMaxP and m_isFengAdaptive cannot be simultaneously
true"); | 964 NS_LOG_ERROR ("m_isAdaptMaxP and m_isFengAdaptive cannot be simultaneously
true"); |
965 } | 965 } |
966 | 966 |
967 return true; | 967 return true; |
968 } | 968 } |
969 | 969 |
970 } // namespace ns3 | 970 } // namespace ns3 |
LEFT | RIGHT |