gettimeofday()
from <sys/time.h>
can be used in your case.
double elapsedTime[100];
for (i = 1; i <= 100; ++i) {
sprintf(command, "python program.py %d", i);
gettimeofday(&t1, NULL);
system(command);
gettimeofday(&t2, NULL);
// compute and print the elapsed time in millisec
elapsedTime[i] = (t2.tv_sec - t1.tv_sec) * 1000.0; // sec to ms
elapsedTime[i] += (t2.tv_usec - t1.tv_usec) / 1000.0; // us to ms
};
If possible, you can use some profiling tool which supports python.