#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>

int main(int argc, char **argv) {
	int iterations = 10000000;
	int n;
	unsigned long usec;
	struct timeval start, end;

	if(argc > 1) iterations = atoi(argv[1]);

	n = iterations;

	gettimeofday(&start, NULL);
	while(--n) asm("");
	gettimeofday(&end, NULL);

	usec = end.tv_usec - start.tv_usec + (end.tv_sec - start.tv_sec) * 1000000UL;
	printf("%lu megaulps\n", ((unsigned long) iterations) / usec);

	return 0;
}

