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