blob: 3e71753212be9005142b5de77cd06e9addf3a7f9 [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);
48
49 // uint32_t
50 // GetCounter () const;
51
52 LoadStats &
53 operator += (const LoadStats &stats);
54
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070055 LoadStats &
56 operator += (uint32_t amount);
57
Alexander Afanasyev0845c092012-07-13 17:45:33 -070058 stats_tuple
59 GetStats () const;
60
61 bool
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070062 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070063
64private:
Alexander Afanasyev92b5f832012-08-16 16:39:49 -070065 uint32_t counter_;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070066
67 double avg1_;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070068 double avg2_;
69 double avg3_;
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070070
71 friend std::ostream &
72 operator << (std::ostream &os, const LoadStats &stats);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070073};
74
75std::ostream &
76operator << (std::ostream &os, const LoadStats &stats);
77
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070078} // namespace ndnSIM
79} // namespace ndn
80} // namespace ns3
Alexander Afanasyev0845c092012-07-13 17:45:33 -070081
82#endif // LOAD_STATS_H