← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:10:23 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/x86_64-linux/Scalar/Util.pm
StatementsExecuted 14 statements in 1.81ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
250685931149ms149msScalar::Util::::blessedScalar::Util::blessed (xsub)
102159556.1ms56.1msScalar::Util::::reftypeScalar::Util::reftype (xsub)
4330141235.1ms35.1msScalar::Util::::weakenScalar::Util::weaken (xsub)
513113.08ms3.08msScalar::Util::::isweakScalar::Util::isweak (xsub)
18422895µs895µsScalar::Util::::refaddrScalar::Util::refaddr (xsub)
11177µs94µsScalar::Util::::BEGIN@9Scalar::Util::BEGIN@9
11137µs340µsScalar::Util::::BEGIN@10Scalar::Util::BEGIN@10
41132µs32µsScalar::Util::::set_prototypeScalar::Util::set_prototype (xsub)
0000s0sScalar::Util::::export_failScalar::Util::export_fail
0000s0sScalar::Util::::openhandleScalar::Util::openhandle
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# Scalar::Util.pm
2#
3# Copyright (c) 1997-2007 Graham Barr <gbarr@pobox.com>. All rights reserved.
4# This program is free software; you can redistribute it and/or
5# modify it under the same terms as Perl itself.
6
7package Scalar::Util;
8
93123µs2112µs
# spent 94µs (77+17) within Scalar::Util::BEGIN@9 which was called: # once (77µs+17µs) by Class::MOP::BEGIN@12 at line 9
use strict;
# spent 94µs making 1 call to Scalar::Util::BEGIN@9 # spent 17µs making 1 call to strict::import
1031.25ms2643µs
# spent 340µs (37+303) within Scalar::Util::BEGIN@10 which was called: # once (37µs+303µs) by Class::MOP::BEGIN@12 at line 10
use vars qw(@ISA @EXPORT_OK $VERSION @EXPORT_FAIL);
# spent 340µs making 1 call to Scalar::Util::BEGIN@10 # spent 303µs making 1 call to vars::import
1114µsrequire Exporter;
121288µsrequire List::Util; # List::Util loads the XS
13
14130µs@ISA = qw(Exporter);
15112µs@EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype);
1613µs$VERSION = "1.21";
17168µs$VERSION = eval $VERSION;
# spent 10µs executing statements in string eval
18
1913µsunless (defined &dualvar) {
20 # Load Pure Perl version if XS not loaded
21 require Scalar::Util::PP;
22 Scalar::Util::PP->import;
23 push @EXPORT_FAIL, qw(weaken isweak dualvar isvstring set_prototype);
24}
25
26sub export_fail {
27 if (grep { /dualvar/ } @EXPORT_FAIL) { # no XS loaded
28 my $pat = join("|", @EXPORT_FAIL);
29 if (my ($err) = grep { /^($pat)$/ } @_ ) {
30 require Carp;
31 Carp::croak("$err is only available with the XS version of Scalar::Util");
32 }
33 }
34
35 if (grep { /^(weaken|isweak)$/ } @_ ) {
36 require Carp;
37 Carp::croak("Weak references are not implemented in the version of perl");
38 }
39
40 if (grep { /^(isvstring)$/ } @_ ) {
41 require Carp;
42 Carp::croak("Vstrings are not implemented in the version of perl");
43 }
44
45 @_;
46}
47
48sub openhandle ($) {
49 my $fh = shift;
50 my $rt = reftype($fh) || '';
51
52 return defined(fileno($fh)) ? $fh : undef
53 if $rt eq 'IO';
54
55 if (reftype(\$fh) eq 'GLOB') { # handle openhandle(*DATA)
56 $fh = \(my $tmp=$fh);
57 }
58 elsif ($rt ne 'GLOB') {
59 return undef;
60 }
61
62 (tied(*$fh) or defined(fileno($fh)))
63 ? $fh : undef;
64}
65
66127µs1;
67
68__END__
 
# spent 149ms within Scalar::Util::blessed which was called 25068 times, avg 6µs/call: # 8631 times (52.9ms+0s) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 150 of Class/MOP/Mixin/HasMethods.pm, avg 6µs/call # 2943 times (16.4ms+0s) by Class::MOP::Mixin::HasMethods::get_method at line 124 of Class/MOP/Mixin/HasMethods.pm, avg 6µs/call # 2900 times (17.5ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 65 of Class/MOP/Mixin/HasMethods.pm, avg 6µs/call # 2206 times (12.9ms+0s) by Class::MOP::Method::clone at line 133 of Class/MOP/Method.pm, avg 6µs/call # 1578 times (8.29ms+0s) by Class::MOP::class_of at line 61 of Class/MOP.pm, avg 5µs/call # 1119 times (5.99ms+0s) by Moose::Util::TypeConstraints::find_type_constraint at line 256 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 936 times (5.11ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call # 757 times (4.30ms+0s) by Class::MOP::Class::__ANON__::SERIAL::11::meta or Class::MOP::Class::__ANON__::SERIAL::15::meta or Class::MOP::Class::__ANON__::SERIAL::19::meta or Class::MOP::Class::__ANON__::SERIAL::1::meta or Class::MOP::Class::__ANON__::SERIAL::5::meta or Class::MOP::Class::__ANON__::SERIAL::8::meta or Class::MOP::Mixin::meta or Class::MOP::Object::meta or Markdent::Dialect::Standard::BlockParser::meta or Markdent::Dialect::Standard::SpanParser::meta or Markdent::Event::AutoLink::meta or Markdent::Event::EndBlockquote::meta or Markdent::Event::EndCode::meta or Markdent::Event::EndDocument::meta or Markdent::Event::EndEmphasis::meta or Markdent::Event::EndHTMLTag::meta or Markdent::Event::EndHeader::meta or Markdent::Event::EndLink::meta or Markdent::Event::EndListItem::meta or Markdent::Event::EndOrderedList::meta or Markdent::Event::EndParagraph::meta or Markdent::Event::EndStrong::meta or Markdent::Event::EndUnorderedList::meta or Markdent::Event::HTMLBlock::meta or Markdent::Event::HTMLComment::meta or Markdent::Event::HTMLCommentBlock::meta or Markdent::Event::HTMLEntity::meta or Markdent::Event::HTMLTag::meta or Markdent::Event::HorizontalRule::meta or Markdent::Event::Image::meta or Markdent::Event::Preformatted::meta or Markdent::Event::StartBlockquote::meta or Markdent::Event::StartCode::meta or Markdent::Event::StartDocument::meta or Markdent::Event::StartEmphasis::meta or Markdent::Event::StartHTMLTag::meta or Markdent::Event::StartHeader::meta or Markdent::Event::StartLink::meta or Markdent::Event::StartListItem::meta or Markdent::Event::StartOrderedList::meta or Markdent::Event::StartParagraph::meta or Markdent::Event::StartStrong::meta or Markdent::Event::StartUnorderedList::meta or Markdent::Event::Text::meta or Markdent::Handler::HTMLStream::Document::meta or Markdent::Parser::meta or Moose::Meta::Role::Application::RoleSummation::meta or Moose::Meta::Role::Application::ToClass::meta or Moose::Meta::Role::Application::ToInstance::meta or Moose::Meta::Role::Application::ToRole::meta or Moose::Meta::Role::Application::meta or Moose::Meta::Role::Composite::meta or Moose::Meta::Role::Method::Required::meta or Moose::Meta::Role::meta or Moose::Meta::TypeCoercion::Union::meta or Moose::Meta::TypeCoercion::meta or Moose::Meta::TypeConstraint::Class::meta or Moose::Meta::TypeConstraint::DuckType::meta or Moose::Meta::TypeConstraint::Enum::meta or Moose::Meta::TypeConstraint::Parameterizable::meta or Moose::Meta::TypeConstraint::Parameterized::meta or Moose::Meta::TypeConstraint::Registry::meta or Moose::Meta::TypeConstraint::Role::meta or Moose::Meta::TypeConstraint::Union::meta or Moose::Meta::TypeConstraint::meta or MooseX::Role::Parameterized::Meta::Parameter::meta or MooseX::Role::Parameterized::Meta::Role::Parameterizable::meta or MooseX::Role::Parameterized::Meta::Role::Parameterized::meta or MooseX::Role::Parameterized::Parameters::meta at line 44 of Class/MOP/Method/Meta.pm, avg 6µs/call # 440 times (3.48ms+0s) by Class::MOP::Class::_construct_instance at line 588 of Class/MOP/Class.pm, avg 8µs/call # 323 times (1.97ms+0s) by MooseX::Types::TypeDecorator::__type_constraint at line 103 of MooseX/Types/TypeDecorator.pm, avg 6µs/call # 270 times (1.94ms+0s) by Class::MOP::Method::Accessor::new at line 26 of Class/MOP/Method/Accessor.pm, avg 7µs/call # 211 times (1.27ms+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21 of Class/MOP/Mixin/HasAttributes.pm, avg 6µs/call # 187 times (1.02ms+0s) by Class::MOP::Attribute::attach_to_class at line 232 of Class/MOP/Attribute.pm, avg 5µs/call # 184 times (1.16ms+0s) by Moose::Meta::Role::apply at line 436 of Moose/Meta/Role.pm, avg 6µs/call # 178 times (1.06ms+0s) by Moose::Meta::Role::Composite::add_method at line 81 of Moose/Meta/Role/Composite.pm, avg 6µs/call # 172 times (1.19ms+0s) by Moose::Meta::TypeConstraint::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint/Class.pm:38] at line 37 of Moose/Meta/TypeConstraint/Class.pm, avg 7µs/call # 159 times (1.16ms+0s) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 47 of Moose/Meta/TypeConstraint/Registry.pm, avg 7µs/call # 153 times (885µs+0s) by Moose::Util::_apply_all_roles at line 109 of Moose/Util.pm, avg 6µs/call # 142 times (921µs+0s) by Moose::Util::_apply_all_roles at line 133 of Moose/Util.pm, avg 6µs/call # 137 times (824µs+0s) by Class::MOP::Instance::BUILDARGS at line 21 of Class/MOP/Instance.pm, avg 6µs/call # 111 times (767µs+0s) by Moose::Meta::Role::add_role at line 397 of Moose/Meta/Role.pm, avg 7µs/call # 110 times (619µs+0s) by Class::MOP::Method::Wrapped::wrap at line 74 of Class/MOP/Method/Wrapped.pm, avg 6µs/call # 83 times (451µs+0s) by MooseX::Types::TypeDecorator::isa at line 121 of MooseX/Types/TypeDecorator.pm, avg 5µs/call # 77 times (473µs+0s) by MooseX::Types::TypeDecorator::new at line 77 of MooseX/Types/TypeDecorator.pm, avg 6µs/call # 73 times (527µs+0s) by Moose::Meta::Class::add_role at line 179 of Moose/Meta/Class.pm, avg 7µs/call # 73 times (393µs+0s) by Moose::Meta::Class::add_role_application at line 192 of Moose/Meta/Class.pm, avg 5µs/call # 72 times (427µs+0s) by Moose::Meta::Class::add_attribute at line 300 of Moose/Meta/Class.pm, avg 6µs/call # 62 times (468µs+0s) by Moose::Meta::Attribute::_process_isa_option at line 320 of Moose/Meta/Attribute.pm, avg 8µs/call # 48 times (281µs+0s) by Moose::Meta::Role::add_attribute at line 232 of Moose/Meta/Role.pm, avg 6µs/call # 43 times (206µs+0s) by Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role at line 38 of Moose/Meta/Role/Application/RoleSummation.pm, avg 5µs/call # 42 times (301µs+0s) by Class::MOP::Class::reinitialize at line 53 of Class/MOP/Class.pm, avg 7µs/call # 42 times (297µs+0s) by Moose::Meta::Method::Destructor::is_needed at line 58 of Moose/Meta/Method/Destructor.pm, avg 7µs/call # 42 times (291µs+0s) by Moose::Meta::Class::reinitialize at line 135 of Moose/Meta/Class.pm, avg 7µs/call # 42 times (288µs+0s) by Class::MOP::Package::reinitialize at line 51 of Class/MOP/Package.pm, avg 7µs/call # 42 times (242µs+0s) by Moose::Util::MetaRole::_make_new_metaclass at line 108 of Moose/Util/MetaRole.pm, avg 6µs/call # 42 times (239µs+0s) by Class::MOP::Object::_real_ref_name at line 43 of Class/MOP/Object.pm, avg 6µs/call # 42 times (238µs+0s) by Class::MOP::Class::reinitialize at line 56 of Class/MOP/Class.pm, avg 6µs/call # 42 times (232µs+0s) by Class::MOP::Package::reinitialize at line 55 of Class/MOP/Package.pm, avg 6µs/call # 42 times (215µs+0s) by Moose::Util::MetaRole::apply_metaroles at line 30 of Moose/Util/MetaRole.pm, avg 5µs/call # 42 times (205µs+0s) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::generate_role at line 77 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 5µs/call # 38 times (202µs+0s) by MooseX::Types::TypeDecorator::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm:26] at line 21 of MooseX/Types/TypeDecorator.pm, avg 5µs/call # 33 times (170µs+0s) by Class::MOP::Object::meta at line 18 of Class/MOP/Object.pm, avg 5µs/call # 31 times (200µs+0s) by Class::MOP::Method::Constructor::new at line 20 of Class/MOP/Method/Constructor.pm, avg 6µs/call # 25 times (142µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 6µs/call # 24 times (128µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 55 of Moose/Meta/Role/Attribute.pm, avg 5µs/call # 23 times (123µs+0s) by Moose::Meta::Role::add_required_methods at line 254 of Moose/Meta/Role.pm, avg 5µs/call # 20 times (114µs+0s) by Moose::Meta::Role::combine at line 496 of Moose/Meta/Role.pm, avg 6µs/call # 20 times (103µs+0s) by Moose::Meta::Role::Application::RoleSummation::get_exclusions_for_role at line 24 of Moose/Meta/Role/Application/RoleSummation.pm, avg 5µs/call # 18 times (96µs+0s) by Class::MOP::Mixin::meta at line 14 of Class/MOP/Mixin.pm, avg 5µs/call # 9 times (59µs+0s) by Moose::Meta::Attribute::_process_does_option at line 337 of Moose/Meta/Attribute.pm, avg 7µs/call # 8 times (45µs+0s) by Moose::Util::TypeConstraints::subtype at line 345 of Moose/Util/TypeConstraints.pm, avg 6µs/call # 6 times (41µs+0s) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 46 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 7µs/call # 6 times (30µs+0s) by Moose::Meta::Role::does_role at line 417 of Moose/Meta/Role.pm, avg 5µs/call # 4 times (23µs+0s) by MooseX::Types::TypeDecorator::can at line 141 of MooseX/Types/TypeDecorator.pm, avg 6µs/call # once (7µs+0s) by Class::MOP::Class::_clone_instance at line 677 of Class/MOP/Class.pm # once (6µs+0s) by Moose::Meta::Method::Delegation::new at line 25 of Moose/Meta/Method/Delegation.pm # once (6µs+0s) by Class::MOP::Class::clone_object at line 664 of Class/MOP/Class.pm # once (6µs+0s) by MooseX::Role::Parameterized::Meta::Parameter::_new at line 2 of generated method (unknown origin) # once (5µs+0s) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 129 of Moose/Meta/Method/Delegation.pm
sub Scalar::Util::blessed; # xsub
# spent 3.08ms within Scalar::Util::isweak which was called 513 times, avg 6µs/call: # 513 times (3.08ms+0s) by Class::MOP::metaclass_is_weak at line 54 of Class/MOP.pm, avg 6µs/call
sub Scalar::Util::isweak; # xsub
# spent 895µs within Scalar::Util::refaddr which was called 184 times, avg 5µs/call: # 106 times (498µs+0s) by Moose::Meta::TypeConstraint::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint.pm:8] at line 8 of Moose/Meta/TypeConstraint.pm, avg 5µs/call # 78 times (397µs+0s) by Class::MOP::Method::Inlined::can_be_inlined at line 74 of Class/MOP/Method/Inlined.pm, avg 5µs/call
sub Scalar::Util::refaddr; # xsub
# spent 56.1ms within Scalar::Util::reftype which was called 10215 times, avg 5µs/call: # 3484 times (19.6ms+0s) by Package::Stash::has_package_symbol at line 134 of Package/Stash.pm, avg 6µs/call # 2921 times (16.7ms+0s) by Package::Stash::_valid_for_type at line 69 of Package/Stash.pm, avg 6µs/call # 2016 times (10.6ms+0s) by Sub::Install::_CODELIKE at line 98 of Sub/Install.pm, avg 5µs/call # 936 times (4.84ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call # 825 times (4.21ms+0s) by Package::Stash::_valid_for_type at line 74 of Package/Stash.pm, avg 5µs/call # 24 times (142µs+0s) by List::MoreUtils::all at line 315 of Moose/Util/TypeConstraints.pm, avg 6µs/call # 6 times (41µs+0s) by __TYPE__::ArrayRef or __TYPE__::HashRef at line 392 of MooseX/Types.pm, avg 7µs/call # 2 times (12µs+0s) by List::MoreUtils::any at line 278 of Moose/Util/TypeConstraints.pm, avg 6µs/call # once (6µs+0s) by Moose::Util::TypeConstraints::subtype at line 303 of Moose/Util/TypeConstraints.pm
sub Scalar::Util::reftype; # xsub
# spent 32µs within Scalar::Util::set_prototype which was called 4 times, avg 8µs/call: # 4 times (32µs+0s) by Moose::Exporter::_curry_wrapper at line 339 of Moose/Exporter.pm, avg 8µs/call
sub Scalar::Util::set_prototype; # xsub
# spent 35.1ms within Scalar::Util::weaken which was called 4330 times, avg 8µs/call: # 2877 times (23.3ms+0s) by Class::MOP::Method::attach_to_class at line 75 of Class/MOP/Method.pm, avg 8µs/call # 512 times (4.44ms+0s) by Class::MOP::Method::wrap at line 46 of Class/MOP/Method.pm, avg 9µs/call # 270 times (2.42ms+0s) by Class::MOP::Method::Accessor::new at line 37 of Class/MOP/Method/Accessor.pm, avg 9µs/call # 187 times (1.37ms+0s) by Class::MOP::Attribute::attach_to_class at line 234 of Class/MOP/Attribute.pm, avg 7µs/call # 137 times (1.04ms+0s) by Class::MOP::Instance::new at line 45 of Class/MOP/Instance.pm, avg 8µs/call # 73 times (512µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 28 of Moose/Meta/Role/Application/ToClass.pm, avg 7µs/call # 73 times (416µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 29 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call # 44 times (450µs+0s) by Class::MOP::weaken_metaclass at line 53 of Class/MOP.pm, avg 10µs/call # 42 times (327µs+0s) by Moose::Meta::Method::Constructor::new at line 40 of Moose/Meta/Method/Constructor.pm, avg 8µs/call # 39 times (285µs+0s) by Moose::Meta::Method::Destructor::new at line 41 of Moose/Meta/Method/Destructor.pm, avg 7µs/call # 31 times (233µs+0s) by Class::MOP::Method::Constructor::new at line 32 of Class/MOP/Method/Constructor.pm, avg 8µs/call # 24 times (146µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 59 of Moose/Meta/Role/Attribute.pm, avg 6µs/call # 20 times (166µs+0s) by Moose::Meta::Class::create_anon_class at line 115 of Moose/Meta/Class.pm, avg 8µs/call # once (7µs+0s) by Moose::Meta::Method::Delegation::new at line 48 of Moose/Meta/Method/Delegation.pm
sub Scalar::Util::weaken; # xsub