APM: Determining speed

Michael Parker parkerm at pobox.com
Thu Dec 5 11:02:51 CST 2002


On Thu, Dec 05, 2002 at 10:43:43AM -0600, Goldilox wrote:
> I just want to say first I appreciate everyone's responses to the questions I
> throw out here, and I have another one...
> 
> I'm pulling from a SQL database (W2K OS) and it is taking a couple seconds to
> display the results (lots of parsing and a couple different SQL queries in one
> script). How can I determine where the time is being spent? i.e. I want to see
> the time spent waiting for the database to deliver its payload vs how long it
> takes the Perl script to do its work. I have no idea of the terminology I
> should be using here, but I'm hoping this is a common interest that might have
> some modules or commands readily available? Basically I want to figure out if
> my Perl is so clunky it could be improved or if it's just the database that is
> taking up most of the time.
> 

Look at the Time::HiRes module.  It will give you high resolution
interval timers.  Then what you do is setup a few timers in your code,
let it run and print out the time it took for each action.  This
should give you a good idea where it's spending most of its time.

Michael



More information about the Austin mailing list