| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Enbugger::NYTProf; |
|
2
|
|
|
|
|
|
|
$Enbugger::NYTProf::VERSION = '2.016'; |
|
3
|
|
|
|
|
|
|
# COPYRIGHT AND LICENCE |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Copyright (C) 2007,2009 WhitePages.com, Inc. with primary |
|
6
|
|
|
|
|
|
|
# development by Joshua ben Jore. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# This program is distributed WITHOUT ANY WARRANTY, including but not |
|
9
|
|
|
|
|
|
|
# limited to the implied warranties of merchantability or fitness for |
|
10
|
|
|
|
|
|
|
# a particular purpose. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# The program is free software. You may distribute it and/or modify |
|
13
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
|
14
|
|
|
|
|
|
|
# the Free Software Foundation (either version 2 or any later version) |
|
15
|
|
|
|
|
|
|
# and the Perl Artistic License as published by O’Reilly Media, Inc. |
|
16
|
|
|
|
|
|
|
# Please open the files named gpl-2.0.txt and Artistic for a copy of |
|
17
|
|
|
|
|
|
|
# these licenses. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Enbugger::NYTProf - subclass for Devel::NYTProf profiler |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
|
|
use strict; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
|
|
use vars qw( @ISA @Symbols ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
|
|
BEGIN { @ISA = 'Enbugger' } |
|
30
|
|
|
|
|
|
|
require B::Utils; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 OVERRIDEN METHODS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item CLASS-E_load_debugger |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _load_debugger { |
|
44
|
0
|
|
|
0
|
|
|
my ( $class ) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Compile D::NYTProf w/o the debugger on. |
|
47
|
0
|
|
|
|
|
|
Enbugger->_compile_with_nextstate(); |
|
48
|
0
|
|
|
|
|
|
require Devel::NYTProf; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Install the debugger. Protect $^P from Enbugger's own PL_perldb clobbering. |
|
51
|
|
|
|
|
|
|
{ |
|
52
|
0
|
|
|
|
|
|
local $^P; |
|
|
0
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$class->init_debugger; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$class->load_source; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Install D::NYTProf's hooks. |
|
59
|
|
|
|
|
|
|
# TODO: Detect whether INIT has already passed. If not, just install the proper |
|
60
|
|
|
|
|
|
|
# INIT{} and let it happen at the right time. |
|
61
|
0
|
|
|
|
|
|
DB::_INIT(); |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1 if $B::Utils::file; |
|
68
|
|
|
|
|
|
|
sub instrument_runtime { |
|
69
|
|
|
|
|
|
|
# Fix-up all previously compiled code to use the slots assigned |
|
70
|
|
|
|
|
|
|
# into PL_ppaddr. |
|
71
|
|
|
|
|
|
|
# |
|
72
|
|
|
|
|
|
|
# TODO: Devel::NYTProf itself prefers to keep Time::HiRes uninstrumented |
|
73
|
|
|
|
|
|
|
# so don't do it. Also, avoid instrumenting Devel::NYTProf. |
|
74
|
|
|
|
|
|
|
B::Utils::walkallops_simple( sub { return if |
|
75
|
0
|
0
|
0
|
0
|
|
|
'B::NULL' eq ref $_[0] |
|
76
|
|
|
|
|
|
|
|| $B::Utils::file =~ m{ |
|
77
|
|
|
|
|
|
|
(?: |
|
78
|
|
|
|
|
|
|
Devel/NYTProf\.pm |
|
79
|
|
|
|
|
|
|
| Devel/NYTProf/Core\.pm |
|
80
|
|
|
|
|
|
|
| Time/HiRes\.pm |
|
81
|
|
|
|
|
|
|
) |
|
82
|
|
|
|
|
|
|
\z |
|
83
|
|
|
|
|
|
|
}x; |
|
84
|
0
|
|
|
|
|
|
Enbugger::NYTProf::instrument_op($_[0]); |
|
85
|
0
|
|
|
0
|
1
|
|
}); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Load up a list of symbols known to be associated with this |
|
100
|
|
|
|
|
|
|
# debugger. Enbugger, the base class will use this to guess at which |
|
101
|
|
|
|
|
|
|
# debugger has been loaded if it was loaded prior to Enbugger being |
|
102
|
|
|
|
|
|
|
# around. |
|
103
|
|
|
|
|
|
|
1 if %Enbugger::RegisteredDebuggers; |
|
104
|
|
|
|
|
|
|
$Enbugger::RegisteredDebuggers{NYTProf}{symbols} = [qw[ |
|
105
|
|
|
|
|
|
|
DB |
|
106
|
|
|
|
|
|
|
DB_profiler |
|
107
|
|
|
|
|
|
|
_INIT |
|
108
|
|
|
|
|
|
|
__ANON__[/opt/perl-5.10.0/lib/site_perl/5.10.0/darwin-2level/Devel/NYTProf.pm:39] |
|
109
|
|
|
|
|
|
|
_finish |
|
110
|
|
|
|
|
|
|
args |
|
111
|
|
|
|
|
|
|
dbline |
|
112
|
|
|
|
|
|
|
disable_profile |
|
113
|
|
|
|
|
|
|
enable_profile |
|
114
|
|
|
|
|
|
|
finish_profile |
|
115
|
|
|
|
|
|
|
init_profiler |
|
116
|
|
|
|
|
|
|
postponed |
|
117
|
|
|
|
|
|
|
set_option |
|
118
|
|
|
|
|
|
|
signal |
|
119
|
|
|
|
|
|
|
single |
|
120
|
|
|
|
|
|
|
sub |
|
121
|
|
|
|
|
|
|
trace |
|
122
|
|
|
|
|
|
|
]]; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
() = -.0 |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
## Local Variables: |
|
127
|
|
|
|
|
|
|
## mode: cperl |
|
128
|
|
|
|
|
|
|
## mode: auto-fill |
|
129
|
|
|
|
|
|
|
## cperl-indent-level: 4 |
|
130
|
|
|
|
|
|
|
## End: |