Changing timer_t to cmc_timer to not generate conflicts

This commit is contained in:
LeoVen committed 2019-07-05 13:30:07 -03:00
1 parent f7a598efc8
commit c60ee10185
3 files changed
+9 -7

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ COLLECTION_GENERATE(HASHMAP, hm, hmap, /* FMOD */, int, int)
{ \ { \
printf("+------------------------------------------------------------ %10s\n", #NAME); \ printf("+------------------------------------------------------------ %10s\n", #NAME); \
printf("+------------------------------------------------------------ \n"); \ printf("+------------------------------------------------------------ \n"); \
timer_t timer, total; \ cmc_timer timer, total; \
int r, k, v; \ int r, k, v; \
size_t j; \ size_t j; \
\ \
+1 -1
View File
@@ -98,7 +98,7 @@ static void cmc_test_log(const char *unit_name, const char *current_test, bool a
const char *current_test = NULL; \ const char *current_test = NULL; \
\ \
cmc_test_info tinfo = {0}; \ cmc_test_info tinfo = {0}; \
timer_t timer = {0}; \ cmc_timer timer = {0}; \
\ \
tinfo.verbose = VERBOSE; \ tinfo.verbose = VERBOSE; \
\ \
+7 -5
View File
@@ -15,31 +15,33 @@
#include <time.h> #include <time.h>
typedef struct timer_s typedef struct cmc_timer_s
{ {
clock_t start; clock_t start;
clock_t stop; clock_t stop;
double result; double result;
} timer_t; } cmc_timer;
#define timer_start(timer) \ #define timer_start(timer) \
do \ do \
{ \ { \
(timer).start = clock(); \ cmc_timer *t = &(timer); \
t->start = clock(); \
\ \
} while (0) } while (0)
#define timer_stop(timer) \ #define timer_stop(timer) \
do \ do \
{ \ { \
(timer).stop = clock(); \ cmc_timer *t = &(timer);\
t->stop = clock(); \
\ \
} while (0) } while (0)
#define timer_calc(timer) \ #define timer_calc(timer) \
do \ do \
{ \ { \
timer_t *t = &(timer); \ cmc_timer *t = &(timer); \
t->result = (double)(t->stop - t->start) * 1000.0 / CLOCKS_PER_SEC; \ t->result = (double)(t->stop - t->start) * 1000.0 / CLOCKS_PER_SEC; \
\ \
} while (0) } while (0)