1 package MojoFacets::Plugin::NYTProf;
10 $app->plugins->add_hook(
11 before_dispatch => sub {
13 my $id = Time::HiRes::gettimeofday();
14 $c->stash('nytprof.id' => $id);
15 my $path = "/tmp/nytprof.$id";
16 DB::enable_profile($path);
17 warn "profile $path started\n";
22 $app->plugins->add_hook(
23 after_dispatch => sub {
25 DB::disable_profile();
26 return unless my $id = $c->stash('nytprof.id');
27 my $path = "/tmp/nytprof.$id";
28 warn "profile $path ", -s $profile, " bytes\n";