blob: 2b2db8994051cbe47f9754035b51088ef596a201 [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
Alexander Afanasyeve77db792012-08-09 11:10:58 -070027namespace ns3
28{
Alexander Afanasyev0845c092012-07-13 17:45:33 -070029namespace ndnSIM
30{
31
32class LoadStats
33{
34public:
35 typedef boost::tuple<double, double, double> stats_tuple;
36
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070037 static const double PRECISION;
38
Alexander Afanasyev0845c092012-07-13 17:45:33 -070039 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 Afanasyev1c0248b2012-07-24 15:59:50 -070056 LoadStats &
57 operator += (uint32_t amount);
58
Alexander Afanasyev0845c092012-07-13 17:45:33 -070059 stats_tuple
60 GetStats () const;
61
62 bool
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070063 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070064
65private:
66 uint32_t counter_;
67
68 double avg1_;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070069 double avg2_;
70 double avg3_;
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070071
72 friend std::ostream &
73 operator << (std::ostream &os, const LoadStats &stats);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070074};
75
76std::ostream &
77operator << (std::ostream &os, const LoadStats &stats);
78
79} // ndnSIM
Alexander Afanasyeve77db792012-08-09 11:10:58 -070080} // ns3
Alexander Afanasyev0845c092012-07-13 17:45:33 -070081
82#endif // LOAD_STATS_H