blob: abd09a000008fd11ef65fbbe0bb8087c527c8155 [file] [log] [blame]
Alexander Afanasyev0845c092012-07-13 17:45:33 -07001/* -*- 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
27namespace ndnSIM
28{
29
30class LoadStats
31{
32public:
33 typedef boost::tuple<double, double, double> stats_tuple;
34
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070035 static const double PRECISION;
36
Alexander Afanasyev0845c092012-07-13 17:45:33 -070037 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 Afanasyev1c0248b2012-07-24 15:59:50 -070054 LoadStats &
55 operator += (uint32_t amount);
56
Alexander Afanasyev0845c092012-07-13 17:45:33 -070057 stats_tuple
58 GetStats () const;
59
60 bool
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070061 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070062
63private:
64 uint32_t counter_;
65
66 double avg1_;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070067 double avg2_;
68 double avg3_;
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070069
70 friend std::ostream &
71 operator << (std::ostream &os, const LoadStats &stats);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070072};
73
74std::ostream &
75operator << (std::ostream &os, const LoadStats &stats);
76
77} // ndnSIM
78
79#endif // LOAD_STATS_H