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 (c) 2016 ResiliNets, ITTC, University of Kansas | 3 * Copyright (c) 2016 ResiliNets, ITTC, University of Kansas |
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 void | 135 void |
136 TcpVenoTest::DoRun () | 136 TcpVenoTest::DoRun () |
137 { | 137 { |
138 m_state = CreateObject<TcpSocketState> (); | 138 m_state = CreateObject<TcpSocketState> (); |
139 | 139 |
140 m_state->m_cWnd = m_cWnd; | 140 m_state->m_cWnd = m_cWnd; |
141 m_state->m_segmentSize = m_segmentSize; | 141 m_state->m_segmentSize = m_segmentSize; |
142 m_state->m_ssThresh = m_ssThresh; | 142 m_state->m_ssThresh = m_ssThresh; |
| 143 m_state->m_minRtt = m_rtt; |
143 | 144 |
144 Ptr<TcpVeno> cong = CreateObject <TcpVeno> (); | 145 Ptr<TcpVeno> cong = CreateObject <TcpVeno> (); |
145 | 146 |
146 // Set baseRtt to 100 ms | 147 // Set baseRtt to 100 ms |
147 Time baseRtt = MilliSeconds (100); | 148 Time baseRtt = MilliSeconds (100); |
148 cong->PktsAcked (m_state, m_segmentsAcked, baseRtt); | 149 cong->PktsAcked (m_state, m_segmentsAcked, baseRtt); |
149 | 150 |
150 // Re-set Veno to assign a new value of minRtt | 151 // Re-set Veno to assign a new value of minRtt |
151 cong->CongestionStateSet (m_state, TcpSocketState::CA_OPEN); | 152 cong->CongestionStateSet (m_state, TcpSocketState::CA_OPEN); |
152 | 153 |
153 uint32_t segCwnd = m_cWnd / m_segmentSize; | 154 uint32_t segCwnd = m_cWnd / m_segmentSize; |
154 | 155 |
155 // Calculate expected throughput | 156 // Calculate expected throughput |
156 uint32_t expectedCwnd; | 157 uint32_t expectedCwnd; |
157 double tmp = baseRtt.GetSeconds () / m_rtt.GetSeconds (); | 158 double tmp = baseRtt.GetSeconds () / m_rtt.GetSeconds (); |
158 expectedCwnd = static_cast<uint32_t>(segCwnd * tmp); | 159 expectedCwnd = static_cast<uint32_t> (segCwnd * tmp); |
159 | 160 |
160 // Calculate the difference between actual and expected throughput | 161 // Calculate the difference between actual and expected throughput |
161 uint32_t diff; | 162 uint32_t diff; |
162 diff = segCwnd - expectedCwnd; | 163 diff = segCwnd - expectedCwnd; |
163 | 164 |
164 // Get the beta attribute | 165 // Get the beta attribute |
165 UintegerValue beta; | 166 UintegerValue beta; |
166 cong->GetAttribute ("Beta", beta); | 167 cong->GetAttribute ("Beta", beta); |
167 | 168 |
168 uint32_t cntRtt = 0; | 169 uint32_t cntRtt = 0; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 TestCase::QUICK); | 312 TestCase::QUICK); |
312 AddTestCase (new TcpVenoTest (60 * 536, 536, 40 * 536, MilliSeconds (106), 1
, 3, | 313 AddTestCase (new TcpVenoTest (60 * 536, 536, 40 * 536, MilliSeconds (106), 1
, 3, |
313 "Veno increment test on cWnd with diff > beta"
), | 314 "Veno increment test on cWnd with diff > beta"
), |
314 TestCase::QUICK); | 315 TestCase::QUICK); |
315 } | 316 } |
316 }; | 317 }; |
317 | 318 |
318 static TcpVenoTestSuite g_tcpVenoTest; //!< Static variable for test initializat
ion | 319 static TcpVenoTestSuite g_tcpVenoTest; //!< Static variable for test initializat
ion |
319 | 320 |
320 | 321 |
LEFT | RIGHT |