diff options
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/profile.c b/profile.c new file mode 100644 index 00000000..35a41447 --- /dev/null +++ b/profile.c @@ -0,0 +1,18 @@ +#include <stdlib.h> +#include <sys/time.h> + +void +profile_timer(char *where) +{ + static struct timeval last; + struct timeval curr; + int msec; + + if (where) { + gettimeofday(&curr, NULL); + msec=(curr.tv_usec-last.tv_usec)/1000+ + (curr.tv_sec-last.tv_sec)*1000; + printf("%s:%d msec\n", where, msec); + } + gettimeofday(&last, NULL); +} |