schneiderklaus | d8197df | 2019-03-16 11:31:40 -0700 | [diff] [blame] | 1 | /* |
Davide Pesavento | b3570c6 | 2022-02-19 19:19:00 -0500 | [diff] [blame] | 2 | * Copyright (c) 2016-2022, Regents of the University of California, |
schneiderklaus | d8197df | 2019-03-16 11:31:40 -0700 | [diff] [blame] | 3 | * Colorado State University, |
| 4 | * University Pierre & Marie Curie, Sorbonne University. |
Weiwei Liu | 245d791 | 2016-07-28 00:04:25 -0700 | [diff] [blame] | 5 | * |
| 6 | * This file is part of ndn-tools (Named Data Networking Essential Tools). |
| 7 | * See AUTHORS.md for complete list of ndn-tools authors and contributors. |
| 8 | * |
| 9 | * ndn-tools is free software: you can redistribute it and/or modify it under the terms |
| 10 | * of the GNU General Public License as published by the Free Software Foundation, |
| 11 | * either version 3 of the License, or (at your option) any later version. |
| 12 | * |
| 13 | * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 14 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along with |
| 18 | * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 21 | * |
| 22 | * @author Weiwei Liu |
| 23 | */ |
| 24 | |
schneiderklaus | d8197df | 2019-03-16 11:31:40 -0700 | [diff] [blame] | 25 | #include "statistics-collector.hpp" |
Weiwei Liu | 245d791 | 2016-07-28 00:04:25 -0700 | [diff] [blame] | 26 | |
Davide Pesavento | b3570c6 | 2022-02-19 19:19:00 -0500 | [diff] [blame] | 27 | namespace ndn::chunks { |
Weiwei Liu | 245d791 | 2016-07-28 00:04:25 -0700 | [diff] [blame] | 28 | |
Davide Pesavento | 7057640 | 2019-06-07 16:42:21 -0400 | [diff] [blame] | 29 | StatisticsCollector::StatisticsCollector(PipelineInterestsAdaptive& pipeline, |
Weiwei Liu | 245d791 | 2016-07-28 00:04:25 -0700 | [diff] [blame] | 30 | std::ostream& osCwnd, std::ostream& osRtt) |
| 31 | : m_osCwnd(osCwnd) |
| 32 | , m_osRtt(osRtt) |
| 33 | { |
| 34 | m_osCwnd << "time\tcwndsize\n"; |
| 35 | m_osRtt << "segment\trtt\trttvar\tsrtt\trto\n"; |
Davide Pesavento | 5e3773d | 2019-08-22 15:35:08 -0400 | [diff] [blame] | 36 | |
| 37 | pipeline.afterCwndChange.connect([this] (time::nanoseconds timeElapsed, double cwnd) { |
| 38 | m_osCwnd << timeElapsed.count() / 1e9 << '\t' << cwnd << '\n'; |
| 39 | }); |
| 40 | |
| 41 | pipeline.afterRttMeasurement.connect([this] (const auto& sample) { |
| 42 | m_osRtt << sample.segNum << '\t' |
| 43 | << sample.rtt.count() / 1e6 << '\t' |
| 44 | << sample.rttVar.count() / 1e6 << '\t' |
| 45 | << sample.sRtt.count() / 1e6 << '\t' |
| 46 | << sample.rto.count() / 1e6 << '\n'; |
| 47 | }); |
Weiwei Liu | 245d791 | 2016-07-28 00:04:25 -0700 | [diff] [blame] | 48 | } |
| 49 | |
Davide Pesavento | b3570c6 | 2022-02-19 19:19:00 -0500 | [diff] [blame] | 50 | } // namespace ndn::chunks |