reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofFpsCounter.h
Go to the documentation of this file.
1#pragma once
2
3// ofTime only
4#include "ofUtils.h"
5#include "ofConstants.h"
6#include <queue>
7
9public:
11 ofFpsCounter(double targetFps);
12 void newFrame();
13
14 // no need to call it usually, useful if
15 // the update rate of the source is not very
16 // consistent. calling update from the main
17 // loop for example will make the measurement
18 // update more often
19 void update();
20 double getFps() const;
21 uint64_t getNumFrames() const;
22 uint64_t getLastFrameNanos() const;
23 double getLastFrameSecs() const;
24 uint64_t getLastFrameFilteredNanos() const;
25 double getLastFrameFilteredSecs() const;
26 void setFilterAlpha(float alpha);
27
28private:
29 void update(double now);
30 uint64_t nFrameCount;
31 ofTime then;
32 double fps;
33 std::chrono::nanoseconds lastFrameTime;
34 std::chrono::nanoseconds filteredTime;
35 double filterAlpha;
36 std::queue<double> timestamps;
37};
Definition ofFpsCounter.h:8
double getLastFrameFilteredSecs() const
Definition ofFpsCounter.cpp:74
void setFilterAlpha(float alpha)
Definition ofFpsCounter.cpp:78
uint64_t getLastFrameNanos() const
Definition ofFpsCounter.cpp:62
void newFrame()
Definition ofFpsCounter.cpp:21
void update()
Definition ofFpsCounter.cpp:33
ofFpsCounter()
Definition ofFpsCounter.cpp:3
uint64_t getLastFrameFilteredNanos() const
Definition ofFpsCounter.cpp:70
double getLastFrameSecs() const
Definition ofFpsCounter.cpp:66
double getFps() const
Definition ofFpsCounter.cpp:54
uint64_t getNumFrames() const
Definition ofFpsCounter.cpp:58
Definition ofUtils.h:101