Filename | /var/www/noelgalaga.com/html/rsmh/index.cgi |
Statements | Executed 60 statements in 9.10ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 3.33ms | 3.36ms | BEGIN@3 | main::
1 | 1 | 1 | 2.30ms | 71.3ms | BEGIN@7 | main::
1 | 1 | 1 | 2.13ms | 16.0ms | BEGIN@8 | main::
1 | 1 | 1 | 463µs | 516µs | BEGIN@2 | main::
21 | 21 | 13 | 242µs | 242µs | VERSION (xsub) | UNIVERSAL::
23 | 11 | 8 | 80µs | 80µs | can (xsub) | UNIVERSAL::
1 | 1 | 1 | 9µs | 9µs | (bool (xsub) | version::
3 | 1 | 1 | 8µs | 8µs | SvREADONLY (xsub) | Internals::
3 | 1 | 1 | 7µs | 7µs | isa (xsub) | UNIVERSAL::
1 | 1 | 1 | 5µs | 5µs | (cmp (xsub) | version::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
0 | 1 | 4µs | Profile data that couldn't be associated with a specific line: # spent 4µs making 1 call to Class::XSAccessor::END | ||
1 | #!/usr/bin/perl | ||||
2 | 2 | 425µs | 2 | 541µs | # spent 516µs (463+53) within main::BEGIN@2 which was called:
# once (463µs+53µs) by main::RUNTIME at line 2 # spent 516µs making 1 call to main::BEGIN@2
# spent 25µs making 1 call to strict::import |
3 | 2 | 3.22ms | 2 | 3.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 # 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; | ||||
7 | 2 | 127µs | 1 | 71.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 # spent 71.3ms making 1 call to main::BEGIN@7 |
8 | 2 | 737µs | 2 | 16.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 # spent 16.0ms making 1 call to main::BEGIN@8
# spent 146µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
9 | 1 | 7µs | 1 | 297µs | my $guid = Data::GUID->new; # spent 297µs making 1 call to Data::GUID::new |
10 | 1 | 3µs | 1 | 112µs | my $id = $guid->as_string(); # spent 112µs making 1 call to Data::GUID::__ANON__[Data/GUID.pm:147] |
11 | 1 | 7µs | my $path = sprintf( '/var/www/noelgalaga.com/html/rsmh/pages/%s/%s.html', substr($id,0,1), $id ); | ||
12 | 1 | 2µs | $|++; | ||
13 | 1 | 218µs | 1 | 188µs | print "Content-type: text/html\n\n"; # spent 188µs making 1 call to main::CORE:print |
14 | ###################### | ||||
15 | # headline generator # | ||||
16 | ###################### | ||||
17 | 1 | 7µs | 1 | 10.7ms | my $hg = String::Markov->new( order => 1, sep => ' ' ); # spent 10.7ms making 1 call to String::Markov::new |
18 | 1 | 4µs | 1 | 53.3ms | $hg->add_files('/var/www/noelgalaga.com/data/headlines.txt'); # spent 53.3ms making 1 call to String::Markov::add_files |
19 | 1 | 14µs | 1 | 222µs | my $headline = ucfirst( $hg->generate_sample ); # spent 222µs making 1 call to String::Markov::generate_sample |
20 | 1 | 300ns | my $content; | ||
21 | 1 | 379µ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 | ####################### | ||||
38 | 1 | 12µs | 1 | 175µs | my $pg = String::Markov->new( order => 1, sep => ' ' ); # spent 175µs making 1 call to String::Markov::new |
39 | 1 | 1µs | my @files = (); | ||
40 | 1 | 3µs | for ( 1 .. 4 ) { | ||
41 | 4 | 8µs | push( @files, "../../data/" . int( rand(246) ) . '.text' ); | ||
42 | } | ||||
43 | 1 | 4µs | 1 | 43.6ms | $pg->add_files(@files); # spent 43.6ms making 1 call to String::Markov::add_files |
44 | 1 | 5µs | my $pars = int( rand(5) ) + 4; | ||
45 | 1 | 3µs | for ( 1 .. $pars ) { | ||
46 | 6 | 22µs | 6 | 2.13ms | my $str = ucfirst( $pg->generate_sample ); # spent 2.13ms making 6 calls to String::Markov::generate_sample, avg 355µs/call |
47 | 6 | 23µs | if ( (($str =~ tr/"//) % 2) == 1 ) { | ||
48 | if ( $str =~ /^"/ ) { $str = $str . '"' } | ||||
49 | else { | ||||
50 | $str = '"' . $str; | ||||
51 | } | ||||
52 | } | ||||
53 | 6 | 21µs | $content .= ' <p>' . $str . '</p>' . $/; | ||
54 | } | ||||
55 | 1 | 6µs | $content .= sprintf(' <p><a style="color:gray;font-size:small;" href="/rsmh/%s">permalink</a></p>',$id ); | ||
56 | 5 | 47µs | 4 | 25µs | $content .= sprintf( '<!-- %s -->', join( ' ', grep{$_ =~ s/\D//g} @files ) ); # spent 25µs making 4 calls to main::CORE:subst, avg 6µs/call |
57 | 1 | 1µs | $content .= ' | ||
58 | </div> | ||||
59 | </body> | ||||
60 | </html>'; | ||||
61 | ########## | ||||
62 | # output # | ||||
63 | ########## | ||||
64 | 1 | 325µs | 1 | 312µs | open( PAGE, '>', $path ) or die $!; # spent 312µs making 1 call to main::CORE:open |
65 | 1 | 132µs | 1 | 103µs | syswrite PAGE, $content; # spent 103µs making 1 call to main::CORE:syswrite |
66 | 1 | 47µs | 1 | 38µs | close(PAGE); # spent 38µs making 1 call to main::CORE:close |
67 | ############# | ||||
68 | # read back # | ||||
69 | ############# | ||||
70 | 1 | 27µs | 1 | 18µs | open my $fh, '<', $path or die "Can't open file $!"; # spent 18µs making 1 call to main::CORE:open |
71 | 3 | 3.26ms | 2 | 1.33ms | print 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 | |||||
# 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 | |||||
# 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 | |||||
# 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 | |||||
# spent 9µs within version::(bool which was called:
# once (9µs+0s) by Moo::_Utils::BEGIN@29 at line 59 of Config.pm | |||||
# spent 5µs within version::(cmp which was called:
# once (5µs+0s) by Moo::_Utils::BEGIN@29 at line 62 of Config.pm |