nytprof.disabled added
[MojoFacets.git] / lib / MojoFacets / Plugin / NYTProf.pm
index 7cf729a..20424eb 100644 (file)
@@ -26,9 +26,12 @@ sub register {
                        DB::disable_profile();
                        return unless my $id = $c->stash('nytprof.id');
                        my $duration = Time::HiRes::gettimeofday() - $id;
-                       if ( $duration > $p ) {
+                       if ( $c->stash('nytprof.disabled') ) {
+                               warn "profile disabled";
+                               unlink $path;
+                       } elsif ( $duration > $p ) {
                                my $path = "/tmp/nytprof.$id";
-                               my $new  = "/tmp/MojoFacets.profile-$id-$duration";
+                               my $new  = "/tmp/MojoFacets.profile.$id-$duration";
                                rename $path, $new;
                                warn "profile $new $duration ", -s $new, " bytes\n";
                        } else {