in reply to Profiling BerkeleyDB?

I believe that you need to provide us with more information as it sounds like you have a bunch of code for a custom rolled application. However, generically speaking you can do a few things. You can define the calling methods to include a logging function. Ie every time a db_get() is called, have it run the logger function and then do the db_get(). This can also mean that if the read calls are always called via the same method (assuming its OO) or via the same function, you can add a logging hook to the function. Or if you are feeling really frisky, you can always edit the BerkDB module (assuming that is the one you are using to access the tied hash interface). Although it is generally not recommended to mess with CPAN modules, this is one of your options (since you are doing it locally). You may also want to read up on "Overriding Built-in Functions" in perlsub. Again the method you choose depends on the way the current code that has been dropped in your lap was written.

You can also just profile the code using a regular profiler. Here is a thread that talks a little about profiling: Get Execution time.

Replies are listed 'Best First'.
Re^2: Profiling BerkeleyDB?
by Anonymous Monk on Nov 03, 2006 at 09:03 UTC
    This was my first thought actually. I have done it for a different module. But it doesn't seem to work on BerkeleyDB! I modified the "FETCH" and "EXISTS" subs to log stuff, but it didn't do anything. I'm thinking it might be something to do with XsLoader and the fact that BerkeleyDB is a binary module.