Add FPS counter

Remove frame counter from scrcpy.c and add a new FPS counter, logging as
INFO the measured frame rate every second (on new frame).
This commit is contained in:
Romain Vimont
2018-02-15 11:10:58 +01:00
parent c6c17af840
commit 38e6682875
6 changed files with 99 additions and 21 deletions

26
app/src/fpscounter.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef FPSCOUNTER_H
#define FPSCOUNTER_H
#include <SDL2/SDL_stdinc.h>
#include "config.h"
struct fps_counter {
SDL_bool started;
Uint32 slice_start; // initialized by SDL_GetTicks()
int nr_rendered;
#ifdef SKIP_FRAMES
int nr_skipped;
#endif
};
void fps_counter_init(struct fps_counter *counter);
void fps_counter_start(struct fps_counter *counter);
void fps_counter_stop(struct fps_counter *counter);
void fps_counter_add_rendered_frame(struct fps_counter *counter);
#ifdef SKIP_FRAMES
void fps_counter_add_skipped_frame(struct fps_counter *counter);
#endif
#endif