| Filename | /home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/MNG.pm |
| Statements | Executed 21 statements in 2.28ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 111µs | 388µs | RTP::Webmerge::Optimize::MNG::BEGIN@11 |
| 1 | 1 | 1 | 55µs | 791µs | RTP::Webmerge::Optimize::MNG::BEGIN@33 |
| 1 | 1 | 1 | 53µs | 85µs | RTP::Webmerge::Optimize::MNG::BEGIN@13 |
| 1 | 1 | 1 | 52µs | 141µs | RTP::Webmerge::Optimize::MNG::BEGIN@12 |
| 1 | 1 | 1 | 49µs | 49µs | RTP::Webmerge::Optimize::MNG::BEGIN@19 |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::Optimize::MNG::__ANON__[:51] |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::Optimize::MNG::BEGIN@28 |
| 1 | 1 | 1 | 21µs | 21µs | RTP::Webmerge::Optimize::MNG::__ANON__[:77] |
| 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 | # http://optipng.sourceforge.net/pngtech/optipng.html | ||||
| 6 | # pngrewrite, pngcrush, OptiPNG, AdvanceCOMP (advpng), PNGOut | ||||
| 7 | ################################################################################################### | ||||
| 8 | package RTP::Webmerge::Optimize::MNG; | ||||
| 9 | ################################################################################################### | ||||
| 10 | |||||
| 11 | 2 | 173µs | 2 | 665µs | # spent 388µs (111+277) within RTP::Webmerge::Optimize::MNG::BEGIN@11 which was called:
# once (111µs+277µs) by main::BEGIN@50 at line 11 # spent 388µs making 1 call to RTP::Webmerge::Optimize::MNG::BEGIN@11
# spent 277µs making 1 call to Exporter::import |
| 12 | 2 | 144µs | 2 | 230µs | # spent 141µs (52+89) within RTP::Webmerge::Optimize::MNG::BEGIN@12 which was called:
# once (52µs+89µs) by main::BEGIN@50 at line 12 # spent 141µs making 1 call to RTP::Webmerge::Optimize::MNG::BEGIN@12
# spent 89µs making 1 call to strict::import |
| 13 | 2 | 322µs | 2 | 117µs | # spent 85µs (53+32) within RTP::Webmerge::Optimize::MNG::BEGIN@13 which was called:
# once (53µs+32µs) by main::BEGIN@50 at line 13 # spent 85µs making 1 call to RTP::Webmerge::Optimize::MNG::BEGIN@13
# spent 32µs making 1 call to warnings::import |
| 14 | |||||
| 15 | ################################################################################################### | ||||
| 16 | |||||
| 17 | # setup some global settings | ||||
| 18 | BEGIN | ||||
| 19 | # spent 49µs within RTP::Webmerge::Optimize::MNG::BEGIN@19 which was called:
# once (49µs+0s) by main::BEGIN@50 at line 23 | ||||
| 20 | # enable (or disable) different optimizer executables | ||||
| 21 | 1 | 4µs | $ENV{'WEBMERGE_ADVDEF'} = 1 unless exists $ENV{'WEBMERGE_ADVDEF'}; | ||
| 22 | 1 | 47µs | $ENV{'WEBMERGE_ADVMNG'} = 1 unless exists $ENV{'WEBMERGE_ADVMNG'}; | ||
| 23 | 1 | 174µs | 1 | 49µs | } # spent 49µs making 1 call to RTP::Webmerge::Optimize::MNG::BEGIN@19 |
| 24 | |||||
| 25 | ################################################################################################### | ||||
| 26 | |||||
| 27 | # define our version string | ||||
| 28 | 1 | 171µs | 1 | 22µs | # spent 22µs within RTP::Webmerge::Optimize::MNG::BEGIN@28 which was called:
# once (22µs+0s) by main::BEGIN@50 at line 28 # spent 22µs making 1 call to RTP::Webmerge::Optimize::MNG::BEGIN@28 |
| 29 | |||||
| 30 | ################################################################################################### | ||||
| 31 | |||||
| 32 | # load webmberge module variables to hook into | ||||
| 33 | 2 | 1.11ms | 2 | 1.53ms | # spent 791µs (55+736) within RTP::Webmerge::Optimize::MNG::BEGIN@33 which was called:
# once (55µs+736µs) by main::BEGIN@50 at line 33 # spent 791µs making 1 call to RTP::Webmerge::Optimize::MNG::BEGIN@33
# spent 736µs making 1 call to Exporter::import |
| 34 | |||||
| 35 | ################################################################################################### | ||||
| 36 | |||||
| 37 | # push to initers | ||||
| 38 | # return for getOpts | ||||
| 39 | push @initers, sub | ||||
| 40 | # spent 22µs within RTP::Webmerge::Optimize::MNG::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/MNG.pm:51] which was called:
# once (22µs+0s) by RTP::Webmerge::initConfig at line 263 of webmerge/scripts/modules/RTP/Webmerge.pm | ||||
| 41 | |||||
| 42 | # get config | ||||
| 43 | 1 | 4µs | my ($config) = @_; | ||
| 44 | |||||
| 45 | # create config variable to be available | ||||
| 46 | 1 | 4µs | $config->{'optimize-mng'} = undef; | ||
| 47 | |||||
| 48 | # connect each tmpl variable with the getOpt option | ||||
| 49 | 1 | 28µs | return ('optimize-mng|mng!', \ $config->{'cmd_optimize-mng'}); | ||
| 50 | |||||
| 51 | 1 | 16µs | }; | ||
| 52 | # EO push initer | ||||
| 53 | |||||
| 54 | ################################################################################################### | ||||
| 55 | |||||
| 56 | # push to checkers | ||||
| 57 | push @checkers, sub | ||||
| 58 | # spent 21µs within RTP::Webmerge::Optimize::MNG::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/MNG.pm:77] which was called:
# once (21µs+0s) by RTP::Webmerge::checkConfig at line 290 of webmerge/scripts/modules/RTP/Webmerge.pm | ||||
| 59 | |||||
| 60 | # get config | ||||
| 61 | 1 | 3µs | my ($config) = @_; | ||
| 62 | |||||
| 63 | # disable if not optimizing | ||||
| 64 | 1 | 5µs | unless ($config->{'optimize'}) | ||
| 65 | { $config->{'optimize-mng'} = 0; } | ||||
| 66 | |||||
| 67 | # do nothing if feature is disabled | ||||
| 68 | 1 | 24µs | return unless $config->{'optimize-mng'}; | ||
| 69 | |||||
| 70 | # get the optimization level (1 to 4) | ||||
| 71 | my $lvl = '-' . range($config->{'level'}, 1, 5, 4); | ||||
| 72 | |||||
| 73 | # define executables to optimize mngs | ||||
| 74 | $executables{'advmng'} = ['mngopt', "-z $lvl --quiet \"%s\"", 2] if $ENV{'WEBMERGE_ADVMNG'}; | ||||
| 75 | $executables{'advdef[mng]'} = ['mngopt', "-z $lvl --quiet \"%s\"", 2] if $ENV{'WEBMERGE_ADVDEF'}; | ||||
| 76 | |||||
| 77 | 1 | 14µs | }; | ||
| 78 | # EO push checker | ||||
| 79 | |||||
| 80 | ################################################################################################### | ||||
| 81 | |||||
| 82 | # now create a new file optimizer subroutine and hook it into our optimizers | ||||
| 83 | 1 | 20µs | 1 | 35µs | $RTP::Webmerge::Optimize::optimizer{'mng'} = RTP::Webmerge::Optimize::optimize('mng'); # spent 35µs making 1 call to RTP::Webmerge::Optimize::optimize |
| 84 | |||||
| 85 | ################################################################################################### | ||||
| 86 | ################################################################################################### | ||||
| 87 | 1 | 22µs | 1; |