| Filename | /home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/GZ.pm |
| Statements | Executed 20 statements in 2.08ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 88µs | 376µs | RTP::Webmerge::Optimize::GZ::BEGIN@8 |
| 1 | 1 | 1 | 57µs | 90µs | RTP::Webmerge::Optimize::GZ::BEGIN@10 |
| 1 | 1 | 1 | 56µs | 828µs | RTP::Webmerge::Optimize::GZ::BEGIN@29 |
| 1 | 1 | 1 | 54µs | 140µs | RTP::Webmerge::Optimize::GZ::BEGIN@9 |
| 1 | 1 | 1 | 52µs | 52µs | RTP::Webmerge::Optimize::GZ::__ANON__[:47] |
| 1 | 1 | 1 | 24µs | 24µs | RTP::Webmerge::Optimize::GZ::BEGIN@16 |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::Optimize::GZ::BEGIN@24 |
| 1 | 1 | 1 | 19µs | 19µs | RTP::Webmerge::Optimize::GZ::__ANON__[:72] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ################################################################################################### | ||||
| 2 | # Copyright 2013 by Marcel Greter | ||||
| 3 | # This file is part of Webmerge (GPL3) | ||||
| 4 | ################################################################################################### | ||||
| 5 | package RTP::Webmerge::Optimize::GZ; | ||||
| 6 | ################################################################################################### | ||||
| 7 | |||||
| 8 | 2 | 165µs | 2 | 664µs | # spent 376µs (88+288) within RTP::Webmerge::Optimize::GZ::BEGIN@8 which was called:
# once (88µs+288µs) by main::BEGIN@52 at line 8 # spent 376µs making 1 call to RTP::Webmerge::Optimize::GZ::BEGIN@8
# spent 288µs making 1 call to Exporter::import |
| 9 | 2 | 162µs | 2 | 225µs | # spent 140µs (54+86) within RTP::Webmerge::Optimize::GZ::BEGIN@9 which was called:
# once (54µs+86µs) by main::BEGIN@52 at line 9 # spent 140µs making 1 call to RTP::Webmerge::Optimize::GZ::BEGIN@9
# spent 86µs making 1 call to strict::import |
| 10 | 2 | 244µs | 2 | 122µs | # spent 90µs (57+33) within RTP::Webmerge::Optimize::GZ::BEGIN@10 which was called:
# once (57µs+33µs) by main::BEGIN@52 at line 10 # spent 90µs making 1 call to RTP::Webmerge::Optimize::GZ::BEGIN@10
# spent 33µs making 1 call to warnings::import |
| 11 | |||||
| 12 | ################################################################################################### | ||||
| 13 | |||||
| 14 | # setup some global settings | ||||
| 15 | BEGIN | ||||
| 16 | # spent 24µs within RTP::Webmerge::Optimize::GZ::BEGIN@16 which was called:
# once (24µs+0s) by main::BEGIN@52 at line 19 | ||||
| 17 | # enable (or disable) different optimizer executables | ||||
| 18 | 1 | 27µs | $ENV{'WEBMERGE_ADVDEF'} = 1 unless exists $ENV{'WEBMERGE_ADVDEF'}; | ||
| 19 | 1 | 143µs | 1 | 24µs | } # spent 24µs making 1 call to RTP::Webmerge::Optimize::GZ::BEGIN@16 |
| 20 | |||||
| 21 | ################################################################################################### | ||||
| 22 | |||||
| 23 | # define our version string | ||||
| 24 | 1 | 148µs | 1 | 22µs | # spent 22µs within RTP::Webmerge::Optimize::GZ::BEGIN@24 which was called:
# once (22µs+0s) by main::BEGIN@52 at line 24 # spent 22µs making 1 call to RTP::Webmerge::Optimize::GZ::BEGIN@24 |
| 25 | |||||
| 26 | ################################################################################################### | ||||
| 27 | |||||
| 28 | # load webmberge module variables to hook into | ||||
| 29 | 2 | 1.02ms | 2 | 1.60ms | # spent 828µs (56+772) within RTP::Webmerge::Optimize::GZ::BEGIN@29 which was called:
# once (56µs+772µs) by main::BEGIN@52 at line 29 # spent 828µs making 1 call to RTP::Webmerge::Optimize::GZ::BEGIN@29
# spent 772µs making 1 call to Exporter::import |
| 30 | |||||
| 31 | ################################################################################################### | ||||
| 32 | |||||
| 33 | # push to initers | ||||
| 34 | # return for getOpts | ||||
| 35 | push @initers, sub | ||||
| 36 | # spent 52µs within RTP::Webmerge::Optimize::GZ::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/GZ.pm:47] which was called:
# once (52µs+0s) by RTP::Webmerge::initConfig at line 263 of webmerge/scripts/modules/RTP/Webmerge.pm | ||||
| 37 | |||||
| 38 | # get config | ||||
| 39 | 1 | 6µs | my ($config) = @_; | ||
| 40 | |||||
| 41 | # create config variable to be available | ||||
| 42 | 1 | 9µs | $config->{'optimize-gz'} = 1; | ||
| 43 | |||||
| 44 | # connect each tmpl variable with the getOpt option | ||||
| 45 | 1 | 54µs | return ('optimize-gz|gz!', \ $config->{'cmd_optimize-gz'}); | ||
| 46 | |||||
| 47 | 1 | 15µs | }; | ||
| 48 | # EO push initer | ||||
| 49 | |||||
| 50 | ################################################################################################### | ||||
| 51 | |||||
| 52 | # push to checkers | ||||
| 53 | push @checkers, sub | ||||
| 54 | # spent 19µs within RTP::Webmerge::Optimize::GZ::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/GZ.pm:72] which was called:
# once (19µs+0s) by RTP::Webmerge::checkConfig at line 290 of webmerge/scripts/modules/RTP/Webmerge.pm | ||||
| 55 | |||||
| 56 | # get config | ||||
| 57 | 1 | 3µs | my ($config) = @_; | ||
| 58 | |||||
| 59 | # disable if not optimizing | ||||
| 60 | 1 | 4µs | unless ($config->{'optimize'}) | ||
| 61 | { $config->{'optimize-gz'} = 0; } | ||||
| 62 | |||||
| 63 | # do nothing if feature is disabled | ||||
| 64 | 1 | 26µs | return unless $config->{'optimize-gz'}; | ||
| 65 | |||||
| 66 | # get the optimization level (1 to 4) | ||||
| 67 | my $lvl = '-' . range($config->{'level'}, 1, 5, 4); | ||||
| 68 | |||||
| 69 | # define executables to optimize gz archives | ||||
| 70 | $executables{'advdef[gz]'} = ['gzopt', "-z $lvl --quiet \"%s\"", 2] if $ENV{'WEBMERGE_ADVDEF'}; | ||||
| 71 | |||||
| 72 | 1 | 13µs | }; | ||
| 73 | # EO push checker | ||||
| 74 | |||||
| 75 | ################################################################################################### | ||||
| 76 | |||||
| 77 | # now create a new file optimizer subroutine and hook it into our optimizers | ||||
| 78 | 1 | 20µs | 1 | 35µs | $RTP::Webmerge::Optimize::optimizer{'gz'} = RTP::Webmerge::Optimize::optimize('gz'); # spent 35µs making 1 call to RTP::Webmerge::Optimize::optimize |
| 79 | |||||
| 80 | ################################################################################################### | ||||
| 81 | ################################################################################################### | ||||
| 82 | 1 | 22µs | 1; |