summaryrefslogtreecommitdiff
path: root/src/common.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-12 22:51:20 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-12 22:51:20 +0200
commit445505ada572fbf7be3ce474a1af31419ff68c2b (patch)
tree110a123eb999a03a6da01c7933a24a96686b2219 /src/common.hpp
parent35ee11e5c1a468530bce671c797eccffc2a1c330 (diff)
Better game timing and better FPS/TPS display.
Diffstat (limited to 'src/common.hpp')
-rw-r--r--src/common.hpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/common.hpp b/src/common.hpp
index 1cd1921..bb95f0e 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -40,6 +40,27 @@ extern bool debug_AI;
typedef uint64_t ntime_t;
ntime_t nclock(void);
+class freq_counter_t {
+ ntime_t *samples;
+ size_t num_samples, collected = 0;
+ ntime_t last_tick = 0;
+
+ float last_ma;
+ ntime_t last_ma_time = 0;
+
+ void push(ntime_t sample);
+
+public:
+ freq_counter_t(size_t num_samples_);
+ ~freq_counter_t(void);
+
+ void tick(void);
+ float freq_ma(void);
+};
+
+extern freq_counter_t fc_render;
+extern freq_counter_t fc_game;
+
namespace procgen {
class prng_t {
uint32_t state = 0;
@@ -351,9 +372,6 @@ namespace interface {
std::list<log_entry_t> log;
- double perf_hist[10] = {0};
- size_t perf_hist_index = 0;
-
void start_following(void);
void stop_following(void);