in reply to Profiling BerkeleyDB?

Please don't use this against me. Check "perldoc -l". You can save a copy of a module, modify it to log someplace -- and then copy it back after everything is done.

Disclaimer: It is stupid. If you have to do it, use a local machine and don't blame me if it shoots you in the foot with a grenade rifle. If you do this on a server used by others, they will burn you in effigy (if you're lucky).

You might, as a start, check something I've really seen:

$bd{"name_$id"} = $name; $bd{"adr_$id"} = $address; etc;

I.e. it does a db access for every field! (It was the first job after uni for the guilty party and a long time ago, so I won't name him. No, not me. :-)

Update: madbombX had already written what I wrote, but better. Must have missed it at first reading. Sorry for wasting people's time. (To really insert a layer for a calling module, you could write a layer module and use that instead. The layer method use the real db module and implments the API you want to log -- use AUTOLOAD for the rest of the API. There must be multiple modules on cpan which already do this for OO and functional interfaces.)