http://qs321.pair.com?node_id=601009

perlknight has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks, I have a script which monitor if the database is available or not. It does this by logging in and query the the dual table for sysdate. It is currently working, but I want to extract how much time has elapse since I started the the call to the database until I get the result back. I was thinking of getting the timestamp in epoch before making the call to the database and getting the timestamp again after the result is returned. Take the different and covert it back from epoc to regular time. Does anyone have any idea? Thanks.

Replies are listed 'Best First'.
Re: timing response from database
by GrandFather (Saint) on Feb 20, 2007 at 03:24 UTC

    Time::HiRes may be what you are looking for.


    DWIM is Perl's answer to Gödel
Re: timing response from database
by chrism01 (Friar) on Feb 20, 2007 at 05:59 UTC
    You might also want to look at SIGALRM, so you can limit how long it takes and check whether it timed out or returned a different error, if any.
Re: timing response from database
by adrianh (Chancellor) on Feb 20, 2007 at 13:13 UTC
Re: timing response from database
by jdtoronto (Prior) on Feb 20, 2007 at 14:50 UTC