Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 4 | * |
| 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 |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef LOAD_STATS_H |
| 22 | #define LOAD_STATS_H |
| 23 | |
| 24 | #include "ns3/nstime.h" |
| 25 | #include <boost/tuple/tuple.hpp> |
| 26 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 27 | namespace ns3 { |
| 28 | namespace ndn { |
| 29 | namespace ndnSIM { |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 30 | |
| 31 | class LoadStats |
| 32 | { |
| 33 | public: |
| 34 | typedef boost::tuple<double, double, double> stats_tuple; |
| 35 | |
Alexander Afanasyev | e55d1e3 | 2012-07-19 15:33:05 -0700 | [diff] [blame] | 36 | static const double PRECISION; |
| 37 | |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 38 | LoadStats (); |
| 39 | |
| 40 | void |
| 41 | Step (); |
| 42 | |
| 43 | // void |
| 44 | // Increment (uint32_t amount); |
| 45 | |
| 46 | LoadStats & |
| 47 | operator ++ (int); |
Alexander Afanasyev | c771961 | 2012-08-30 17:42:20 -0700 | [diff] [blame] | 48 | |
| 49 | LoadStats & |
| 50 | operator -- (int); |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 51 | |
| 52 | // uint32_t |
| 53 | // GetCounter () const; |
| 54 | |
| 55 | LoadStats & |
| 56 | operator += (const LoadStats &stats); |
| 57 | |
Alexander Afanasyev | 1c0248b | 2012-07-24 15:59:50 -0700 | [diff] [blame] | 58 | LoadStats & |
| 59 | operator += (uint32_t amount); |
| 60 | |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 61 | stats_tuple |
| 62 | GetStats () const; |
| 63 | |
| 64 | bool |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 65 | IsZero () const; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 66 | |
| 67 | private: |
Alexander Afanasyev | 92b5f83 | 2012-08-16 16:39:49 -0700 | [diff] [blame] | 68 | uint32_t counter_; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 69 | |
| 70 | double avg1_; |
Alexander Afanasyev | e55d1e3 | 2012-07-19 15:33:05 -0700 | [diff] [blame] | 71 | double avg2_; |
| 72 | double avg3_; |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 73 | |
| 74 | friend std::ostream & |
| 75 | operator << (std::ostream &os, const LoadStats &stats); |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | std::ostream & |
| 79 | operator << (std::ostream &os, const LoadStats &stats); |
| 80 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 81 | } // namespace ndnSIM |
| 82 | } // namespace ndn |
| 83 | } // namespace ns3 |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 84 | |
| 85 | #endif // LOAD_STATS_H |