in reply to Profiling forking code?

this is something of a punt, but nobody else has suggested it. Add an option to your program to operate in non-forking mode. This will allow you to:

profile your code,
run it in debugger (good to have, just in case ;-)