mirror of https://github.com/tstack/lnav
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
410 B
C++
23 lines
410 B
C++
|
|
#ifndef __time_t_hh
|
|
#define __time_t_hh
|
|
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <sys/time.h>
|
|
|
|
#define timeit(_block) { \
|
|
struct timeval _st, _en, _diff; \
|
|
\
|
|
gettimeofday(&_st, NULL); \
|
|
{ _block; } \
|
|
gettimeofday(&_en, NULL); \
|
|
timersub(&_en, &_st, &_diff); \
|
|
fprintf(stderr, \
|
|
"%s %d.%06d\n", \
|
|
#_block, _diff.tv_sec, _diff.tv_usec); \
|
|
fflush(stderr); \
|
|
}
|
|
|
|
#endif
|