nngn
Loading...
Searching...
No Matches
fps.h
Go to the documentation of this file.
1#ifndef NNGN_FPS_H
2#define NNGN_FPS_H
3
4#include <chrono>
5#include <queue>
6#include <string>
7
8#include "timing.h"
9
10namespace nngn {
11
12struct FPS {
13 using frame_queue = std::queue<Timing::clock::duration>;
14 static constexpr frame_queue::size_type default_size = 60;
15 Timing::clock::time_point last_f = {}, last_t = {};
16 Timing::clock::duration min_dt = {}, max_dt = {};
17 Timing::clock::duration avg_sum = {};
19 float avg = 0;
20 size_t sec_count = 0, sec_last = 0;
22 explicit FPS(frame_queue::size_type n);
23 void init(Timing::clock::time_point t);
24 void frame(Timing::clock::time_point t);
25 void reset_min_max();
26 std::string to_string() const;
27};
28
29}
30
31#endif
local n
Definition dump_lights.lua:5
init
Definition img_common.lua:34
Definition audio.cpp:7
Definition fps.h:12
frame_queue avg_hist
Definition fps.h:18
Timing::clock::duration min_dt
Definition fps.h:16
void reset_min_max()
Definition fps.cpp:43
static constexpr frame_queue::size_type default_size
Definition fps.h:14
size_t sec_last
Definition fps.h:20
size_t sec_count
Definition fps.h:20
std::queue< Timing::clock::duration > frame_queue
Definition fps.h:13
FPS()
Definition fps.h:21
std::string to_string() const
Definition fps.cpp:49
void frame(Timing::clock::time_point t)
Definition fps.cpp:20
Timing::clock::time_point last_t
Definition fps.h:15
Timing::clock::time_point last_f
Definition fps.h:15
Timing::clock::duration avg_sum
Definition fps.h:17
Timing::clock::duration max_dt
Definition fps.h:16
float avg
Definition fps.h:19