Possible Duplicate:
fast elapsed time on linux
How can I measure how long a function takes to execute in C++? It would be best if I could get the time to a fraction of a millisecond, but if not accuracy to one millisecond should be good enough. I'm running Ubuntu 11.04 if that means anything.