| Filename | /home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/JPG.pm |
| Statements | Executed 21 statements in 2.19ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 90µs | 390µs | RTP::Webmerge::Optimize::JPG::BEGIN@8 |
| 1 | 1 | 1 | 56µs | 56µs | RTP::Webmerge::Optimize::JPG::BEGIN@16 |
| 1 | 1 | 1 | 53µs | 84µs | RTP::Webmerge::Optimize::JPG::BEGIN@10 |
| 1 | 1 | 1 | 52µs | 719µs | RTP::Webmerge::Optimize::JPG::BEGIN@30 |
| 1 | 1 | 1 | 51µs | 140µs | RTP::Webmerge::Optimize::JPG::BEGIN@9 |
| 1 | 1 | 1 | 24µs | 24µs | RTP::Webmerge::Optimize::JPG::__ANON__[:48] |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::Optimize::JPG::__ANON__[:71] |
| 1 | 1 | 1 | 21µs | 21µs | RTP::Webmerge::Optimize::JPG::BEGIN@25 |
| 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::JPG; | ||||
| 6 | ################################################################################################### | ||||
| 7 | |||||
| 8 | 2 | 166µs | 2 | 689µs | # spent 390µs (90+299) within RTP::Webmerge::Optimize::JPG::BEGIN@8 which was called:
# once (90µs+299µs) by main::BEGIN@48 at line 8 # spent 390µs making 1 call to RTP::Webmerge::Optimize::JPG::BEGIN@8
# spent 299µs making 1 call to Exporter::import |
| 9 | 2 | 141µs | 2 | 228µs | # spent 140µs (51+89) within RTP::Webmerge::Optimize::JPG::BEGIN@9 which was called:
# once (51µs+89µs) by main::BEGIN@48 at line 9 # spent 140µs making 1 call to RTP::Webmerge::Optimize::JPG::BEGIN@9
# spent 89µs making 1 call to strict::import |
| 10 | 2 | 332µs | 2 | 115µs | # spent 84µs (53+31) within RTP::Webmerge::Optimize::JPG::BEGIN@10 which was called:
# once (53µs+31µs) by main::BEGIN@48 at line 10 # spent 84µs making 1 call to RTP::Webmerge::Optimize::JPG::BEGIN@10
# spent 31µs making 1 call to warnings::import |
| 11 | |||||
| 12 | ################################################################################################### | ||||
| 13 | |||||
| 14 | # setup some global settings | ||||
| 15 | BEGIN | ||||
| 16 | # spent 56µs within RTP::Webmerge::Optimize::JPG::BEGIN@16 which was called:
# once (56µs+0s) by main::BEGIN@48 at line 20 | ||||
| 17 | # enable (or disable) different optimizer executables | ||||
| 18 | 1 | 21µs | $ENV{'WEBMERGE_JPEGTRAN'} = 1 unless exists $ENV{'WEBMERGE_JPEGTRAN'}; | ||
| 19 | 1 | 38µs | $ENV{'WEBMERGE_JPEGOPTIM'} = 1 unless exists $ENV{'WEBMERGE_JPEGOPTIM'}; | ||
| 20 | 1 | 145µs | 1 | 56µs | } # spent 56µs making 1 call to RTP::Webmerge::Optimize::JPG::BEGIN@16 |
| 21 | |||||
| 22 | ################################################################################################### | ||||
| 23 | |||||
| 24 | # define our version string | ||||
| 25 | 1 | 147µs | 1 | 21µs | # spent 21µs within RTP::Webmerge::Optimize::JPG::BEGIN@25 which was called:
# once (21µs+0s) by main::BEGIN@48 at line 25 # spent 21µs making 1 call to RTP::Webmerge::Optimize::JPG::BEGIN@25 |
| 26 | |||||
| 27 | ################################################################################################### | ||||
| 28 | |||||
| 29 | # load webmberge module variables to hook into | ||||
| 30 | 2 | 1.06ms | 2 | 1.39ms | # spent 719µs (52+667) within RTP::Webmerge::Optimize::JPG::BEGIN@30 which was called:
# once (52µs+667µs) by main::BEGIN@48 at line 30 # spent 719µs making 1 call to RTP::Webmerge::Optimize::JPG::BEGIN@30
# spent 667µs making 1 call to Exporter::import |
| 31 | |||||
| 32 | ################################################################################################### | ||||
| 33 | |||||
| 34 | # push to initers | ||||
| 35 | # return for getOpts | ||||
| 36 | push @initers, sub | ||||
| 37 | # spent 24µs within RTP::Webmerge::Optimize::JPG::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/JPG.pm:48] which was called:
# once (24µs+0s) by RTP::Webmerge::initConfig at line 263 of webmerge/scripts/modules/RTP/Webmerge.pm | ||||
| 38 | |||||
| 39 | # get config | ||||
| 40 | 1 | 5µs | my ($config) = @_; | ||
| 41 | |||||
| 42 | # create config variable to be available | ||||
| 43 | 1 | 4µs | $config->{'optimize-jpg'} = undef; | ||
| 44 | |||||
| 45 | # connect each tmpl variable with the getOpt option | ||||
| 46 | 1 | 28µs | return ('optimize-jpg|jpg!', \ $config->{'cmd_optimize-jpg'}); | ||
| 47 | |||||
| 48 | 1 | 15µs | }; | ||
| 49 | # EO push initer | ||||
| 50 | |||||
| 51 | ################################################################################################### | ||||
| 52 | |||||
| 53 | # push to checkers | ||||
| 54 | push @checkers, sub | ||||
| 55 | # spent 22µs within RTP::Webmerge::Optimize::JPG::__ANON__[/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize/JPG.pm:71] which was called:
# once (22µs+0s) by RTP::Webmerge::checkConfig at line 290 of webmerge/scripts/modules/RTP/Webmerge.pm | ||||
| 56 | |||||
| 57 | # get config | ||||
| 58 | 1 | 3µs | my ($config) = @_; | ||
| 59 | |||||
| 60 | # disable if not optimizing | ||||
| 61 | 1 | 7µs | unless ($config->{'optimize'}) | ||
| 62 | { $config->{'optimize-jpg'} = 0; } | ||||
| 63 | |||||
| 64 | # do nothing if feature is disabled | ||||
| 65 | 1 | 24µs | return unless $config->{'optimize-jpg'}; | ||
| 66 | |||||
| 67 | # define executables to optimize jpgs | ||||
| 68 | $executables{'jpegoptim'} = ['jpgopt', "--quiet \"%s\""] if $ENV{'WEBMERGE_JPEGOPTIM'}; | ||||
| 69 | $executables{'jpegtran'} = ['jpgopt', '-copy none -optimize -outfile "%s" "%s"'] if $ENV{'WEBMERGE_JPEGTRAN'}; | ||||
| 70 | |||||
| 71 | 1 | 11µs | }; | ||
| 72 | # EO push checker | ||||
| 73 | |||||
| 74 | ################################################################################################### | ||||
| 75 | |||||
| 76 | # now create a new file optimizer subroutine and hook it into our optimizers | ||||
| 77 | 1 | 19µs | 1 | 35µs | $RTP::Webmerge::Optimize::optimizer{'jpg'} = RTP::Webmerge::Optimize::optimize('jpg'); # spent 35µs making 1 call to RTP::Webmerge::Optimize::optimize |
| 78 | |||||
| 79 | ################################################################################################### | ||||
| 80 | ################################################################################################### | ||||
| 81 | 1 | 21µs | 1; |