#include <time.h> #include <stdio.h> #include <stdlib.h> void busyWork(){ int i; int *testing; for(i = 0 ; i< 10000000; i++){ testing = (int*) malloc(512); free(testing); } } int main(){ clock_t begin = clock(); /* here, do your time-consuming job */ busyWork(); clock_t end = clock(); double time_spent = (double)(end - begin) / CLOCKS_PER_SEC; printf("Time spent processing: %f\n", time_spent); exit(EXIT_SUCCESS); return 0; }