HowTo Profiling

From OpenFOAMWiki


Basically, use Callgrind, which is part of Valgrind. It’s executed using:

   valgrind --tool=callgrind <executableName>

Or for parallel runs:

   mpirun -np $nProc valgrind --tool=callgrind <executableName> -parallel

When the simulation is done you’ll see a callgrind file in the current directory. Opening it with kcachegrind allows you to easily trace through the functions that have been called. You can even generate nice looking call graphs to help you trace function calls.

There is also a script that might help with this in OpenFOAM/bin/mpirunDebug.