Is there a simple library to benchmark the time it takes to execute a portion of C code? What I want is something like:
int main(){ benchmarkBegin(0);
In POSIX, try getrusage. The relevant argument is RUSAGE_SELF and the relevant fields are ru_utime.tv_sec and ru_utime.tv_usec.