[Jifty-commit] r6261 - in jifty/trunk: bin

Jifty commits jifty-commit at lists.jifty.org
Fri Jan 23 15:00:51 EST 2009


Author: sartak
Date: Fri Jan 23 15:00:51 2009
New Revision: 6261

Added:
   jifty/trunk/bin/memory_log   (contents, props changed)
Modified:
   jifty/trunk/   (props changed)

Log:
 r78868 at onn:  sartak | 2009-01-23 14:59:17 -0500
 Small script to slice and dice log/requests/*.log


Added: jifty/trunk/bin/memory_log
==============================================================================
--- (empty file)
+++ jifty/trunk/bin/memory_log	Fri Jan 23 15:00:51 2009
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use YAML 'LoadFile';
+
+ at ARGV = glob("log/requests/*.log") if @ARGV == 0;
+die "No files to analyze" if @ARGV == 0;
+
+my @hits;
+
+for my $logfile (@ARGV) {
+    my @entries = LoadFile($logfile);
+    for (my $i = 1; $i < @entries; ++$i) {
+        my $delta_memory = $entries[$i]{memory} - $entries[$i-1]{memory};
+        my $path = $entries[$i]{ENV}{PATH_INFO};
+        push @hits, [$delta_memory, $path] if $delta_memory != 0;
+    }
+}
+
+for my $hit (sort { $b->[0] <=> $a->[0] } @hits) {
+    print "$hit->[1]: $hit->[0]\n";
+}
+


More information about the Jifty-commit mailing list