From: Tim Bunce Date: Tue, 2 Oct 2012 20:11:25 +0000 (+0100) Subject: Polish sizeme_graph.pl X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=72eb1fbb6d79bf8786d74b4f530eb0cc6bcf032a;p=p5sagit%2FDevel-Size.git Polish sizeme_graph.pl --- diff --git a/static/sizeme_graph.pl b/static/sizeme_graph.pl index 4b9b03c..9199141 100755 --- a/static/sizeme_graph.pl +++ b/static/sizeme_graph.pl @@ -9,12 +9,14 @@ use Getopt::Long; use Storable qw(dclone); use Devel::Dwarn; +require ORLite; + =pod NOTE Needs to be run from the static/. directory. For example: - ./sizeme_graph.pl daemon + sizeme_graph.pl daemon =pod TODO @@ -22,8 +24,6 @@ use Devel::Dwarn; is entirely self-contained and doesn't need any static files installed. Or, work out how to install the static files and reference them from the script. - Remove ORLite (for now) - Make the treemap resize to fit the browser window (as NYTProf does). Protect against nodes with thousands of children @@ -32,25 +32,26 @@ use Devel::Dwarn; =cut +my $j = JSON::XS->new; + GetOptions( - 'db=s' => \(my $opt_db = '../sizeme.db'), + 'db=s' => \(my $opt_db = 'sizeme.db'), 'showid!' => \my $opt_showid, 'debug!' => \my $opt_debug, ) or exit 1; -#warn "Reading from $opt_db\n"; +die "Can't open $opt_db: $!\n" unless -r $opt_db; +warn "Reading $opt_db\n"; # XXX currently uses ORLite but doesn't actually make use of it in any useful way -# should be removed and replaced with plain DBI till we have an obvious need for it -use ORLite { - file => '../sizeme.db', +ORLite->import({ + file => $opt_db, package => "SizeMe", - #user_version => 1, readonly => 1, - #unicode => 1, -}; + #user_version => 1, # XXX + #unicode => 1, # XXX +}); -my $j = JSON::XS->new; # Documentation browser under "/perldoc" plugin 'PODRenderer'; @@ -212,25 +213,22 @@ Welcome to the Mojolicious real-time web framework! - +
-

-Perl Memory TreeMap -

+

Perl Memory TreeMap

Click on a node to zoom in.

Go to Parent -
-
+
- -
- +