summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e3ce910)
Make it a local variable in fps_meter_update.
struct fps_meter_stats {
struct timespec time_start;
struct timespec time_end;
struct fps_meter_stats {
struct timespec time_start;
struct timespec time_end;
- struct timespec elapsed;
unsigned int frames;
double nsecs;
unsigned int frames;
double nsecs;
static void fps_meter_update(struct fps_meter_stats *stats)
{
static void fps_meter_update(struct fps_meter_stats *stats)
{
+ struct timespec elapsed;
+
dbg("Start time: s: %ld, ns: %ld", stats->time_start.tv_sec, stats->time_start.tv_nsec);
clock_gettime(CLOCK_MONOTONIC, &stats->time_end);
dbg("End time: s: %ld, ns: %ld", stats->time_end.tv_sec, stats->time_end.tv_nsec);
dbg("Start time: s: %ld, ns: %ld", stats->time_start.tv_sec, stats->time_start.tv_nsec);
clock_gettime(CLOCK_MONOTONIC, &stats->time_end);
dbg("End time: s: %ld, ns: %ld", stats->time_end.tv_sec, stats->time_end.tv_nsec);
- timespecsub(&stats->time_end, &stats->time_start, &stats->elapsed);
- dbg("Elapsed s: %ld ns: %ld", stats->elapsed.tv_sec, stats->elapsed.tv_nsec);
+ timespecsub(&stats->time_end, &stats->time_start, &elapsed);
+ dbg("Elapsed s: %ld ns: %ld", elapsed.tv_sec, elapsed.tv_nsec);
- stats->nsecs += (stats->elapsed.tv_sec * NSEC_PER_SEC + stats->elapsed.tv_nsec);
+ stats->nsecs += (elapsed.tv_sec * NSEC_PER_SEC + elapsed.tv_nsec);
if (stats->nsecs >= NSEC_PER_SEC) {
/*
* if we were garanteed that each frame took less than
if (stats->nsecs >= NSEC_PER_SEC) {
/*
* if we were garanteed that each frame took less than