New project architecture in progress: renaming, refactoring and adjustments

This commit is contained in:
Leonardo Vencovsky committed 2020-09-26 13:35:28 -03:00
1 parent 6cb2160456
commit 2424f0d8cd
134 files changed
+596 -12196

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
/**
* utl_timer.h
*
* Creation Date: 12/04/2019
*
* Authors:
* Leonardo Vencovsky (https://github.com/LeoVen)
*
*/
/**
* Simple timer macros utility for timing code execution.
*/
#ifndef CMC_UTL_TIMER_H
#define CMC_UTL_TIMER_H
#include <time.h>
struct cmc_timer
{
clock_t start;
clock_t stop;
double result; /* The result is given in milliseconds */
};
#define cmc_timer_start(timer) \
do \
{ \
struct cmc_timer *t__ = &(timer); \
t__->start = clock(); \
} while (0)
#define cmc_timer_stop(timer) \
do \
{ \
struct cmc_timer *t__ = &(timer); \
t__->stop = clock(); \
t__->result = (double)(t__->stop - t__->start) * 1000.0 / CLOCKS_PER_SEC; \
} while (0)
#endif /* CMC_UTL_TIMER_H */