← Index
NYTProf Performance Profile   « line view »
For index.cgi
  Run on Sat May 9 17:18:47 2020
Reported on Sat May 9 17:19:07 2020

Filename/var/www/noelgalaga.com/html/rsmh/index.cgi
StatementsExecuted 60 statements in 9.10ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.33ms3.36msmain::::BEGIN@3 main::BEGIN@3
1112.30ms71.3msmain::::BEGIN@7 main::BEGIN@7
1112.13ms16.0msmain::::BEGIN@8 main::BEGIN@8
111463µs516µsmain::::BEGIN@2 main::BEGIN@2
212113242µs242µsUNIVERSAL::::VERSIONUNIVERSAL::VERSION (xsub)
2311880µs80µsUNIVERSAL::::canUNIVERSAL::can (xsub)
1119µs9µsversion::::(bool version::(bool (xsub)
3118µs8µsInternals::::SvREADONLYInternals::SvREADONLY (xsub)
3117µs7µsUNIVERSAL::::isaUNIVERSAL::isa (xsub)
1115µs5µsversion::::(cmp version::(cmp (xsub)
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
014µsProfile data that couldn't be associated with a specific line:
# spent 4µs making 1 call to Class::XSAccessor::END
1#!/usr/bin/perl
22425µs2541µs
# spent 516µs (463+53) within main::BEGIN@2 which was called: # once (463µs+53µs) by main::RUNTIME at line 2
use strict;
# spent 516µs making 1 call to main::BEGIN@2 # spent 25µs making 1 call to strict::import
323.22ms23.37ms
# spent 3.36ms (3.33+35µs) within main::BEGIN@3 which was called: # once (3.33ms+35µs) by main::RUNTIME at line 3
use warnings;
# spent 3.36ms making 1 call to main::BEGIN@3 # spent 12µs making 1 call to warnings::import
4#use File::Slurp;
5#use CGI::Carp qw(fatalsToBrowser);
6#use diagnostics;
72127µs171.3ms
# spent 71.3ms (2.30+69.0) within main::BEGIN@7 which was called: # once (2.30ms+69.0ms) by main::RUNTIME at line 7
use String::Markov;
# spent 71.3ms making 1 call to main::BEGIN@7
82737µs216.1ms
# spent 16.0ms (2.13+13.8) within main::BEGIN@8 which was called: # once (2.13ms+13.8ms) by main::RUNTIME at line 8
use Data::GUID;
# spent 16.0ms making 1 call to main::BEGIN@8 # spent 146µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
917µs1297µsmy $guid = Data::GUID->new;
# spent 297µs making 1 call to Data::GUID::new
1013µs1112µsmy $id = $guid->as_string();
# spent 112µs making 1 call to Data::GUID::__ANON__[Data/GUID.pm:147]
1117µsmy $path = sprintf( '/var/www/noelgalaga.com/html/rsmh/pages/%s/%s.html', substr($id,0,1), $id );
1212µs$|++;
131218µs1188µsprint "Content-type: text/html\n\n";
# spent 188µs making 1 call to main::CORE:print
14######################
15# headline generator #
16######################
1717µs110.7msmy $hg = String::Markov->new( order => 1, sep => ' ' );
# spent 10.7ms making 1 call to String::Markov::new
1814µs153.3ms$hg->add_files('/var/www/noelgalaga.com/data/headlines.txt');
# spent 53.3ms making 1 call to String::Markov::add_files
19114µs1222µsmy $headline = ucfirst( $hg->generate_sample );
# spent 222µs making 1 call to String::Markov::generate_sample
201300nsmy $content;
211379µs$content .= sprintf(
22 q|<html>
23 <head>
24 <meta charset="UTF-8" />
25 <meta name="viewport" content="width=device-width, initial-scale=1">
26 <title>rsmh generator - %s</title>
27 </head>
28 <body>
29 <a href="/rsmh/"><img src="/rsmh/img/rsmh.png" style="display:block;margin:0 auto;max-width:100%;" border="0" /></a>
30 <br />
31 <div style="margin:0 auto;width:80%;font-family:'PT Sans','Trebuchet MS',serif">
32 <h1 style="font-family:'Book Antiqua','Palatino',serif">%s</h1>
33|, $headline, $headline
34);
35#######################
36# paragraph generator #
37#######################
38112µs1175µsmy $pg = String::Markov->new( order => 1, sep => ' ' );
# spent 175µs making 1 call to String::Markov::new
3911µsmy @files = ();
4013µsfor ( 1 .. 4 ) {
4148µs push( @files, "../../data/" . int( rand(246) ) . '.text' );
42}
4314µs143.6ms$pg->add_files(@files);
# spent 43.6ms making 1 call to String::Markov::add_files
4415µsmy $pars = int( rand(5) ) + 4;
4513µsfor ( 1 .. $pars ) {
46622µs62.13ms my $str = ucfirst( $pg->generate_sample );
# spent 2.13ms making 6 calls to String::Markov::generate_sample, avg 355µs/call
47623µs if ( (($str =~ tr/"//) % 2) == 1 ) {
48 if ( $str =~ /^"/ ) { $str = $str . '"' }
49 else {
50 $str = '"' . $str;
51 }
52 }
53621µs $content .= ' <p>' . $str . '</p>' . $/;
54}
5516µs$content .= sprintf(' <p><a style="color:gray;font-size:small;" href="/rsmh/%s">permalink</a></p>',$id );
56547µs425µs$content .= sprintf( '<!-- %s -->', join( ' ', grep{$_ =~ s/\D//g} @files ) );
# spent 25µs making 4 calls to main::CORE:subst, avg 6µs/call
5711µs$content .= '
58 </div>
59 </body>
60</html>';
61##########
62# output #
63##########
641325µs1312µsopen( PAGE, '>', $path ) or die $!;
# spent 312µs making 1 call to main::CORE:open
651132µs1103µssyswrite PAGE, $content;
# spent 103µs making 1 call to main::CORE:syswrite
66147µs138µsclose(PAGE);
# spent 38µs making 1 call to main::CORE:close
67#############
68# read back #
69#############
70127µs118µsopen my $fh, '<', $path or die "Can't open file $!";
# spent 18µs making 1 call to main::CORE:open
7133.26ms21.33msprint do { local $/; <$fh> };
# spent 1.32ms making 1 call to main::CORE:print # spent 12µs making 1 call to main::CORE:readline
72
73
74##print $path;
75
76
 
# spent 8µs within Internals::SvREADONLY which was called 3 times, avg 2µs/call: # 3 times (8µs+0s) by constant::import at line 136 of constant.pm, avg 2µs/call
sub Internals::SvREADONLY; # xsub
# spent 242µs within UNIVERSAL::VERSION which was called 21 times, avg 12µs/call: # once (15µs+0s) by Try::Tiny::BEGIN@12 at line 12 of Try/Tiny.pm # once (14µs+0s) by Module::Implementation::BEGIN@8 at line 8 of Module/Implementation.pm # once (14µs+0s) by Moo::HandleMoose::_TypeMap::BEGIN@10 at line 24 of Scalar/Util.pm # once (14µs+0s) by Data::GUID::BEGIN@8 at line 8 of Data/GUID.pm # once (13µs+0s) by B::Hooks::EndOfScope::BEGIN@16 at line 16 of B/Hooks/EndOfScope.pm # once (13µs+0s) by B::Hooks::EndOfScope::XS::BEGIN@9 at line 9 of B/Hooks/EndOfScope/XS.pm # once (13µs+0s) by B::Hooks::EndOfScope::BEGIN@23 at line 26 of B/Hooks/EndOfScope.pm # once (12µs+0s) by Data::OptList::BEGIN@11 at line 11 of Data/OptList.pm # once (12µs+0s) by Data::GUID::BEGIN@353 at line 358 of Data/GUID.pm # once (12µs+0s) by namespace::autoclean::BEGIN@12 at line 12 of namespace/autoclean.pm # once (12µs+0s) by Sub::Exporter::BEGIN@11 at line 11 of Sub/Exporter.pm # once (12µs+0s) by Data::GUID::BEGIN@7 at line 7 of Data/GUID.pm # once (11µs+0s) by B::Hooks::EndOfScope::XS::BEGIN@10 at line 13 of B/Hooks/EndOfScope/XS.pm # once (11µs+0s) by Moo::_Utils::BEGIN@10 at line 22 of Sub/Util.pm # once (11µs+0s) by namespace::autoclean::BEGIN@10 at line 10 of namespace/autoclean.pm # once (11µs+0s) by Sub::Name::BEGIN@58 at line 58 of Sub/Name.pm # once (10µs+0s) by Package::Stash::BEGIN@13 at line 13 of Package/Stash.pm # once (10µs+0s) by Sub::Exporter::BEGIN@12 at line 12 of Sub/Exporter.pm # once (10µs+0s) by Sub::Exporter::BEGIN@13 at line 13 of Sub/Exporter.pm # once (7µs+0s) by Method::Generate::Accessor::BEGIN@11 at line 17 of Method/Generate/Accessor.pm # once (4µs+0s) by Method::Generate::Accessor::BEGIN@11 at line 21 of Method/Generate/Accessor.pm
sub UNIVERSAL::VERSION; # xsub
# spent 80µs within UNIVERSAL::can which was called 23 times, avg 3µs/call: # 9 times (21µs+0s) by Method::Generate::Accessor::_generate_xs at line 619 of Method/Generate/Accessor.pm, avg 2µs/call # 2 times (17µs+0s) by Method::Generate::Constructor::generate_method at line 143 of Method/Generate/Constructor.pm, avg 8µs/call # 2 times (8µs+0s) by Moo::_accessor_maker_for at line 132 of Moo.pm, avg 4µs/call # 2 times (8µs+0s) by Method::Generate::Constructor::generate_method at line 149 of Method/Generate/Constructor.pm, avg 4µs/call # 2 times (5µs+0s) by Method::Generate::Constructor::generate_method at line 134 of Method/Generate/Constructor.pm, avg 2µs/call # once (5µs+0s) by namespace::autoclean::_method_check at line 197 of namespace/autoclean.pm # once (5µs+0s) by Moo::_Utils::_install_modifier at line 43 of Moo/_Utils.pm # once (4µs+0s) by Moo::Object::new at line 23 of Moo/Object.pm # once (3µs+0s) by Moo::Object::new at line 13 of Moo/Object.pm # once (3µs+0s) by Sub::Install::__ANON__[/usr/local/share/perl/5.18.2/Sub/Install.pm:118] at line 106 of Sub/Install.pm # once (2µs+0s) by Class::Method::Modifiers::install_modifier at line 44 of Class/Method/Modifiers.pm
sub UNIVERSAL::can; # xsub
# spent 7µs within UNIVERSAL::isa which was called 3 times, avg 2µs/call: # 3 times (7µs+0s) by base::import at line 73 of base.pm, avg 2µs/call
sub UNIVERSAL::isa; # xsub
# spent 9µs within version::(bool which was called: # once (9µs+0s) by Moo::_Utils::BEGIN@29 at line 59 of Config.pm
sub version::(bool; # xsub
# spent 5µs within version::(cmp which was called: # once (5µs+0s) by Moo::_Utils::BEGIN@29 at line 62 of Config.pm
sub version::(cmp; # xsub