@@ -98,7 +98,7 @@ \section{How Is This Profiler Different From The Old Profiler?}
9898\end {description }
9999
100100
101- \section {Instant Users Manual }
101+ \section {Instant Users Manual \label { profile-instant } }
102102
103103This section is provided for users that `` don't want to read the
104104manual.'' It provides a very brief overview, and allows a user to
@@ -111,7 +111,7 @@ \section{Instant Users Manual}
111111import profile
112112profile.run('foo()')
113113\end {verbatim }
114- %
114+
115115The above action would cause \samp {foo()} to be run, and a series of
116116informative lines (the profile) to be printed. The above approach is
117117most useful when working with the interpreter. If you would like to
@@ -123,7 +123,7 @@ \section{Instant Users Manual}
123123import profile
124124profile.run('foo()', 'fooprof')
125125\end {verbatim }
126- %
126+
127127The file \file {profile.py} can also be invoked as
128128a script to profile another script. For example:
129129
@@ -139,7 +139,7 @@ \section{Instant Users Manual}
139139import pstats
140140p = pstats.Stats('fooprof')
141141\end {verbatim }
142- %
142+
143143The class \class {Stats} (the above code just created an instance of
144144this class) has a variety of methods for manipulating and printing the
145145data that was just read into \samp {p}. When you ran
@@ -149,7 +149,7 @@ \section{Instant Users Manual}
149149\begin {verbatim }
150150p.strip_dirs().sort_stats(-1).print_stats()
151151\end {verbatim }
152- %
152+
153153The first method removed the extraneous path from all the module
154154names. The second method sorted all the entries according to the
155155standard module/line/name string that is printed (this is to comply
@@ -160,15 +160,15 @@ \section{Instant Users Manual}
160160p.sort_stats('name')
161161p.print_stats()
162162\end {verbatim }
163- %
163+
164164The first call will actually sort the list by function name, and the
165165second call will print out the statistics. The following are some
166166interesting calls to experiment with:
167167
168168\begin {verbatim }
169169p.sort_stats('cumulative').print_stats(10)
170170\end {verbatim }
171- %
171+
172172This sorts the profile by cumulative time in a function, and then only
173173prints the ten most significant lines. If you want to understand what
174174algorithms are taking time, the above line is what you would use.
@@ -179,7 +179,7 @@ \section{Instant Users Manual}
179179\begin {verbatim }
180180p.sort_stats('time').print_stats(10)
181181\end {verbatim }
182- %
182+
183183to sort according to time spent within each function, and then print
184184the statistics for the top ten functions.
185185
@@ -188,15 +188,15 @@ \section{Instant Users Manual}
188188\begin {verbatim }
189189p.sort_stats('file').print_stats('__init__')
190190\end {verbatim }
191- %
191+
192192This will sort all the statistics by file name, and then print out
193193statistics for only the class init methods ('cause they are spelled
194194with \samp {__init__} in them). As one final example, you could try:
195195
196196\begin {verbatim }
197197p.sort_stats('time', 'cum').print_stats(.5, 'init')
198198\end {verbatim }
199- %
199+
200200This line sorts statistics with a primary key of time, and a secondary
201201key of cumulative time, and then prints out some of the statistics.
202202To be specific, the list is first culled down to 50\% (re: \samp {.5})
@@ -219,7 +219,7 @@ \section{Instant Users Manual}
219219p.print_callees()
220220p.add('fooprof')
221221\end {verbatim }
222- %
222+
223223\section {What Is Deterministic Profiling? }
224224\nodename {Deterministic Profiling}
225225
@@ -254,9 +254,9 @@ \section{What Is Deterministic Profiling?}
254254
255255
256256\section {Reference Manual }
257- \declaremodule {standard}{profile}
258257
259- \modulesynopsis {None}
258+ \declaremodule {standard}{profile}
259+ \modulesynopsis {Python profiler}
260260
261261
262262
@@ -338,6 +338,7 @@ \section{Reference Manual}
338338\module {pstats} module:
339339
340340% now switch modules....
341+ % (This \stmodindex use may be hard to change ;-( )
341342\stmodindex {pstats}
342343
343344\begin {classdesc }{Stats}{filename\optional {, ...}}
@@ -359,11 +360,11 @@ \section{Reference Manual}
359360\end {classdesc }
360361
361362
362- \subsection {The \module {Stats} Class }
363+ \subsection {The \class {Stats} Class \label { profile-stats } }
363364
364- \setindexsubitem {( Stats method)}
365+ \class { Stats} objects have the following methods:
365366
366- \begin {methoddesc }{strip_dirs}{}
367+ \begin {methoddesc }[Stats] {strip_dirs}{}
367368This method for the \class {Stats} class removes all leading path
368369information from file names. It is very useful in reducing the size
369370of the printout to fit within (close to) 80 columns. This method
@@ -377,7 +378,7 @@ \subsection{The \module{Stats} Class}
377378\end {methoddesc }
378379
379380
380- \begin {methoddesc }{add}{filename\optional {, ...}}
381+ \begin {methoddesc }[Stats] {add}{filename\optional {, ...}}
381382This method of the \class {Stats} class accumulates additional
382383profiling information into the current profiling object. Its
383384arguments should refer to filenames created by the corresponding
@@ -386,7 +387,7 @@ \subsection{The \module{Stats} Class}
386387single function statistics.
387388\end {methoddesc }
388389
389- \begin {methoddesc }{sort_stats}{key\optional {, ...}}
390+ \begin {methoddesc }[Stats] {sort_stats}{key\optional {, ...}}
390391This method modifies the \class {Stats} object by sorting it according
391392to the supplied criteria. The argument is typically a string
392393identifying the basis of a sort (example: \code {'time'} or
@@ -435,15 +436,15 @@ \subsection{The \module{Stats} Class}
435436\end {methoddesc }
436437
437438
438- \begin {methoddesc }{reverse_order}{}
439+ \begin {methoddesc }[Stats] {reverse_order}{}
439440This method for the \class {Stats} class reverses the ordering of the basic
440441list within the object. This method is provided primarily for
441442compatibility with the old profiler. Its utility is questionable
442443now that ascending vs descending order is properly selected based on
443444the sort key of choice.
444445\end {methoddesc }
445446
446- \begin {methoddesc }{print_stats}{restriction\optional {, ...}}
447+ \begin {methoddesc }[Stats] {print_stats}{restriction\optional {, ...}}
447448This method for the \class {Stats} class prints out a report as described
448449in the \function {profile.run()} definition.
449450
@@ -478,7 +479,7 @@ \subsection{The \module{Stats} Class}
478479\end {methoddesc }
479480
480481
481- \begin {methoddesc }{print_callers}{restrictions\optional {, ...}}
482+ \begin {methoddesc }[Stats] {print_callers}{restrictions\optional {, ...}}
482483This method for the \class {Stats} class prints a list of all functions
483484that called each function in the profiled database. The ordering is
484485identical to that provided by \method {print_stats()}, and the definition
@@ -488,14 +489,14 @@ \subsection{The \module{Stats} Class}
488489is the cumulative time spent in the function at the right.
489490\end {methoddesc }
490491
491- \begin {methoddesc }{print_callees}{restrictions\optional {, ...}}
492+ \begin {methoddesc }[Stats] {print_callees}{restrictions\optional {, ...}}
492493This method for the \class {Stats} class prints a list of all function
493494that were called by the indicated function. Aside from this reversal
494495of direction of calls (re: called vs was called by), the arguments and
495496ordering are identical to the \method {print_callers()} method.
496497\end {methoddesc }
497498
498- \begin {methoddesc }{ignore}{}
499+ \begin {methoddesc }[Stats] {ignore}{}
499500\deprecated {1.5.1}{This is not needed in modern versions of
500501Python.\footnote {
501502 This was once necessary, when Python would print any unused expression
@@ -504,7 +505,7 @@ \subsection{The \module{Stats} Class}
504505\end {methoddesc }
505506
506507
507- \section {Limitations }
508+ \section {Limitations \label { profile-limits } }
508509
509510There are two fundamental limitations on this profiler. The first is
510511that it relies on the Python interpreter to dispatch \dfn {call},
@@ -539,13 +540,13 @@ \section{Limitations}
539540After the profiler is calibrated, it will be more accurate (in a least
540541square sense), but it will sometimes produce negative numbers (when
541542call counts are exceptionally low, and the gods of probability work
542- against you :-). ) Do \emph {NOT } be alarmed by negative numbers in
543+ against you :-). ) Do \emph {not } be alarmed by negative numbers in
543544the profile. They should \emph {only } appear if you have calibrated
544545your profiler, and the results are actually better than without
545546calibration.
546547
547548
548- \section {Calibration }
549+ \section {Calibration \label { profile-calibration } }
549550
550551The profiler class has a hard coded constant that is added to each
551552event handling time to compensate for the overhead of calling the time
@@ -657,7 +658,7 @@ \section{Extensions --- Deriving Better Profilers}
657658constant :-).
658659
659660
660- \subsection {OldProfile Class }
661+ \subsection {OldProfile Class \label { profile-old } }
661662
662663The following derived profiler simulates the old style profiler,
663664providing errant results on recursive functions. The reason for the
@@ -719,7 +720,7 @@ \subsection{OldProfile Class}
719720 self.stats[nor_func] = nc, nc, tt, ct, nor_callers
720721\end {verbatim }
721722
722- \subsection {HotProfile Class }
723+ \subsection {HotProfile Class \label { profile-HotProfile } }
723724
724725This profiler is the fastest derived profile example. It does not
725726calculate caller-callee relationships, and does not calculate
0 commit comments