blob: d07c5480e5294335f87193ac5377b8f1a20a42e6 [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 Afanasyev2b4c9472012-08-09 15:00:38 -070027namespace ns3 {
28namespace ndn {
29namespace ndnSIM {
Alexander Afanasyev0845c092012-07-13 17:45:33 -070030
31class LoadStats
32{
33public:
34 typedef boost::tuple<double, double, double> stats_tuple;
35
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070036 static const double PRECISION;
37
Alexander Afanasyev0845c092012-07-13 17:45:33 -070038 LoadStats ();
39
40 void
41 Step ();
42
43 // void
44 // Increment (uint32_t amount);
45
46 LoadStats &
47 operator ++ (int);
Alexander Afanasyevc7719612012-08-30 17:42:20 -070048
49 LoadStats &
50 operator -- (int);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070051
52 // uint32_t
53 // GetCounter () const;
54
55 LoadStats &
56 operator += (const LoadStats &stats);
57
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070058 LoadStats &
59 operator += (uint32_t amount);
60
Alexander Afanasyev0845c092012-07-13 17:45:33 -070061 stats_tuple
62 GetStats () const;
63
64 bool
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070065 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070066
67private:
Alexander Afanasyev92b5f832012-08-16 16:39:49 -070068 uint32_t counter_;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070069
70 double avg1_;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070071 double avg2_;
72 double avg3_;
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070073
74 friend std::ostream &
75 operator << (std::ostream &os, const LoadStats &stats);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070076};
77
78std::ostream &
79operator << (std::ostream &os, const LoadStats &stats);
80
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070081} // namespace ndnSIM
82} // namespace ndn
83} // namespace ns3
Alexander Afanasyev0845c092012-07-13 17:45:33 -070084
85#endif // LOAD_STATS_H