← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Sun Nov 5 03:09:29 2017
Reported on Mon Nov 6 13:20:45 2017

Filename/usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Logger/Stderr.pm
StatementsExecuted 24 statements in 1.98ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118.10ms13.4msMail::SpamAssassin::Logger::Stderr::::BEGIN@37Mail::SpamAssassin::Logger::Stderr::BEGIN@37
1114.71ms5.65msMail::SpamAssassin::Logger::Stderr::::BEGIN@38Mail::SpamAssassin::Logger::Stderr::BEGIN@38
11140µs48µsMail::SpamAssassin::Logger::Stderr::::BEGIN@32Mail::SpamAssassin::Logger::Stderr::BEGIN@32
11128µs28µsMail::SpamAssassin::Logger::Stderr::::newMail::SpamAssassin::Logger::Stderr::new
11123µs99µsMail::SpamAssassin::Logger::Stderr::::BEGIN@40Mail::SpamAssassin::Logger::Stderr::BEGIN@40
11119µs42µsMail::SpamAssassin::Logger::Stderr::::BEGIN@33Mail::SpamAssassin::Logger::Stderr::BEGIN@33
11118µs23µsMail::SpamAssassin::Logger::Stderr::::BEGIN@34Mail::SpamAssassin::Logger::Stderr::BEGIN@34
11117µs64µsMail::SpamAssassin::Logger::Stderr::::BEGIN@35Mail::SpamAssassin::Logger::Stderr::BEGIN@35
1118µs8µsMail::SpamAssassin::Logger::Stderr::::close_logMail::SpamAssassin::Logger::Stderr::close_log
0000s0sMail::SpamAssassin::Logger::Stderr::::log_messageMail::SpamAssassin::Logger::Stderr::log_message
Call graph for these subroutines as a Graphviz dot language file.
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
20Mail::SpamAssassin::Logger::Stderr - log to standard error
21
22=head1 SYNOPSIS
23
24 loadplugin Mail::SpamAssassin::Logger::Stderr
25
26=head1 DESCRIPTION
27
28=cut
29
30package Mail::SpamAssassin::Logger::Stderr;
31
32254µs256µs
# spent 48µs (40+8) within Mail::SpamAssassin::Logger::Stderr::BEGIN@32 which was called: # once (40µs+8µs) by Mail::SpamAssassin::Logger::BEGIN@72 at line 32
use strict;
# spent 48µs making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@32 # spent 8µs making 1 call to strict::import
33249µs266µs
# spent 42µs (19+24) within Mail::SpamAssassin::Logger::Stderr::BEGIN@33 which was called: # once (19µs+24µs) by Mail::SpamAssassin::Logger::BEGIN@72 at line 33
use warnings;
# spent 42µs making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@33 # spent 24µs making 1 call to warnings::import
34252µs228µs
# spent 23µs (18+5) within Mail::SpamAssassin::Logger::Stderr::BEGIN@34 which was called: # once (18µs+5µs) by Mail::SpamAssassin::Logger::BEGIN@72 at line 34
use bytes;
# spent 23µs making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@34 # spent 5µs making 1 call to bytes::import
35248µs2111µs
# spent 64µs (17+47) within Mail::SpamAssassin::Logger::Stderr::BEGIN@35 which was called: # once (17µs+47µs) by Mail::SpamAssassin::Logger::BEGIN@72 at line 35
use re 'taint';
# spent 64µs making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@35 # spent 47µs making 1 call to re::import
36
372776µs113.4ms
# spent 13.4ms (8.10+5.34) within Mail::SpamAssassin::Logger::Stderr::BEGIN@37 which was called: # once (8.10ms+5.34ms) by Mail::SpamAssassin::Logger::BEGIN@72 at line 37
use POSIX ();
# spent 13.4ms making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@37
382379µs15.65ms
# spent 5.65ms (4.71+936µs) within Mail::SpamAssassin::Logger::Stderr::BEGIN@38 which was called: # once (4.71ms+936µs) by Mail::SpamAssassin::Logger::BEGIN@72 at line 38
use Time::HiRes ();
# spent 5.65ms making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@38
39
402550µs2176µs
# spent 99µs (23+76) within Mail::SpamAssassin::Logger::Stderr::BEGIN@40 which was called: # once (23µs+76µs) by Mail::SpamAssassin::Logger::BEGIN@72 at line 40
use vars qw(@ISA);
# spent 99µs making 1 call to Mail::SpamAssassin::Logger::Stderr::BEGIN@40 # spent 76µs making 1 call to vars::import
41113µs@ISA = ();
42
43
# spent 28µs within Mail::SpamAssassin::Logger::Stderr::new which was called: # once (28µs+0s) by Mail::SpamAssassin::BEGIN@69 at line 73 of Mail/SpamAssassin/Logger.pm
sub new {
4412µs my $class = shift;
45
4612µs $class = ref($class) || $class;
4712µs my $self = { };
4812µs bless ($self, $class);
49
5012µs my %params = @_;
51110µs $self->{timestamp_fmt} = $params{timestamp_fmt};
52
53114µs return($self);
54}
55
56sub log_message {
57 my ($self, $level, $msg) = @_;
58
59 my $timestamp;
60 my $fmt = $self->{timestamp_fmt};
61 if (!defined $fmt) {
62 # default since 3.3.0
63 my $now = Time::HiRes::time;
64 $timestamp = sprintf("%s:%06.3f",
65 POSIX::strftime("%b %d %H:%M", localtime($now)), $now-int($now/60)*60);
66 # Bug 6329: %e is not in a POSIX standard, use %d instead and edit
67 local $1; $timestamp =~ s/^(\S+\s+)0/$1 /;
68 } elsif ($fmt eq '') {
69 $timestamp = '';
70 } else {
71 $timestamp = POSIX::strftime($fmt, localtime(Time::HiRes::time));
72 }
73 $timestamp .= ' ' if $timestamp ne '';
74
75 my($nwrite) = syswrite(STDERR, sprintf("%s[%d] %s: %s\n",
76 $timestamp, $$, $level, $msg));
77 defined $nwrite or warn "error writing to log file: $!";
78}
79
80
# spent 8µs within Mail::SpamAssassin::Logger::Stderr::close_log which was called: # once (8µs+0s) by Mail::SpamAssassin::Logger::close_log at line 360 of Mail/SpamAssassin/Logger.pm
sub close_log {
81112µs my ($self) = @_;
82}
83
8418µs1;