← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:49 2015

Filename/usr/lib/x86_64-linux-gnu/perl5/5.20/XML/LibXML/Number.pm
StatementsExecuted 14 statements in 1.08ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.50ms1.60msXML::LibXML::Number::::BEGIN@12XML::LibXML::Number::BEGIN@12
11112µs12µsXML::LibXML::Number::::BEGIN@11XML::LibXML::Number::BEGIN@11
1118µs30µsXML::LibXML::Number::::BEGIN@20XML::LibXML::Number::BEGIN@20
1116µs10µsXML::LibXML::Number::::BEGIN@14XML::LibXML::Number::BEGIN@14
1116µs16µsXML::LibXML::Number::::BEGIN@13XML::LibXML::Number::BEGIN@13
1116µs22µsXML::LibXML::Number::::BEGIN@16XML::LibXML::Number::BEGIN@16
0000s0sXML::LibXML::Number::::as_stringXML::LibXML::Number::as_string
0000s0sXML::LibXML::Number::::as_xmlXML::LibXML::Number::as_xml
0000s0sXML::LibXML::Number::::cmpXML::LibXML::Number::cmp
0000s0sXML::LibXML::Number::::evaluateXML::LibXML::Number::evaluate
0000s0sXML::LibXML::Number::::newXML::LibXML::Number::new
0000s0sXML::LibXML::Number::::string_valueXML::LibXML::Number::string_value
0000s0sXML::LibXML::Number::::to_booleanXML::LibXML::Number::to_boolean
0000s0sXML::LibXML::Number::::to_literalXML::LibXML::Number::to_literal
0000s0sXML::LibXML::Number::::to_numberXML::LibXML::Number::to_number
0000s0sXML::LibXML::Number::::valueXML::LibXML::Number::value
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# $Id$
2#
3# This is free software, you may use it and distribute it under the same terms as
4# Perl itself.
5#
6# Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas
7#
8#
9
10package XML::LibXML::Number;
11230µs112µs
# spent 12µs within XML::LibXML::Number::BEGIN@11 which was called: # once (12µs+0s) by XML::LibXML::Boolean::BEGIN@12 at line 11
use XML::LibXML::Boolean;
# spent 12µs making 1 call to XML::LibXML::Number::BEGIN@11
122699µs11.60ms
# spent 1.60ms (1.50+100µs) within XML::LibXML::Number::BEGIN@12 which was called: # once (1.50ms+100µs) by XML::LibXML::Boolean::BEGIN@12 at line 12
use XML::LibXML::Literal;
# spent 1.60ms making 1 call to XML::LibXML::Number::BEGIN@12
13219µs225µs
# spent 16µs (6+10) within XML::LibXML::Number::BEGIN@13 which was called: # once (6µs+10µs) by XML::LibXML::Boolean::BEGIN@12 at line 13
use strict;
# spent 16µs making 1 call to XML::LibXML::Number::BEGIN@13 # spent 10µs making 1 call to strict::import
14222µs214µs
# spent 10µs (6+4) within XML::LibXML::Number::BEGIN@14 which was called: # once (6µs+4µs) by XML::LibXML::Boolean::BEGIN@12 at line 14
use warnings;
# spent 10µs making 1 call to XML::LibXML::Number::BEGIN@14 # spent 4µs making 1 call to warnings::import
15
16242µs239µs
# spent 22µs (6+16) within XML::LibXML::Number::BEGIN@16 which was called: # once (6µs+16µs) by XML::LibXML::Boolean::BEGIN@12 at line 16
use vars qw ($VERSION);
# spent 22µs making 1 call to XML::LibXML::Number::BEGIN@16 # spent 16µs making 1 call to vars::import
171400ns$VERSION = "2.0116"; # VERSION TEMPLATE: DO NOT CHANGE
18
19use overload
2015µs121µs
# spent 30µs (8+21) within XML::LibXML::Number::BEGIN@20 which was called: # once (8µs+21µs) by XML::LibXML::Boolean::BEGIN@12 at line 22
'""' => \&value,
# spent 21µs making 1 call to overload::import
21 '0+' => \&value,
221262µs130µs '<=>' => \&cmp;
# spent 30µs making 1 call to XML::LibXML::Number::BEGIN@20
23
24sub new {
25 my $class = shift;
26 my $number = shift;
27 if ($number !~ /^\s*(-\s*)?(\d+(\.\d*)?|\.\d+)\s*$/) {
28 $number = undef;
29 }
30 else {
31 $number =~ s/\s+//g;
32 }
33 bless \$number, $class;
34}
35
36sub as_string {
37 my $self = shift;
38 defined $$self ? $$self : 'NaN';
39}
40
41sub as_xml {
42 my $self = shift;
43 return "<Number>" . (defined($$self) ? $$self : 'NaN') . "</Number>\n";
44}
45
46sub value {
47 my $self = shift;
48 $$self;
49}
50
51sub cmp {
52 my $self = shift;
53 my ($other, $swap) = @_;
54 if ($swap) {
55 return $other <=> $$self;
56 }
57 return $$self <=> $other;
58}
59
60sub evaluate {
61 my $self = shift;
62 $self;
63}
64
65sub to_boolean {
66 my $self = shift;
67 return $$self ? XML::LibXML::Boolean->True : XML::LibXML::Boolean->False;
68}
69
70sub to_literal { XML::LibXML::Literal->new($_[0]->as_string); }
71sub to_number { $_[0]; }
72
73sub string_value { return $_[0]->value }
74
7512µs1;
76__END__