← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/bin/epoll_server.pl
  Run on Wed Jan 5 05:34:33 2011
Reported on Wed Jan 5 05:36:13 2011

File /usr/lib/perl5/vendor_perl/5.10.1/MIME/Type.pm
Statements Executed 10504
Statement Execution Time 114ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11162230.0ms40.4msMIME::Type::::simplifiedMIME::Type::simplified
5581129.1ms64.1msMIME::Type::::initMIME::Type::init
15622216.0ms16.0msMIME::Type::::CORE:matchMIME::Type::CORE:match (opcode)
5581113.1ms77.1msMIME::Type::::newMIME::Type::new
446118.37ms14.0msMIME::Type::::mediaTypeMIME::Type::mediaType
557115.88ms5.88msMIME::Type::::extensionsMIME::Type::extensions
558114.73ms4.73msMIME::Type::::systemMIME::Type::system
11150µs182µsMIME::Type::::BEGIN@6MIME::Type::BEGIN@6
11137µs560µsMIME::Type::::BEGIN@18MIME::Type::BEGIN@18
11131µs42µsMIME::Type::::BEGIN@10MIME::Type::BEGIN@10
11130µs135µsMIME::Type::::BEGIN@12MIME::Type::BEGIN@12
0000s0sMIME::Type::::encodingMIME::Type::encoding
0000s0sMIME::Type::::equalsMIME::Type::equals
0000s0sMIME::Type::::isAsciiMIME::Type::isAscii
0000s0sMIME::Type::::isBinaryMIME::Type::isBinary
0000s0sMIME::Type::::isRegisteredMIME::Type::isRegistered
0000s0sMIME::Type::::isSignatureMIME::Type::isSignature
0000s0sMIME::Type::::mainTypeMIME::Type::mainType
0000s0sMIME::Type::::subTypeMIME::Type::subType
0000s0sMIME::Type::::typeMIME::Type::type
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# Copyrights 1999,2001-2010 by Mark Overmeer.
2# For other contributors see ChangeLog.
3# See the manual pages for details on the licensing terms.
4# Pod stripped from pm file by OODoc 1.06.
5package MIME::Type;
63139µs2315µs
# spent 182µs (50+133) within MIME::Type::BEGIN@6 which was called # once (50µs+133µs) by MIME::Types::BEGIN@13 at line 6
use vars '$VERSION';
# spent 182µs making 1 call to MIME::Type::BEGIN@6 # spent 133µs making 1 call to vars::import
713µs$VERSION = '1.29';
8
9
10383µs254µs
# spent 42µs (31+11) within MIME::Type::BEGIN@10 which was called # once (31µs+11µs) by MIME::Types::BEGIN@13 at line 10
use strict;
# spent 42µs making 1 call to MIME::Type::BEGIN@10 # spent 11µs making 1 call to strict::import
11
12395µs2240µs
# spent 135µs (30+105) within MIME::Type::BEGIN@12 which was called # once (30µs+105µs) by MIME::Types::BEGIN@13 at line 12
use Carp 'croak';
# spent 135µs making 1 call to MIME::Type::BEGIN@12 # spent 105µs making 1 call to Exporter::import
13
14
15#-------------------------------------------
16
17
18
# spent 560µs (37+523) within MIME::Type::BEGIN@18 which was called # once (37µs+523µs) by MIME::Types::BEGIN@13 at line 20
use overload '""' => 'type'
# spent 524µs making 1 call to overload::import
19 , cmp => 'equals'
2032.30ms1560µs ;
# spent 560µs making 1 call to MIME::Type::BEGIN@18
21
22#-------------------------------------------
23
24
2555813.0ms55864.1ms
# spent 77.1ms (13.1+64.1) within MIME::Type::new which was called 558 times, avg 138µs/call: # 558 times (13.1ms+64.1ms) by MIME::Types::init at line 38 of MIME/Types.pm, avg 138µs/call
sub new(@) { (bless {}, shift)->init( {@_} ) }
# spent 64.1ms making 558 calls to MIME::Type::init, avg 115µs/call
26
27sub init($)
28390625.6ms
# spent 64.1ms (29.1+34.9) within MIME::Type::init which was called 558 times, avg 115µs/call: # 558 times (29.1ms+34.9ms) by MIME::Type::new at line 25, avg 115µs/call
{ my ($self, $args) = @_;
29
30 $self->{MT_type} = $args->{type}
31 or croak "ERROR: Type parameter is obligatory.";
32
33 $self->{MT_simplified} = $args->{simplified}
# spent 20.9ms making 558 calls to MIME::Type::simplified, avg 38µs/call
34 || ref($self)->simplified($args->{type});
35
36 $self->{MT_extensions} = $args->{extensions} || [];
37
38 $self->{MT_encoding}
# spent 14.0ms making 446 calls to MIME::Type::mediaType, avg 31µs/call
39 = $args->{encoding} ? $args->{encoding}
40 : $self->mediaType eq 'text' ? 'quoted-printable'
41 : 'base64';
42
43 $self->{MT_system} = $args->{system}
44 if defined $args->{system};
45
46 $self;
47}
48
49#-------------------------------------------
50
51
52sub type() {shift->{MT_type}}
53
54#-------------------------------------------
55
56
57sub simplified(;$)
58446445.5ms
# spent 40.4ms (30.0+10.4) within MIME::Type::simplified which was called 1116 times, avg 36µs/call: # 558 times (15.7ms+5.19ms) by MIME::Type::init at line 33, avg 38µs/call # 558 times (14.3ms+5.19ms) by MIME::Types::init at line 37 of MIME/Types.pm, avg 35µs/call
{ my $thing = shift;
59 return $thing->{MT_simplified} unless @_;
60
61 my $mime = shift;
62
63 $mime =~ m!^\s*(?:x\-)?([\w.+-]+)/(?:x\-)?([\w.+-]+)\s*$!i ? lc "$1/$2"
# spent 10.4ms making 1116 calls to MIME::Type::CORE:match, avg 9µs/call
64 : $mime =~ m!text! ? "text/plain" # some silly mailers...
65 : undef;
66}
67
68#-------------------------------------------
69
70
715576.91ms
# spent 5.88ms within MIME::Type::extensions which was called 557 times, avg 11µs/call: # 557 times (5.88ms+0s) by MIME::Types::create_type_index at line 65 of MIME/Types.pm, avg 11µs/call
sub extensions() { @{shift->{MT_extensions}} }
72
73#-------------------------------------------
74
75
76sub encoding() {shift->{MT_encoding}}
77
78#-------------------------------------------
79
80
815586.20ms
# spent 4.73ms within MIME::Type::system which was called 558 times, avg 8µs/call: # 558 times (4.73ms+0s) by MIME::Types::create_type_index at line 58 of MIME/Types.pm, avg 8µs/call
sub system() {shift->{MT_system}}
82
83#-------------------------------------------
84
85
8644614.1ms4465.61ms
# spent 14.0ms (8.37+5.61) within MIME::Type::mediaType which was called 446 times, avg 31µs/call: # 446 times (8.37ms+5.61ms) by MIME::Type::init at line 38, avg 31µs/call
sub mediaType() {shift->{MT_simplified} =~ m!^([\w-]+)/! ? $1 : undef}
# spent 5.61ms making 446 calls to MIME::Type::CORE:match, avg 13µs/call
87
88sub mainType() {shift->mediaType} # Backwards compatibility
89
90#-------------------------------------------
91
92
93sub subType() {shift->{MT_simplified} =~ m!/([\w-]+)$! ? $1 : undef}
94
95#-------------------------------------------
96
97
98sub isRegistered()
99{ local $_ = shift->{MT_type};
100 not (m/^[xX]\-/ || m!/[xX]\-!);
101}
102
103
104#-------------------------------------------
105
106
107sub isBinary() { shift->{MT_encoding} eq 'base64' }
108
109#-------------------------------------------
110
111
112sub isAscii() { shift->{MT_encoding} ne 'base64' }
113
114#-------------------------------------------
115
116
117# simplified names only!
118120µsmy %sigs = map { ($_ => 1) }
119 qw(application/pgp-keys application/pgp application/pgp-signature
120 application/pkcs10 application/pkcs7-mime application/pkcs7-signature
121 text/vCard);
122
123sub isSignature() { $sigs{shift->{MT_simplified}} }
124
125#-------------------------------------------
126
127
128sub equals($)
129{ my ($self, $other) = @_;
130
131 my $type = ref $other
132 ? $other->simplified
133 : (ref $self)->simplified($other);
134
135 $self->simplified cmp $type;
136}
137
138116µs1;
# spent 16.0ms within MIME::Type::CORE:match which was called 1562 times, avg 10µs/call: # 1116 times (10.4ms+0s) by MIME::Type::simplified at line 63 of MIME/Type.pm, avg 9µs/call # 446 times (5.61ms+0s) by MIME::Type::mediaType at line 86 of MIME/Type.pm, avg 13µs/call
sub MIME::Type::CORE:match; # xsub