aboutsummaryrefslogtreecommitdiff
path: root/src/bench.h
blob: 730819701cf0e7c06893702ce95f83ae7a5e5833 (plain)
  1. #ifndef __BENCH_H__
  2. #define __BENCH_H__
  3. #include <stdio.h>
  4. #include <sys/time.h>
  5. #ifdef TIMER
  6. float _cmark_start_time;
  7. float _cmark_end_time;
  8. #define start_timer() \
  9. _cmark_start_time = (float)clock()/CLOCKS_PER_SEC
  10. #define end_timer(M) \
  11. _cmark_end_time = (float)clock()/CLOCKS_PER_SEC; \
  12. fprintf(stderr, "[TIME] (%s:%d) %8.f ns " M "\n", __FILE__, \
  13. __LINE__, (_cmark_end_time - _cmark_start_time) * 1000000)
  14. #else
  15. #define start_timer()
  16. #define end_timer(M)
  17. #endif
  18. #endif