Feature proposal: Application level profiling
At first: Yes I know how to compile a profile version of OF, but sometimes I find the amount of information there a bit overwhelming when I ask myself simple questions like: "The pressure equation seems to eat most of the CPU-time, but how much exactly" and don't want to know every detail
Second: I know this is not a bug, but I don't know what would be the appropriate forum for this
Attached there is an archive with the example implementation. The attached archive can be used as a separate library (which requires modifications of the solver) or compiled into libOpenFOAM.so. The latter adds some data-structures for Profiling. The profiling information will be automatically written into a file uniform/profilingInfo at every time-step for which data is written to disk. The profiling information is basically how much time was spent in a section, how often it was called and how much time was spent in the 'child' sections. The sections have to be marked with the addProfile-Macro (closed by an optional endProfile). The enclosed patch automatically does this for the linear solvers. So if running an unmodified interFoam on the damBreak case the data would look like this after being processed with the enclosed Python-script, the raw data looks more foamish):
(please excuse the misalignment, the board doesn't seem to think that fixed-length-font is appropriate for Code)
The "raw" data is on the right on the left there are the percentages calculated from that. In this example there is only one "parent" and three children.
A slightly modified interFoam (see other patch) would generate this profile
To install the profiling support into OF use the addProfilingToRelease.sh-script enclosed in the tar and recompile the installation (this works for 1.5(.x). 1.4.1 needs some trivial changes - if one needs it)
To use it "just" as a library compile it with "wmake libso" and have a look at the test-application that is enclosed. But I think the cooler way to use this is as an integrated part of OF because thus the linear solvers are automatically profiled
OK. The forum seems to hate my attachments. I'll retry.
I use the callgrind tool in valgrind and view the output with kcachegrind, this has proved a very effective way of doing detailed profiling on the optimised code without the need to recompile with profiling options.
Nevertheless I think that this extension has its applications, especially because
So I see it not as much as a programmer's tool, more as a service for the user.
Valgrind does not need any changes to the code or even recompilation.
> but then a "normal" user can see where the time was lost and has quantitative information
valgrind provides all the information.
|All times are GMT -4. The time now is 00:56.|