NAME

WeBWorK::Timing - Log timing data.

head1 SYNOPSIS

 use WeBWorK::Timing;
 
 # Enable timing
 $WeBWorK::Timing::Enable = 1;
 
 # Log to a file instead of STDERR
 $WeBWorK::Timing::Logfile = "/path/to/timing.log";
 
 my $timer = WeBWorK::Timing->new("do some processesing");
 $timer->start;
 do_some_processing();
 $timer->continue("
 do_some_more_processing();
 $timer->stop;
 $timer->save;
 
 my $timer0 = WeBWorK::Timing->new("main task");
 my $timer1 = WeBWorK::Timing->new("subtask 1");
 my $timer2 = WeBWorK::Timing->new("subtask 1");
 
 $timer0->start;
 $timer1->start;
 sub_task(1);
 $timer1->stop;
 $timer2->start;
 sub_task(2);
 $timer2->stop;
 $timer0->stop;
 # timing data is saved when objects go out of scope

CONFIGURATION VARIABLES

$Enabled

If true, timing messages will be output. If false, they will be ignored.

$Logfile

If non-empty, timing output will be sent to the file named rather than STDERR.

CONSTRUCTOR

new($task)

new creates a new timing object, with the task given in $task.

METHODS

start(), begin()

Marks the current time as the start time for the task.

continue($data)

Stores the current time as an intermediate time, associated with the string given in $data.

stop(), finish(), end()

Marks the current time as the stop time for the task.

save()

Writes the timing data for this task to the standard error stream. If save is not called explicitly, it is called when the object goes out of scope.

AUTHOR

Written by Sam Hathaway, sh002i (at) math.rochester.edu.

SEE ALSO

The timing utility can be used to parse and sort log output.