I am currently writing a very large program in C and C++ which processes some huge image files and outputs large amounts of statistics on those files. I was wondering if anyone knows of any tools that can be used to help determine where the program is spending most of it's time handling things (in input, output, computation, buffering, etc) so I can fine tune the code in those places.

Thanks for the help.

Paul