[Jifty-commit] r4595 - in jifty/trunk:
lib/Jifty/Plugin/Recorder/Command
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Nov 30 18:33:17 EST 2007
Author: sartak
Date: Fri Nov 30 18:33:16 2007
New Revision: 4595
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/Recorder/Command/Playback.pm
Log:
r48463 at onn: sartak | 2007-11-30 18:32:55 -0500
Recorder: Update Playback doc
Modified: jifty/trunk/lib/Jifty/Plugin/Recorder/Command/Playback.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Recorder/Command/Playback.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Recorder/Command/Playback.pm Fri Nov 30 18:33:16 2007
@@ -1,13 +1,9 @@
#!/usr/bin/env perl
package Jifty::Plugin::Recorder::Command::Playback;
-# this is just a shill to get Jifty::Script::Playback
# note that you'll need a patch to App::CLI to allow arbitrary
# files to define new commands
-# you'll also need some kind of hack in Jifty::Script to use this file.
-# still working on it!
-
package Jifty::Script::Playback;
use strict;
use warnings;
@@ -15,6 +11,41 @@
use base qw/App::CLI::Command/;
use Time::HiRes 'sleep';
+=head1 Jifty::Script::Playback - Play back a request log
+
+=head1 DESCRIPTION
+
+L<Jifty::Plugin::Recorder> lets you record a request log. Using this command
+you can play back the request log. This can be handy for performance testing
+and debugging, and perhaps even testing.
+
+=head1 API
+
+=head2 options
+
+This command takes three options. Any arguments that are not options will be
+interpreted as files to play back. Files will be played back in the order they
+are given on the command line.
+
+=over 4
+
+=item max
+
+The maximum time to wait between requests. By default there is no maximum and
+requests will be made exactly as they are in the log.
+
+=item quiet
+
+Suppress TRACE, DEBUG, and INFO log levels.
+
+=item dbiprof
+
+Enable DBI profiling.
+
+=back
+
+=cut
+
sub options {
(
'max=s' => 'max',
@@ -23,6 +54,14 @@
)
}
+=head2 run
+
+Run takes no arguments. It goes through most of the motions of starting a
+server, except it won't let the server accept incoming requests. It will then
+start playing back the request logs. Once finished, it will exit normally.
+
+=cut
+
sub run {
my $self = shift;
Jifty->new();
@@ -57,8 +96,17 @@
}
}
+=head2 play_request REQUEST
+
+Plays back a single request, right now, through Jifty->handler. It expects
+C<< $request->{ENV} >> to be a hashref which will set C<%ENV>. It expects
+C<< $request->{cgi} >> to be a CGI object which will be passed to
+C<< Jifty->handler->handle_request >>.
+
+=cut
+
sub play_request {
- my $self = shift;
+ my $self = shift;
my $request = shift;
# XXX: the output should go to a file for testability, and to suppress
@@ -69,6 +117,16 @@
Jifty->handler->handle_request(cgi => $request->{cgi});
}
+=head2 play_requests REQUESTs
+
+Plays through a list of requests, sleeping between each. Each request should be
+a hashref with fields C<time> (a possibly fractional number of seconds,
+representing the time of the request, relative to when the server started);
+C<ENV> (used to set C<%ENV>); and C<cgi> (passed to
+Jifty->handler->handle_request).
+
+=cut
+
sub play_requests {
my $self = shift;
@@ -86,5 +144,16 @@
}
}
+=head2 filename
+
+This is used as a hack to get L<App::CLI> to retrieve our POD correctly.
+
+Inner packages are not given in C<%INC>. If anyone finds a way around this,
+please let us know.
+
+=cut
+
+sub filename { __FILE__ }
+
1;
More information about the Jifty-commit
mailing list