zapit/src/frontend.cpp: change timers to use time_monotonic_ms()

This commit is contained in:
[CST] Focus
2014-03-21 11:30:07 +04:00
parent acffe8024d
commit 9ec646bebe

View File

@@ -36,6 +36,7 @@
#include <zapit/client/msgtypes.h> #include <zapit/client/msgtypes.h>
#include <zapit/frontend_c.h> #include <zapit/frontend_c.h>
#include <zapit/satconfig.h> #include <zapit/satconfig.h>
#include <driver/abstime.h>
extern transponder_list_t transponders; extern transponder_list_t transponders;
extern int zapit_debug; extern int zapit_debug;
@@ -128,20 +129,18 @@ static const struct dtv_property dvbt_cmdargs[] = {
#define diff(x,y) (max(x,y) - min(x,y)) #define diff(x,y) (max(x,y) - min(x,y))
#define FE_TIMER_INIT() \ #define FE_TIMER_INIT() \
unsigned int timer_start; \
static unsigned int tmin = 2000, tmax = 0; \ static unsigned int tmin = 2000, tmax = 0; \
struct timeval tv, tv2; \
unsigned int timer_msec = 0; unsigned int timer_msec = 0;
#define FE_TIMER_START() \ #define FE_TIMER_START() \
gettimeofday(&tv, NULL); timer_start = time_monotonic_ms();
#define FE_TIMER_STOP(label) \ #define FE_TIMER_STOP(label) \
gettimeofday(&tv2, NULL); \ timer_msec = time_monotonic_ms() - timer_start; \
timer_msec = ((tv2.tv_sec-tv.tv_sec) * 1000) + \
((tv2.tv_usec-tv.tv_usec) / 1000); \
if(tmin > timer_msec) tmin = timer_msec; \ if(tmin > timer_msec) tmin = timer_msec; \
if(tmax < timer_msec) tmax = timer_msec; \ if(tmax < timer_msec) tmax = timer_msec; \
printf("[fe%d] %s: %u msec (min %u max %u)\n", \ printf("[fe%d] %s: %u msec (min %u max %u)\n", \
fenumber, label, timer_msec, tmin, tmax); fenumber, label, timer_msec, tmin, tmax);
// Internal Inner FEC representation // Internal Inner FEC representation