blob: 0b03ce5bc38559257f6c4eb072daa1043b1638be [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
54 stats_tuple
55 GetStats () const;
56
57 bool
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070058 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070059
60private:
61 uint32_t counter_;
62
63 double avg1_;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070064 double avg2_;
65 double avg3_;
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070066
67 friend std::ostream &
68 operator << (std::ostream &os, const LoadStats &stats);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070069};
70
71std::ostream &
72operator << (std::ostream &os, const LoadStats &stats);
73
74} // ndnSIM
75
76#endif // LOAD_STATS_H