[Jifty-commit] r5204 - in jifty/trunk: lib/Jifty/Plugin
Jifty commits
jifty-commit at lists.jifty.org
Mon Mar 10 16:11:37 EDT 2008
Author: sartak
Date: Mon Mar 10 16:11:36 2008
New Revision: 5204
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/Recorder.pm
Log:
r52466 at onn: sartak | 2008-03-10 02:26:10 -0400
Recorder: log when we started and ended each request in absolute time
Modified: jifty/trunk/lib/Jifty/Plugin/Recorder.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Recorder.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Recorder.pm Mon Mar 10 16:11:36 2008
@@ -2,7 +2,7 @@
use strict;
use warnings;
use base qw/Jifty::Plugin Class::Data::Inheritable/;
-__PACKAGE__->mk_accessors(qw/start path loghandle logged_request memory_usage/);
+__PACKAGE__->mk_accessors(qw/start path loghandle request_time logged_request memory_usage/);
use Time::HiRes 'time';
use Jifty::Util;
@@ -59,10 +59,18 @@
my $cgi = shift;
$self->logged_request(0);
+ $self->request_time(time);
eval {
- my $delta = time - $self->start;
- my $request = { cgi => nfreeze($cgi), ENV => \%ENV, time => $delta };
+ my $delta = $self->request_time - $self->start;
+
+ my $request = {
+ cgi => nfreeze($cgi),
+ ENV => \%ENV,
+ time => $delta,
+ start => $self->request_time,
+ };
+
my $yaml = Jifty::YAML::Dump($request);
print { $self->get_loghandle } $yaml;
@@ -92,6 +100,8 @@
if ($self->logged_request) {
eval {
+ print { $self->get_loghandle } "end: " . time . "\n";
+ print { $self->get_loghandle } "took: " . (time - $self->request_time) . "\n";
print { $self->get_loghandle } "current_user: " . (Jifty->web->current_user->id || 0) . "\n";
# get memory usage. yes, we really do need to go through these
More information about the Jifty-commit
mailing list