Image Component Library (ICL)
FPSEstimator.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLUtils/src/ICLUtils/FPSEstimator.h **
10 ** Module : ICLUtils **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Time.h>
35 #include <deque>
36 #include <string>
37 
38 namespace icl{
39  namespace utils{
42  public:
43 
45 
46  FPSEstimator(int n=2);
47 
49  virtual ~FPSEstimator() {}
50 
52  void reset(int n);
53 
55  virtual void tic() const;
56 
58  virtual float getFPSVal() const;
59 
61  virtual std::string getFPSString(const std::string &fmt="%3.4f fps", int bufferSize=30) const;
62 
64  virtual void showFPS(const std::string &text="") const;
65 
66  private:
68  mutable std::deque<Time> m_qTimes;
69 
71  int m_iN;
72  };
73 
74  #define FPS_LOG_THIS_FUNCTION(N) static FPSEstimator __FPSEstimator__((N)); \
75  __FPSEstimator__.showFps(__FUNCTION__);
76 
77  } // namespace utils
78 }
79 
80 
undocument this line if you encounter any issues!
Definition: Any.h:37
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
ICLQt_API void text(ImgQ &image, int x, int y, const string &text)
renders a text into an image (only available with Qt-Support)
std::deque< Time > m_qTimes
internal time queue
Definition: FPSEstimator.h:68
virtual ~FPSEstimator()
virtual destructor
Definition: FPSEstimator.h:49
int m_iN
time-queues size
Definition: FPSEstimator.h:71
ICLQt_API void tic(const std::string &label="")
starts a timer
Utility clas for online FPS estimation.
Definition: FPSEstimator.h:41