Filename | /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Message/Metadata.pm |
Statements | Executed 14959 statements in 92.0ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
235 | 1 | 1 | 77.2ms | 3.74s | extract | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 13.9ms | 215ms | BEGIN@59 | Mail::SpamAssassin::Message::Metadata::
235 | 1 | 1 | 11.0ms | 11.0ms | finish | Mail::SpamAssassin::Message::Metadata::
235 | 1 | 1 | 4.53ms | 4.53ms | new | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 49µs | 59µs | BEGIN@51 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 35µs | 235µs | BEGIN@60 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 29µs | 29µs | BEGIN@56 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 27µs | 96µs | BEGIN@54 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 25µs | 32µs | BEGIN@53 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 23µs | 164µs | BEGIN@58 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 23µs | 56µs | BEGIN@52 | Mail::SpamAssassin::Message::Metadata::
1 | 1 | 1 | 22µs | 798µs | BEGIN@57 | Mail::SpamAssassin::Message::Metadata::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # <@LICENSE> | ||||
2 | # Licensed to the Apache Software Foundation (ASF) under one or more | ||||
3 | # contributor license agreements. See the NOTICE file distributed with | ||||
4 | # this work for additional information regarding copyright ownership. | ||||
5 | # The ASF licenses this file to you under the Apache License, Version 2.0 | ||||
6 | # (the "License"); you may not use this file except in compliance with | ||||
7 | # the License. You may obtain a copy of the License at: | ||||
8 | # | ||||
9 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||
10 | # | ||||
11 | # Unless required by applicable law or agreed to in writing, software | ||||
12 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
14 | # See the License for the specific language governing permissions and | ||||
15 | # limitations under the License. | ||||
16 | # </@LICENSE> | ||||
17 | |||||
18 | =head1 NAME | ||||
19 | |||||
20 | Mail::SpamAssassin::Message::Metadata - extract metadata from a message | ||||
21 | |||||
22 | =head1 SYNOPSIS | ||||
23 | |||||
24 | =head1 DESCRIPTION | ||||
25 | |||||
26 | This class is tasked with extracting "metadata" from messages for use as | ||||
27 | Bayes tokens, fodder for eval tests, or other rules. Metadata is | ||||
28 | supplemental data inferred from the message, like the examples below. | ||||
29 | |||||
30 | It is held in two forms: | ||||
31 | |||||
32 | 1. as name-value pairs of strings, presented in mail header format. For | ||||
33 | example, "X-Language" => "en". This is the general form for simple | ||||
34 | metadata that's useful as Bayes tokens, can be added to marked-up | ||||
35 | messages using "add_header", etc., such as the trusted-relay inference | ||||
36 | and language detection. | ||||
37 | |||||
38 | 2. as more complex data structures on the $msg->{metadata} object. This | ||||
39 | is the form used for metadata like the HTML parse data, which is stored | ||||
40 | there for access by eval rule code. Because it's not simple strings, | ||||
41 | it's not added as a Bayes token by default (Bayes needs simple strings). | ||||
42 | |||||
43 | =head1 PUBLIC METHODS | ||||
44 | |||||
45 | =over 4 | ||||
46 | |||||
47 | =cut | ||||
48 | |||||
49 | package Mail::SpamAssassin::Message::Metadata; | ||||
50 | |||||
51 | 2 | 70µs | 2 | 69µs | # spent 59µs (49+10) within Mail::SpamAssassin::Message::Metadata::BEGIN@51 which was called:
# once (49µs+10µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 51 # spent 59µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@51
# spent 10µs making 1 call to strict::import |
52 | 2 | 60µs | 2 | 89µs | # spent 56µs (23+33) within Mail::SpamAssassin::Message::Metadata::BEGIN@52 which was called:
# once (23µs+33µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 52 # spent 56µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@52
# spent 33µs making 1 call to warnings::import |
53 | 2 | 77µs | 2 | 39µs | # spent 32µs (25+7) within Mail::SpamAssassin::Message::Metadata::BEGIN@53 which was called:
# once (25µs+7µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 53 # spent 32µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@53
# spent 7µs making 1 call to bytes::import |
54 | 2 | 77µs | 2 | 165µs | # spent 96µs (27+69) within Mail::SpamAssassin::Message::Metadata::BEGIN@54 which was called:
# once (27µs+69µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 54 # spent 96µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@54
# spent 69µs making 1 call to re::import |
55 | |||||
56 | 2 | 68µs | 1 | 29µs | # spent 29µs within Mail::SpamAssassin::Message::Metadata::BEGIN@56 which was called:
# once (29µs+0s) by Mail::SpamAssassin::Message::BEGIN@56 at line 56 # spent 29µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@56 |
57 | 2 | 79µs | 2 | 1.58ms | # spent 798µs (22+777) within Mail::SpamAssassin::Message::Metadata::BEGIN@57 which was called:
# once (22µs+777µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 57 # spent 798µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@57
# spent 777µs making 1 call to Exporter::import |
58 | 2 | 72µs | 2 | 305µs | # spent 164µs (23+141) within Mail::SpamAssassin::Message::Metadata::BEGIN@58 which was called:
# once (23µs+141µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 58 # spent 164µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@58
# spent 141µs making 1 call to Exporter::import |
59 | 2 | 404µs | 1 | 215ms | # spent 215ms (13.9+202) within Mail::SpamAssassin::Message::Metadata::BEGIN@59 which was called:
# once (13.9ms+202ms) by Mail::SpamAssassin::Message::BEGIN@56 at line 59 # spent 215ms making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@59 |
60 | 2 | 603µs | 2 | 436µs | # spent 235µs (35+200) within Mail::SpamAssassin::Message::Metadata::BEGIN@60 which was called:
# once (35µs+200µs) by Mail::SpamAssassin::Message::BEGIN@56 at line 60 # spent 235µs making 1 call to Mail::SpamAssassin::Message::Metadata::BEGIN@60
# spent 200µs making 1 call to Exporter::import |
61 | |||||
62 | =item new() | ||||
63 | |||||
64 | =back | ||||
65 | |||||
66 | =cut | ||||
67 | |||||
68 | # spent 4.53ms within Mail::SpamAssassin::Message::Metadata::new which was called 235 times, avg 19µs/call:
# 235 times (4.53ms+0s) by Mail::SpamAssassin::Message::new at line 147 of Mail/SpamAssassin/Message.pm, avg 19µs/call | ||||
69 | 235 | 567µs | my ($class, $msg) = @_; | ||
70 | 235 | 567µs | $class = ref($class) || $class; | ||
71 | |||||
72 | 235 | 1.32ms | my $self = { | ||
73 | msg => $msg, | ||||
74 | strings => { } | ||||
75 | }; | ||||
76 | |||||
77 | 235 | 539µs | bless($self,$class); | ||
78 | 235 | 8.63ms | $self; | ||
79 | } | ||||
80 | |||||
81 | # spent 3.74s (77.2ms+3.66) within Mail::SpamAssassin::Message::Metadata::extract which was called 235 times, avg 15.9ms/call:
# 235 times (77.2ms+3.66s) by Mail::SpamAssassin::Message::extract_message_metadata at line 527 of Mail/SpamAssassin/Message.pm, avg 15.9ms/call | ||||
82 | 235 | 527µs | my ($self, $msg, $permsgstatus) = @_; | ||
83 | |||||
84 | # pre-chew Received headers | ||||
85 | 235 | 2.26ms | 235 | 3.49s | $self->parse_received_headers ($permsgstatus, $msg); # spent 3.49s making 235 calls to Mail::SpamAssassin::Message::Metadata::parse_received_headers, avg 14.9ms/call |
86 | |||||
87 | 235 | 4.49ms | foreach my $tuple ( | ||
88 | [$self->{relays_trusted}, 'RELAYSTRUSTEDREVIP' ], | ||||
89 | [$self->{relays_untrusted}, 'RELAYSUNTRUSTEDREVIP'], | ||||
90 | [$self->{relays_internal}, 'RELAYSINTERNALREVIP' ], | ||||
91 | [$self->{relays_external}, 'RELAYSEXTERNALREVIP' ]) | ||||
92 | 940 | 2.21ms | { my($rly, $tag) = @$tuple; | ||
93 | 940 | 1.67ms | my @revips; | ||
94 | @revips = map { | ||||
95 | 3030 | 13.5ms | my($ip,$revip); | ||
96 | 2090 | 10.6ms | $ip = $_->{ip} if ref $_ && !$_->{ip_private}; | ||
97 | 2090 | 10.3ms | 718 | 40.8ms | $revip = reverse_ip_address($ip) if defined $ip && $ip ne ''; # spent 40.8ms making 718 calls to Mail::SpamAssassin::Util::reverse_ip_address, avg 57µs/call |
98 | 2090 | 6.50ms | defined $revip && $revip ne '' ? $revip : (); | ||
99 | } @$rly if $rly; | ||||
100 | 940 | 9.85ms | 468 | 35.4ms | $permsgstatus->set_tag($tag, # spent 35.4ms making 468 calls to Mail::SpamAssassin::PerMsgStatus::set_tag, avg 76µs/call |
101 | @revips == 1 ? $revips[0] : \@revips) if @revips; | ||||
102 | } | ||||
103 | |||||
104 | $permsgstatus->{main}->call_plugins("extract_metadata", | ||||
105 | { msg => $msg, permsgstatus => $permsgstatus, | ||||
106 | 235 | 5.48ms | 235 | 0s | conf => $permsgstatus->{main}->{conf} }); # spent 92.4ms making 235 calls to Mail::SpamAssassin::call_plugins, avg 393µs/call, recursion: max depth 1, sum of overlapping time 92.4ms |
107 | } | ||||
108 | |||||
109 | # spent 11.0ms within Mail::SpamAssassin::Message::Metadata::finish which was called 235 times, avg 47µs/call:
# 235 times (11.0ms+0s) by Mail::SpamAssassin::Message::finish_metadata at line 605 of Mail/SpamAssassin/Message.pm, avg 47µs/call | ||||
110 | 235 | 517µs | my ($self) = @_; | ||
111 | 470 | 11.0ms | %{$self} = (); | ||
112 | } | ||||
113 | |||||
114 | 1 | 8µs | 1; |