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 | e77db79 | 2012-08-09 11:10:58 -0700 | [diff] [blame^] | 27 | namespace ns3 |
| 28 | { |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 29 | namespace ndnSIM |
| 30 | { |
| 31 | |
| 32 | class LoadStats |
| 33 | { |
| 34 | public: |
| 35 | typedef boost::tuple<double, double, double> stats_tuple; |
| 36 | |
Alexander Afanasyev | e55d1e3 | 2012-07-19 15:33:05 -0700 | [diff] [blame] | 37 | static const double PRECISION; |
| 38 | |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 39 | LoadStats (); |
| 40 | |
| 41 | void |
| 42 | Step (); |
| 43 | |
| 44 | // void |
| 45 | // Increment (uint32_t amount); |
| 46 | |
| 47 | LoadStats & |
| 48 | operator ++ (int); |
| 49 | |
| 50 | // uint32_t |
| 51 | // GetCounter () const; |
| 52 | |
| 53 | LoadStats & |
| 54 | operator += (const LoadStats &stats); |
| 55 | |
Alexander Afanasyev | 1c0248b | 2012-07-24 15:59:50 -0700 | [diff] [blame] | 56 | LoadStats & |
| 57 | operator += (uint32_t amount); |
| 58 | |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 59 | stats_tuple |
| 60 | GetStats () const; |
| 61 | |
| 62 | bool |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 63 | IsZero () const; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 64 | |
| 65 | private: |
| 66 | uint32_t counter_; |
| 67 | |
| 68 | double avg1_; |
Alexander Afanasyev | e55d1e3 | 2012-07-19 15:33:05 -0700 | [diff] [blame] | 69 | double avg2_; |
| 70 | double avg3_; |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 71 | |
| 72 | friend std::ostream & |
| 73 | operator << (std::ostream &os, const LoadStats &stats); |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | std::ostream & |
| 77 | operator << (std::ostream &os, const LoadStats &stats); |
| 78 | |
| 79 | } // ndnSIM |
Alexander Afanasyev | e77db79 | 2012-08-09 11:10:58 -0700 | [diff] [blame^] | 80 | } // ns3 |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 81 | |
| 82 | #endif // LOAD_STATS_H |