[Jifty-commit] jifty-plugin-nytprof branch, master, updated. 377dfe3df362745accfbe24da6cb5e2a07743a56
Jifty commits
jifty-commit at lists.jifty.org
Sat Jan 9 00:19:04 EST 2010
The branch, master has been updated
via 377dfe3df362745accfbe24da6cb5e2a07743a56 (commit)
via c91ebd72e5c2a77b7cee5202d732033e9914f014 (commit)
via 310140b9a4589bf6d647b01f131ef0bc3535e578 (commit)
via 93f1e160169e600e74cabd497f2c7cc19fd0ca14 (commit)
via e06c82d52d2260a4a164e5d7e1e55fd66f82234e (commit)
from a667e6e863b032a0b1eb7a6ebe8ea6182465ffd5 (commit)
Summary of changes:
Makefile.PL | 4 +-
lib/Jifty/Plugin/NYTProf.pm | 51 ++++++++++++++++++++++++++++++++----------
2 files changed, 41 insertions(+), 14 deletions(-)
- Log -----------------------------------------------------------------
commit e06c82d52d2260a4a164e5d7e1e55fd66f82234e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sat Jan 9 00:16:02 2010 -0500
Remove PID from profile directory
diff --git a/lib/Jifty/Plugin/NYTProf.pm b/lib/Jifty/Plugin/NYTProf.pm
index 4da5f0e..3da847a 100644
--- a/lib/Jifty/Plugin/NYTProf.pm
+++ b/lib/Jifty/Plugin/NYTProf.pm
@@ -22,7 +22,7 @@ sub static_root {
}
sub base_root {
- my $dir = File::Spec->catfile(__PACKAGE__->_static_root, '_profile', Jifty->app_class.'-'.$$ );
+ my $dir = File::Spec->catfile(__PACKAGE__->_static_root, '_profile' );
mkpath [$dir] unless -d $dir;
return $dir;
}
@@ -94,7 +94,7 @@ sub inspect_render_analysis {
my $dir = $self->profile_dir($id);
$self->generate_profile($dir);
- my $profile = '/_profile/'.Jifty->app_class."-$$/nytprof-$id/index.html" ;
+ my $profile = "/_profile/nytprof-$id/index.html" ;
div {
attr { class is 'lightbox', style is 'background-color: white'; };
commit 93f1e160169e600e74cabd497f2c7cc19fd0ca14
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sat Jan 9 00:17:07 2010 -0500
Factor out profile file
diff --git a/lib/Jifty/Plugin/NYTProf.pm b/lib/Jifty/Plugin/NYTProf.pm
index 3da847a..862cd72 100644
--- a/lib/Jifty/Plugin/NYTProf.pm
+++ b/lib/Jifty/Plugin/NYTProf.pm
@@ -34,6 +34,13 @@ sub profile_dir {
return File::Spec->catfile($self->base_root, "nytprof-$id");
}
+sub profile_file {
+ my $self = shift;
+ my $id = shift;
+
+ return $self->profile_dir($id) . ".out";
+}
+
sub init {
my $self = shift;
@@ -68,9 +75,7 @@ sub inspect_before_request {
my $id = Jifty->web->serial;
- my $file = $self->profile_dir($id) . ".out";
-
- DB::enable_profile("$file");
+ DB::enable_profile($self->profile_file($id));
return $id;
}
@@ -91,8 +96,7 @@ sub inspect_render_analysis {
my $id = shift;
# need to generate the profile
- my $dir = $self->profile_dir($id);
- $self->generate_profile($dir);
+ $self->generate_profile($id);
my $profile = "/_profile/nytprof-$id/index.html" ;
@@ -111,10 +115,11 @@ sub inspect_render_analysis {
sub generate_profile {
my $self = shift;
- my $dir = shift;
+ my $id = shift;
+ my $dir = $self->profile_dir($id);
if (!-d $dir) {
- my $input = "$dir.out";
+ my $input = $self->profile_file($id);
die "Unable to find profile output file '$input'"
unless -e $input;
system("nytprofhtml -f $input -o $dir");
commit 310140b9a4589bf6d647b01f131ef0bc3535e578
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sat Jan 9 00:17:54 2010 -0500
Use a more straightforward mkpath call style
diff --git a/lib/Jifty/Plugin/NYTProf.pm b/lib/Jifty/Plugin/NYTProf.pm
index 862cd72..c33f367 100644
--- a/lib/Jifty/Plugin/NYTProf.pm
+++ b/lib/Jifty/Plugin/NYTProf.pm
@@ -12,7 +12,7 @@ sub prereq_plugins { 'RequestInspector' }
sub _static_root {
my $self = shift;
my $dir = Jifty::Util->absolute_path("var/profile");
- mkpath [$dir] unless -d $dir;
+ mkpath $dir unless -d $dir;
return $dir;
}
@@ -23,7 +23,7 @@ sub static_root {
sub base_root {
my $dir = File::Spec->catfile(__PACKAGE__->_static_root, '_profile' );
- mkpath [$dir] unless -d $dir;
+ mkpath $dir unless -d $dir;
return $dir;
}
commit c91ebd72e5c2a77b7cee5202d732033e9914f014
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sat Jan 9 00:18:32 2010 -0500
Use NYTProf 3 -- which appends the PID to profile files
diff --git a/Makefile.PL b/Makefile.PL
index 8bd084d..d345401 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,6 +2,6 @@ use inc::Module::Install;
name('Jifty-Plugin-NYTProf');
version('0.02');
requires('Jifty' => '0.90422');
-requires('Devel::NYTProf' => 2.10);
+requires('Devel::NYTProf' => 3.0);
WriteAll;
diff --git a/lib/Jifty/Plugin/NYTProf.pm b/lib/Jifty/Plugin/NYTProf.pm
index c33f367..a60aa52 100644
--- a/lib/Jifty/Plugin/NYTProf.pm
+++ b/lib/Jifty/Plugin/NYTProf.pm
@@ -87,6 +87,7 @@ sub inspect_after_request {
return unless $self->is_profiling_requests;
DB::finish_profile();
+ rename($self->profile_file($id).".$$", $self->profile_file($id));
return $id;
}
commit 377dfe3df362745accfbe24da6cb5e2a07743a56
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sat Jan 9 00:18:58 2010 -0500
Provide a way to aggregate individual requests
diff --git a/Makefile.PL b/Makefile.PL
index d345401..9f2852a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,7 +1,7 @@
use inc::Module::Install;
name('Jifty-Plugin-NYTProf');
version('0.02');
-requires('Jifty' => '0.90422');
+requires('Jifty' => '1.00105');
requires('Devel::NYTProf' => 3.0);
WriteAll;
diff --git a/lib/Jifty/Plugin/NYTProf.pm b/lib/Jifty/Plugin/NYTProf.pm
index a60aa52..731001a 100644
--- a/lib/Jifty/Plugin/NYTProf.pm
+++ b/lib/Jifty/Plugin/NYTProf.pm
@@ -2,7 +2,7 @@ package Jifty::Plugin::NYTProf;
use strict;
use warnings;
use base 'Jifty::Plugin';
-use File::Path 'mkpath';
+use File::Path qw/mkpath rmtree/;
use Template::Declare::Tags;
__PACKAGE__->mk_accessors(qw/is_profiling_requests/);
@@ -114,6 +114,27 @@ sub inspect_render_analysis {
};
}
+sub inspect_render_aggregate {
+ my $self = shift;
+
+ if (Jifty->web->request->argument('generate')) {
+ rmtree $self->profile_dir("merged");
+ unlink $self->profile_file("merged");
+ my @files = map {$self->profile_file($_)} @_;
+ system("nytprofmerge -o @{[$self->profile_file('merged')]} @files");
+ }
+
+ Jifty->web->link(
+ label => "Generate",
+ onclick => {
+ refresh_self => 1,
+ arguments => {generate => 1},
+ },
+ );
+
+ $self->inspect_render_analysis("merged") if -e $self->profile_file("merged");
+}
+
sub generate_profile {
my $self = shift;
my $id = shift;
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list