Simulation::DiscreteEvent::Recorder - Moose role for recording all events for server
Add Simulation::DiscreteEvent::Recorder role to your server:
package MyServer; use Moose; BEGIN { extends 'Simulation::DiscreteEvent::Server'; } with 'Simulation::DiscreteEvent::Recorder'; sub handler1 : Event(start) { # handle start event here } sub handler2 : Event(stop) { # handle stop event here }
Then after running simulation you can get information about moments of the events, intervals between events, etc:
my @events = $server->get_all_events; my $started = $server->get_number_of('start'); my @started_at = $server->get_moments_of('start'); my @stop_intvl = $server->intervals_between('stop');
This role allows you to record information about every event during simulation.
The following methods are added to the class that uses that role
Returns list of all events handled by this server. Every item in the list is refference to array with two elements: time the event has occured, and name of the event.
Returns how many times $event has occured. If $event is not specified returns total number of the events.
Returns list of moments at which $event has occured. If $event is not specified returns moments of all events.
Returns intervals between subsequent moments when $event has occured. As for previous function, if $event is missed uses all events.
Pavel Shaydo, <zwon at cpan.org>
<zwon at cpan.org>
Please see documentation for Simulation::DiscreteEvent
Copyright 2010 Pavel Shaydo.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Simulation::DiscreteEvent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Simulation::DiscreteEvent
CPAN shell
perl -MCPAN -e shell install Simulation::DiscreteEvent
For more information on module installation, please visit the detailed CPAN module installation guide.