| Filename | /usr/local/share/perl/5.18.2/Stream/Buffered.pm |
| Statements | Executed 15 statements in 479µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 506µs | 985µs | Stream::Buffered::BEGIN@5 |
| 1 | 1 | 1 | 232µs | 317µs | Stream::Buffered::BEGIN@6 |
| 1 | 1 | 1 | 211µs | 398µs | Stream::Buffered::BEGIN@7 |
| 1 | 1 | 1 | 188µs | 268µs | Stream::Buffered::BEGIN@8 |
| 1 | 1 | 1 | 19µs | 28µs | Stream::Buffered::BEGIN@3 |
| 1 | 1 | 1 | 8µs | 26µs | Stream::Buffered::BEGIN@2 |
| 0 | 0 | 0 | 0s | 0s | Stream::Buffered::create |
| 0 | 0 | 0 | 0s | 0s | Stream::Buffered::new |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Stream::Buffered; | ||||
| 2 | 2 | 29µs | 2 | 45µs | # spent 26µs (8+19) within Stream::Buffered::BEGIN@2 which was called:
# once (8µs+19µs) by Plack::Request::BEGIN@13 at line 2 # spent 26µs making 1 call to Stream::Buffered::BEGIN@2
# spent 19µs making 1 call to strict::import |
| 3 | 2 | 22µs | 2 | 36µs | # spent 28µs (19+8) within Stream::Buffered::BEGIN@3 which was called:
# once (19µs+8µs) by Plack::Request::BEGIN@13 at line 3 # spent 28µs making 1 call to Stream::Buffered::BEGIN@3
# spent 8µs making 1 call to warnings::import |
| 4 | |||||
| 5 | 2 | 96µs | 2 | 1.30ms | # spent 985µs (506+479) within Stream::Buffered::BEGIN@5 which was called:
# once (506µs+479µs) by Plack::Request::BEGIN@13 at line 5 # spent 985µs making 1 call to Stream::Buffered::BEGIN@5
# spent 311µs making 1 call to FileHandle::import |
| 6 | 2 | 70µs | 1 | 317µs | # spent 317µs (232+84) within Stream::Buffered::BEGIN@6 which was called:
# once (232µs+84µs) by Plack::Request::BEGIN@13 at line 6 # spent 317µs making 1 call to Stream::Buffered::BEGIN@6 |
| 7 | 2 | 69µs | 1 | 398µs | # spent 398µs (211+187) within Stream::Buffered::BEGIN@7 which was called:
# once (211µs+187µs) by Plack::Request::BEGIN@13 at line 7 # spent 398µs making 1 call to Stream::Buffered::BEGIN@7 |
| 8 | 2 | 190µs | 1 | 268µs | # spent 268µs (188+80) within Stream::Buffered::BEGIN@8 which was called:
# once (188µs+80µs) by Plack::Request::BEGIN@13 at line 8 # spent 268µs making 1 call to Stream::Buffered::BEGIN@8 |
| 9 | |||||
| 10 | 1 | 200ns | our $VERSION = 0.03; | ||
| 11 | |||||
| 12 | 1 | 100ns | our $MaxMemoryBufferSize = 1024 * 1024; | ||
| 13 | |||||
| 14 | sub new { | ||||
| 15 | my($class, $length) = @_; | ||||
| 16 | |||||
| 17 | # $MaxMemoryBufferSize = 0 -> Always temp file | ||||
| 18 | # $MaxMemoryBufferSize = -1 -> Always PerlIO | ||||
| 19 | my $backend; | ||||
| 20 | if ($MaxMemoryBufferSize < 0) { | ||||
| 21 | $backend = "PerlIO"; | ||||
| 22 | } elsif ($MaxMemoryBufferSize == 0) { | ||||
| 23 | $backend = "File"; | ||||
| 24 | } elsif (!$length) { | ||||
| 25 | $backend = "Auto"; | ||||
| 26 | } elsif ($length > $MaxMemoryBufferSize) { | ||||
| 27 | $backend = "File"; | ||||
| 28 | } else { | ||||
| 29 | $backend = "PerlIO"; | ||||
| 30 | } | ||||
| 31 | |||||
| 32 | $class->create($backend, $length, $MaxMemoryBufferSize); | ||||
| 33 | } | ||||
| 34 | |||||
| 35 | sub create { | ||||
| 36 | my($class, $backend, $length, $max) = @_; | ||||
| 37 | (__PACKAGE__ . "::$backend")->new($length, $max); | ||||
| 38 | } | ||||
| 39 | |||||
| 40 | sub print; | ||||
| 41 | sub rewind; | ||||
| 42 | sub size; | ||||
| 43 | |||||
| 44 | 1 | 2µs | 1; | ||
| 45 | |||||
| 46 | __END__ |