Add counters for MPTP buffers and syscalls.
[swifty.git] / src / libswift / avgspeed.h
1 /*
2  *  avgspeed.h
3  *  Class to compute moving average speed
4  *
5  *  Created by Arno Bakker
6  *  Copyright 2009 Delft University of Technology. All rights reserved.
7  *
8  */
9 #include "compat.h"
10
11 #ifndef AVGSPEED_H
12 #define AVGSPEED_H
13
14 namespace swift {
15
16
17 class MovingAverageSpeed
18 {
19     public: 
20                 MovingAverageSpeed( tint speed_interval = 5 * TINT_SEC, tint fudge = TINT_SEC );
21                 void AddPoint( uint64_t amount );
22         double GetSpeed();
23         double GetSpeedNeutral();
24         void Reset();
25     protected:
26         tint   speed_interval_;
27         tint   t_start_;
28         tint   t_end_;
29         double speed_;
30         tint   fudge_;
31         bool   resetstate_;
32 };
33
34 }
35
36 #endif