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.


In reply to Re: Profiling BerkeleyDB? by madbombX
in thread Profiling BerkeleyDB? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.