areaDetector 3-14
EPICS areaDetector framework
throttler.h
Go to the documentation of this file.
1#ifndef THROTTLER_H
2#define THROTTLER_H
3
4#include <epicsTime.h>
5
6class Throttler {
7
8public:
9 Throttler(double limit=0.0);
10 void reset(double limit);
11 double refill();
12 bool tryTake(double tokens);
13
14private:
15 double limit_; // Max tokens per second
16 double available_; // Available tokens
17 double refillAmount_; // How much to refill every msec
18 epicsTimeStamp lastRefill_; // When did the last refill happen
19};
20
21#endif
Definition throttler.h:6
double refill()
Definition throttler.cpp:17
void reset(double limit)
Definition throttler.cpp:10
bool tryTake(double tokens)
Definition throttler.cpp:32