| 1 | # Declare our package | ||||||||||
| 2 | package POE::Devel::Profiler::Visualizer::BasicSummary; | ||||||||||
| 3 | |||||||||||
| 4 | # Standard stuff to catch errors | ||||||||||
| 5 | 1 | ▶ | use strict qw(subs vars refs); # Make sure we can't mess up | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings FATAL => 'all'; # Enable warnings to catch errors | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | # Initialize our version | ||||||||||
| 9 | 1 | our $VERSION = '0.01'; | |||||||||
| 10 | |||||||||||
| 11 | # Okay, we need to receive the arguments | ||||||||||
| 12 | 0 | ▶ | sub GET_ARGS { | ||||||||
|
Subroutine
GET_ARGS: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 13 | # We don't care! | ||||||||||
| 14 | 0 | return 1; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | # The actual work is here | ||||||||||
| 18 | 0 | ▶ | sub OUTPUT { | ||||||||
|
Subroutine
OUTPUT: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||
| 19 | # Get the data structure | ||||||||||
| 20 | 0 | my( undef, $data ) = @_; | |||||||||
| 21 | |||||||||||
| 22 | # Print the first line | ||||||||||
| 23 | 0 | print "Visualizer::BasicSummary ( " . $data->{'PROGNAME'} . " started at " . scalar gmtime( $data->{'TIME'}->{'START'} ) . " )\n"; | |||||||||
| 24 | |||||||||||
| 25 | # Print the number of sessions | ||||||||||
| 26 | 0 | print "Total number of sessions: " . ( keys %{ $data->{'SESSION'} } ) . "\n"; | |||||||||
| 27 | |||||||||||
| 28 | # Print the total number of events | ||||||||||
| 29 | 0 | my $events = 0; | |||||||||
| 30 | 0 | foreach my $sess ( keys %{ $data->{'SESSION'} } ) { | |||||||||
| 31 | 0 | ▶ | if ( exists $data->{'SESSION'}->{ $sess }->{'HITS'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | $events += $data->{'SESSION'}->{ $sess }->{'HITS'}; | |||||||||
| 33 | } | ||||||||||
| 34 | } | ||||||||||
| 35 | 0 | print "Total number of events profiled: $events\n"; | |||||||||
| 36 | |||||||||||
| 37 | # Print the total number of alarms | ||||||||||
| 38 | 0 | my $alarms = 0; | |||||||||
| 39 | 0 | foreach my $sess ( keys %{ $data->{'SESSION'} } ) { | |||||||||
| 40 | 0 | ▶ | if ( exists $data->{'SESSION'}->{ $sess }->{'ALARMS'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | $alarms += scalar( @{ $data->{'SESSION'}->{ $sess }->{'ALARMS'} } ); | |||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | 0 | print "Total number of alarms profiled: $alarms\n"; | |||||||||
| 45 | |||||||||||
| 46 | # Print the total number of delays | ||||||||||
| 47 | 0 | my $delays = 0; | |||||||||
| 48 | 0 | foreach my $sess ( keys %{ $data->{'SESSION'} } ) { | |||||||||
| 49 | 0 | ▶ | if ( exists $data->{'SESSION'}->{ $sess }->{'DELAYS'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 0 | $delays += scalar( @{ $data->{'SESSION'}->{ $sess }->{'DELAYS'} } ); | |||||||||
| 51 | } | ||||||||||
| 52 | } | ||||||||||
| 53 | 0 | print "Total number of delays profiled: $delays\n"; | |||||||||
| 54 | |||||||||||
| 55 | # Print the total number of signals | ||||||||||
| 56 | 0 | my $signals = 0; | |||||||||
| 57 | 0 | foreach my $sess ( keys %{ $data->{'SESSION'} } ) { | |||||||||
| 58 | 0 | ▶ | if ( exists $data->{'SESSION'}->{ $sess }->{'SIGNALS'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | $signals += scalar( @{ $data->{'SESSION'}->{ $sess }->{'SIGNALS'} } ); | |||||||||
| 60 | } | ||||||||||
| 61 | } | ||||||||||
| 62 | 0 | print "Total number of signals profiled: $signals\n"; | |||||||||
| 63 | |||||||||||
| 64 | # Print the number of GC passes | ||||||||||
| 65 | 0 | my $gc = 0; | |||||||||
| 66 | 0 | foreach my $sess ( keys %{ $data->{'SESSION'} } ) { | |||||||||
| 67 | 0 | ▶ | if ( exists $data->{'SESSION'}->{ $sess }->{'GC'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | 0 | $gc += scalar( @{ $data->{'SESSION'}->{ $sess }->{'GC'} } ); | |||||||||
| 69 | } | ||||||||||
| 70 | } | ||||||||||
| 71 | 0 | print "Total number of GC passes: $gc\n"; | |||||||||
| 72 | |||||||||||
| 73 | # Print the footer | ||||||||||
| 74 | 0 | print "Runtime: " . $data->{'TIME'}->{'WALL'} . " wallclock seconds\n"; | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | # End of module | ||||||||||
| 78 | 1 | 1; | |||||||||
| 79 | __END__ | ||||||||||