Author: spadkins
Date: Thu Sep  4 14:27:30 2008
New Revision: 11741

Modified:
   p5ee/trunk/App-Context/lib/App/Context.pm

Log:
added profile_log()

Modified: p5ee/trunk/App-Context/lib/App/Context.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context.pm   (original)
+++ p5ee/trunk/App-Context/lib/App/Context.pm   Thu Sep  4 14:27:30 2008
@@ -1769,6 +1769,25 @@
     delete $self->{profile_state};
 }
 
+sub profile_log {
+    my ($self) = @_;
+    my $profile_stats = $self->profile_stats();
+    $self->log("PROFILE:  cumultime      count  avgtime  mintime  maxtime  
key\n");
+    my ($stats);
+    foreach my $key (sort { $profile_stats->{$b}{cumul_time} <=> 
$profile_stats->{$a}{cumul_time} } keys %$profile_stats) {
+        $stats = $profile_stats->{$key};
+        if ($stats->{count}) {
+            $self->log("PROFILE: %10.4f %10d %8.4f %8.4f %8.4f  %s\n",
+                $stats->{cumul_time},
+                $stats->{count},
+                $stats->{cumul_time}/$stats->{count},
+                $stats->{min_time},
+                $stats->{max_time},
+                $key);
+        }
+    }
+}
+
 #############################################################################
 # user()
 #############################################################################

Reply via email to