summaryrefslogtreecommitdiff
path: root/profile.c
blob: 35a41447f68b28a63d53931eab453a08ced17614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
}