tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
M\¬Qc@s$dZddlZddlZddlZddlZddlmZddddgZedd„Z    edd    „Z
d
„Z e ed ƒr ej d „Znd Zy+ddlZd„Zed„ZdZWnek
ränXdfd„ƒYZd„Zd„Zedkr eƒndS(s Class for profiling Python code.iÿÿÿÿN(t OptionParsertruntrunctxthelptProfilecCs]tƒ}y|j|ƒ}Wntk
r/nX|dk    rL|j|ƒn |j|ƒSdS(sRun statement under profiler optionally saving results in filename
 
    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    N(RRt
SystemExittNonet
dump_statst print_stats(t    statementtfilenametsorttprof((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR0s      cCsctƒ}y|j|||ƒ}Wntk
r5nX|dk    rR|j|ƒn |j|ƒSdS(s·Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.
 
    statement and filename have the same semantics as profile.run
    N(RRRRRR(R    tglobalstlocalsR
R R ((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyREs      cCsdGHdGHdS(Ns2Documentation for the profile module can be found s?in the Python Library Reference, section 'The Python Profiler'.((((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRWsttimescCs|ƒ}|d|dS(Nii((ttimertt((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt_get_time_times\s    icCstjtjƒS(N(tresourcet    getrusaget RUSAGE_SELF(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt<lambda>gscCs|ƒ}|d|dS(Nii((RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt_get_time_resourcehs    icBs3eZdZdZd"d"d„Zd„Zd„Zd„Zd„Z    d„Z
d„Z d    „Z d
„Z ie d 6e
d 6e d 6e d6e d6e d6Zd„Zdd#d„ƒYZdd$d„ƒYZd„Zd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd „Zd!„ZRS(%sProfiler class.
 
    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.
 
    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).
 
    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:
 
    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    icCs¥i|_d|_d|_d|_|dkr<|j}n||_|søtrrt|_|j    |_
t |_ q…t tdƒr£tj|_|_ |j|_
q…t tdƒrÖtj|_|j    |_
t|_ q…tj|_|_ |j|_
n||_|jƒ}yt|ƒ}Wn&tk
rE||_ |j|_
n@X|dkra|j    |_
n |j|_
|td„}||_ |j ƒ|_|jdƒdS(NttclockRicSs ||ƒƒS(N((Rtsum((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pytget_time_timerÃstprofiler(ttimingsRtcurtcmdt c_func_nametbiast_has_rest resgetrusageRttrace_dispatcht
dispatcherRtget_timethasattrttimeRttrace_dispatch_itosRRtlent    TypeErrorttrace_dispatch_lRRt simulate_call(tselfRR!RtlengthR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt__init__˜sF                                               cCs­|j}|ƒ}|d|d|j|j}|dkrM|j|_n|j||||ƒr‡|ƒ}|d|d|_n"|ƒ}|d|d||_dS(Niitc_call(RRR!t__name__R tdispatch(R/tframeteventtargRRtr((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR$Ës                  cCsw|j}|ƒ|j|j}|dkr;|j|_n|j||||ƒrc|ƒ|_n|ƒ||_dS(NR2(RRR!R3R R4(R/R5R6R7RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR)Ýs     cCsƒ|j}|ƒd|j|j}|dkr?|j|_n|j||||ƒrk|ƒd|_n|ƒd||_dS(NgN@R2(RRR!R3R R4(R/R5R6R7RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyttrace_dispatch_macìs     cCsw|j}|ƒ|j|j}|dkr;|j|_n|j||||ƒrc|ƒ|_n|ƒ||_dS(NR2(R&RR!R3R R4(R/R5R6R7R&R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR-ús     c    Cs`|j\}}}}}}||k    r=|r=|j||ƒS|||||||f|_dS(Ni(Rttrace_dispatch_return(    R/R5Rtrpttrittrettrfntrframetrcur((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyttrace_dispatch_exception s
cCs€|jrÖ|j|jdk    rÖ|j\}}}}}}t|tjƒsÖ|j|jks‚td|||j||jfƒ‚|j|dƒ|jdksÓ|j|jdksÓtd|jdfƒ‚qÖn|j}    |    j    |    j
|    j f}
|dd|
||jf|_|j } |
| krc| |
\} } }}}| | d|||f| |
<nddddif| |
<dS(NiþÿÿÿsBad calliiýÿÿÿi( Rtf_backt
isinstanceRt
fake_frametAssertionErrorR:Rtf_codet co_filenametco_firstlinenotco_nameR(R/R5RR;R<R=R>R?R@tfcodetfnRtcctnsttttcttcallers((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyttrace_dispatch_calls&              c
Cs›dd|jf}|dd|||jf|_|j}||kr~||\}}}}}    ||d|||    f||<nddddif||<dS(NRii(R RR(
R/R5RRKRRLRMRNRORP((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyttrace_dispatch_c_call+s      cCsU||jdk    r\||jdjksBtd|jdfƒ‚|j|jddƒn|j\}}}}}}||}||}|\}    }
} } } }|    |
|| || | |f|_|j}||\}}}}}|s||}|d}n| |kr&|| d|| <n
d|| <||d||||f||<dS(Niþÿÿÿs
Bad returniýÿÿÿii(RRBRER:R(R/R5RR;R<R=R>R@t frame_totaltppttpittpettpfntpframetpcurRRLRMRNRORP((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR:6s$/
 
#    
 
!tcallt    exceptiontreturnR2t c_exceptiontc_returncCs+|jdrdS||_|j|ƒdS(Niÿÿÿÿ(RRR.(R/R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pytset_cmdls     t    fake_codecBseZd„Zd„ZRS(cCs(||_||_||_d|_dS(Ni(RGtco_lineRIRH(R/R
tlinetname((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR1rs            cCst|j|j|jfƒS(N(treprRGRaRI(R/((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt__repr__xs(R3t
__module__R1Re(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR`qs    RDcBseZd„ZRS(cCs||_||_dS(N(RFRB(R/tcodetprior((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR1|s    (R3RfR1(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRD{scCsa|jdd|ƒ}|jr.|jd}nd}|j||ƒ}|jd||dƒdS(NtprofileiiþÿÿÿRZ(R`RRRDR4(R/RcRgRXR5((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR.€s     cCse|j}|ƒ|j}x5|jdrP|jd||jd|ƒd}qW|ƒ||_dS(NiÿÿÿÿR\iþÿÿÿi(R&RRR4(R/R&R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pytsimulate_cmd_completeŒs     
iÿÿÿÿcCs2ddl}|j|ƒjƒj|ƒjƒdS(Niÿÿÿÿ(tpstatstStatst
strip_dirst
sort_statsR(R/R Rk((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR—s cCs:t|dƒ}|jƒtj|j|ƒ|jƒdS(Ntwb(topent create_statstmarshaltdumptstatstclose(R/tfiletf((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRœs
cCs|jƒ|jƒdS(N(Rjtsnapshot_stats(R/((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRq¢s
c    Cs‹i|_x{|jjƒD]j\}\}}}}}|jƒ}d}x|jƒD]}||7}qSW|||||f|j|<qWdS(Ni(RtRt    iteritemstcopyt
itervalues(    R/tfuncRLRMRNRORPtnctcallcnt((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRx¦s    + cCs(ddl}|j}|j|||ƒS(Niÿÿÿÿ(t__main__t__dict__R(R/RRtdict((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR³s     cBs@|j|ƒej|jƒz|||UWdejdƒX|S(N(R_tsyst
setprofileR%R(R/RR R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyR¸s  cOsI|jt|ƒƒtj|jƒz|||ŽSWdtjdƒXdS(N(R_RdR‚RƒR%R(R/R|targstkw((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pytruncallÂs
cCsU|jtk    rtdƒ‚n|j}d|_z|j||ƒSWd||_XdS(Ns&Subclasses must override .calibrate().i(t    __class__RR,R!t_calibrate_inner(R/tmtverboset
saved_bias((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt    calibrateós        cCs}|j}d„}|d„}||ƒ|ƒ}||ƒ|ƒ}||}|r`dG|GHntƒ}    |ƒ}|    jdtƒtƒƒ|ƒ}||}
|r°dG|
GHnd} d} xX|    jjƒD]G\\} }}\}}}}}|dkrÌ| |7} | |7} qÌqÌW|r2d    G| GHd
G| GHn| |d krUtd | ƒ‚n| |d | }|rydG|GHn|S(NcSs!xt|ƒD] }d}q WdS(Ni(trange(tntitx((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pytf1scSs%xt|ƒD]}|dƒq WdS(Nid(R(R‰R‘R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRw ss elapsed time without profiling =sf(m)selapsed time with profiling =gRwR‘s!'CPU seconds' profiler reported =stotal # calls =is internal error: total calls = %dg@s+mean stopwatch overhead per profile event =(Rwsf1(R&RRR RRtitemst
ValueError(R/R‰RŠR&R‘Rwtt0tt1telapsed_noprofiletptelapsed_profilet total_callst reported_timeR
RbtfuncnameRLRMRNRORPtmean((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRˆþsB         
    
    
             
 1 
      N(((R3Rft__doc__R!RR1R$R)R9R-RARQRRR:R4R_R`RDR.RjRRRqRxRRR†RŒRˆ(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRos@%3                                &
 
   
                             
   1 cGs    dGHdS(Ns7Report generating functions are in the "pstats" module((R„((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyRl=sc    CsXd}td|ƒ}t|_|jddddddd    dƒ|jd
d dd dd d    dƒtjds‰|jƒtjdƒn|j    ƒ\}}|tj(t
|ƒdkrJ|d}tj j dt j j|ƒƒt|dƒ}t|jƒ|dƒ}WdQXi|d6dd6dd6}t||d|j|jƒn
|jƒ|S(Ns?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...tusages-os    --outfiletdesttoutfileRsSave stats to <outfile>tdefaults-ss--sortR s?Sort order when printing to stdout, based on pstats.Stats classiÿÿÿÿiiitrbtexect__file__RR3t __package__(RtFalsetallow_interspersed_argst
add_optionRR‚targvt print_usagetexitt
parse_argsR+tpathtinsertR*tdirnameRptcompiletreadRR R (RžtparsertoptionsR„tprognametfpRgtglobs((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pytmain@s2      
 
 
 
 
R(RR‚R*R(RrtoptparseRt__all__RRRRR'RRR"RR#Rt ImportErrorRRlR·R3(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/profile.pyt<module>    s2              
 ÿÏ        !