| Win32-ASP-DB documentation | Contained in the Win32-ASP-DB distribution. |
Win32::ASP::Profile - provides quick and dirty profiling for web performance testing
use Win32::ASP::Profile;
Win32::ASP::Profile outputs rudimentary profiling information at the end of each web page
through the use of BEGIN and END. The BEGIN subroutine initializes some information when
the web page is first created and the END subroutine computes the time it took for the web page
to be create and appends that to the end of the web page.
To use, simply include the line
use Win32::ASP::Profile;
on any web page you want to profile. If you are using a default *.INC file, you can stick that
line in the include file and thus garner profiling information on all your ASP pages.
| Win32-ASP-DB documentation | Contained in the Win32-ASP-DB distribution. |
############################################################################ # # Win32::ASP::Profile - provides quick and dirty profiling for web performance # testing in the Win32-ASP-DB system # # Author: Toby Everett # Revision: 0.02 # Last Change: ############################################################################ # Copyright 1999, 2000 Toby Everett. All rights reserved. # # This file is distributed under the Artistic License. See # http://www.ActiveState.com/corporate/artistic_license.htm or # the license that comes with your perl distribution. # # For comments, questions, bugs or general interest, feel free to # contact Toby Everett at teverett@alascom.att.com ############################################################################ use Benchmark; package Win32::ASP::Profile; use strict;
sub BEGIN { $Win32::ASP::Profile::start = Benchmark->new; $Win32::ASP::Profile::start_tick = Win32::GetTickCount(); } sub END { my $end = Benchmark->new; my $end_tick = Win32::GetTickCount(); my $delta = Benchmark::timediff($end, $Win32::ASP::Profile::start); my $deltastr = Benchmark::timestr($delta); $deltastr =~ s/\s+\d+//; $deltastr = sprintf("%0.2f", ($end_tick - $Win32::ASP::Profile::start_tick)/1000).$deltastr; $main::Response->Write("<HR>$deltastr"); } 1;