I have found some code on measuring execution time here http://www.dreamincode.net/forums/index.php?showtopic=24685
However, it does not seem to work for calls to sy
Have you considered using gettimeofday?
struct timeval tv; struct timeval start_tv; gettimeofday(&start_tv, NULL); system(something); double elapsed = 0.0; gettimeofday(&tv, NULL); elapsed = (tv.tv_sec - start_tv.tv_sec) + (tv.tv_usec - start_tv.tv_usec) / 1000000.0;