Name
print_callees, print_callers
Synopsis
s
.print_callees(*restrictions
)
Outputs the list of functions in
s
’s profile data, sorted
according to the latest call to
s
.sort_stats
, and
subject to the given restrictions, if any. You can call each printing
method with zero or more restrictions
,
which are applied one after the other, in order, to reduce the number
of output lines. A restriction that is an integer
n
limits the output to the first
n
lines. A restriction that is a
floating-point value f
between
0.0
and 1.0
limits the output
to a fraction f
of the lines. A
restriction that is a string is compiled as a regular expression (as
covered in Chapter 9); only lines satisfying a
search
method call on the regular expressions are
output. Restrictions are cumulative. For example,
s
.print_calls(10,0.5)
outputs the first 5 lines (half of 10). Output restrictions apply
only after the summary and header lines: summary and header are
output unconditionally.
Each function f
that is output is
accompanied by the list of
f
’s callers (the
functions that called f
) or
f
’s callees (the
functions that f
called) according to the
name of the method.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.