Permalink
Browse files

Debug code.

  • Loading branch information...
jamiemccarthy committed Oct 21, 2003
1 parent 6b49c7d commit 42dfab782bf904d78972f75e2eba9f9afbd1b6dc
Showing with 16 additions and 0 deletions.
  1. +3 −0 Slash/Apache/Banlist/Banlist.pm
  2. +4 −0 plugins/Messages/messages.pl
  3. +9 −0 themes/slashcode/htdocs/index.pl
@@ -26,6 +26,9 @@ sub handler {
# Ok, this will make it so that we can reliably use Apache->request
Apache->request($r);
my $cur_ip = $r->connection->remote_ip;
+
+print STDERR scalar(localtime) . " Banlist.pm $$ $cur_ip " . $r->method . " " . $r->uri . "\n";
+
my $cur_ipid = md5_hex($cur_ip);
my $cur_subnet = $cur_ip;
$cur_subnet =~ s/^(\d+\.\d+\.\d+)\.\d+$/$1.0/;
@@ -12,11 +12,13 @@
use Slash::Constants qw(:web :messages);
use Slash::Display;
use Slash::Utility;
+use Time::HiRes;
use vars qw($VERSION);
($VERSION) = ' $Revision$ ' =~ /\$Revision:\s+([^\s]+)/;
sub main {
+my $start_time = Time::HiRes::time;
my $messages = getObject('Slash::Messages');
my $constants = getCurrentStatic();
my $user = getCurrentUser();
@@ -50,7 +52,9 @@ sub main {
}
# dispatch of op
+printf STDERR scalar(localtime) . " messages.pl before $$ op $op uid $user->{uid} elapsed %5.3f\n", (Time::HiRes::time - $start_time);
$ops{$op}[FUNCTION]->($messages, $constants, $user, $form);
+printf STDERR scalar(localtime) . " messages.pl after $$ op $op uid $user->{uid} elapsed %5.3f\n", (Time::HiRes::time - $start_time);
# writeLog('SOME DATA'); # if appropriate
}
@@ -8,8 +8,10 @@
use Slash;
use Slash::Display;
use Slash::Utility;
+use Time::HiRes;
sub main {
+my $start_time = Time::HiRes::time;
my $constants = getCurrentStatic();
my $user = getCurrentUser();
my $form = getCurrentForm();
@@ -24,6 +26,7 @@ sub main {
|| $form->{upasswd} || $form->{unickname}
) {
my $refer = $form->{returnto} || $ENV{SCRIPT_NAME};
+printf STDERR scalar(localtime) . " index.pl $$ redirect returnto $refer elapsed %5.3f\n", (Time::HiRes::time - $start_time);
redirect($refer); return;
}
@@ -35,6 +38,7 @@ sub main {
upBid($form->{bid}), $c++ if /^u$/;
dnBid($form->{bid}), $c++ if /^d$/;
rmBid($form->{bid}), $c++ if /^x$/;
+printf STDERR scalar(localtime) . " index.pl $$ redirect since op=$form->{op} c=$c elapsed %5.3f\n", (Time::HiRes::time - $start_time) if $c;
redirect($ENV{HTTP_REFERER} || $ENV{SCRIPT_NAME}), return if $c;
}
@@ -54,6 +58,7 @@ sub main {
$limit = $user->{maxstories};
}
+printf STDERR scalar(localtime) . " index.pl $$ pre elapsed %5.3f\n", (Time::HiRes::time - $start_time);
$stories = $reader->getStoriesEssentials(
$limit, $form->{section},
'',
@@ -88,6 +93,8 @@ sub main {
$future_plug = 1;
}
+printf STDERR scalar(localtime) . " index.pl $$ pre-displays elapsed %5.3f\n", (Time::HiRes::time - $start_time);
+
# displayStories() pops stories off the front of the @$stories array.
# Whatever's left is fed to displayStandardBlocks for use in the
# index_more block (aka Older Stuff).
@@ -103,10 +110,12 @@ sub main {
stories => $Stories,
boxes => $StandardBlocks,
});
+printf STDERR scalar(localtime) . " index.pl $$ after slashDisplay elapsed %5.3f\n", (Time::HiRes::time - $start_time);
footer();
writeLog($form->{section});
+printf STDERR scalar(localtime) . " index.pl $$ after writeLog elapsed %5.3f\n", (Time::HiRes::time - $start_time);
}
#################################################################

0 comments on commit 42dfab7

Please sign in to comment.