views:

44

answers:

1

I'm aware of tools in the Xcode utilities for monitoring and benchmarking applications, but I'd like to test a few different (low level) implementations of library components, preferably across osx/linux/windows. Is there any framework for code benchmarking, similar to say unit tests? I'd just like some convenient api functions to accurately report time and memory usage.

A: 

Unfortunately benchmarking (and timing in particular) is a very platform-specific thing.

However I think boost::date_time supports nanosecond timestamps on at least windows, OS X and linux, which might be a good place to start.

Memory usage is difficult to measure if shared libraries are involved, but if you don't want to worry about that, the easiest way to trace memory usage in a cross-platform way is to use one of the many tracing malloc implementations.

None of these tools come close to the ease of use of platform dependant tools like valgrind(+KCachgrind), or DTrace, all of which also have the advantage of being entirely external to the program.

Autopulated
Valgrind seems interesting and is supported on Linux and OSX. I think I'll start writing some simple programs with the boost time library.
0x80
OS X Leopard is supported, but last time I checked Valgrind's support for Snow Leopard is still a bit broken!
Autopulated