C++ profiling code