Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b9f1f6d

Browse files
committed
Misc. markup nits.
All sections get reasonable file names in the HTML output.
1 parent 2dabd81 commit b9f1f6d

1 file changed

Lines changed: 29 additions & 28 deletions

File tree

Doc/lib/libprofile.tex

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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

103103
This section is provided for users that ``don't want to read the
104104
manual.'' It provides a very brief overview, and allows a user to
@@ -111,7 +111,7 @@ \section{Instant Users Manual}
111111
import profile
112112
profile.run('foo()')
113113
\end{verbatim}
114-
%
114+
115115
The above action would cause \samp{foo()} to be run, and a series of
116116
informative lines (the profile) to be printed. The above approach is
117117
most useful when working with the interpreter. If you would like to
@@ -123,7 +123,7 @@ \section{Instant Users Manual}
123123
import profile
124124
profile.run('foo()', 'fooprof')
125125
\end{verbatim}
126-
%
126+
127127
The file \file{profile.py} can also be invoked as
128128
a script to profile another script. For example:
129129

@@ -139,7 +139,7 @@ \section{Instant Users Manual}
139139
import pstats
140140
p = pstats.Stats('fooprof')
141141
\end{verbatim}
142-
%
142+
143143
The class \class{Stats} (the above code just created an instance of
144144
this class) has a variety of methods for manipulating and printing the
145145
data that was just read into \samp{p}. When you ran
@@ -149,7 +149,7 @@ \section{Instant Users Manual}
149149
\begin{verbatim}
150150
p.strip_dirs().sort_stats(-1).print_stats()
151151
\end{verbatim}
152-
%
152+
153153
The first method removed the extraneous path from all the module
154154
names. The second method sorted all the entries according to the
155155
standard module/line/name string that is printed (this is to comply
@@ -160,15 +160,15 @@ \section{Instant Users Manual}
160160
p.sort_stats('name')
161161
p.print_stats()
162162
\end{verbatim}
163-
%
163+
164164
The first call will actually sort the list by function name, and the
165165
second call will print out the statistics. The following are some
166166
interesting calls to experiment with:
167167

168168
\begin{verbatim}
169169
p.sort_stats('cumulative').print_stats(10)
170170
\end{verbatim}
171-
%
171+
172172
This sorts the profile by cumulative time in a function, and then only
173173
prints the ten most significant lines. If you want to understand what
174174
algorithms are taking time, the above line is what you would use.
@@ -179,7 +179,7 @@ \section{Instant Users Manual}
179179
\begin{verbatim}
180180
p.sort_stats('time').print_stats(10)
181181
\end{verbatim}
182-
%
182+
183183
to sort according to time spent within each function, and then print
184184
the statistics for the top ten functions.
185185

@@ -188,15 +188,15 @@ \section{Instant Users Manual}
188188
\begin{verbatim}
189189
p.sort_stats('file').print_stats('__init__')
190190
\end{verbatim}
191-
%
191+
192192
This will sort all the statistics by file name, and then print out
193193
statistics for only the class init methods ('cause they are spelled
194194
with \samp{__init__} in them). As one final example, you could try:
195195

196196
\begin{verbatim}
197197
p.sort_stats('time', 'cum').print_stats(.5, 'init')
198198
\end{verbatim}
199-
%
199+
200200
This line sorts statistics with a primary key of time, and a secondary
201201
key of cumulative time, and then prints out some of the statistics.
202202
To be specific, the list is first culled down to 50\% (re: \samp{.5})
@@ -219,7 +219,7 @@ \section{Instant Users Manual}
219219
p.print_callees()
220220
p.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}{}
367368
This method for the \class{Stats} class removes all leading path
368369
information from file names. It is very useful in reducing the size
369370
of 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{, ...}}
381382
This method of the \class{Stats} class accumulates additional
382383
profiling information into the current profiling object. Its
383384
arguments should refer to filenames created by the corresponding
@@ -386,7 +387,7 @@ \subsection{The \module{Stats} Class}
386387
single function statistics.
387388
\end{methoddesc}
388389

389-
\begin{methoddesc}{sort_stats}{key\optional{, ...}}
390+
\begin{methoddesc}[Stats]{sort_stats}{key\optional{, ...}}
390391
This method modifies the \class{Stats} object by sorting it according
391392
to the supplied criteria. The argument is typically a string
392393
identifying 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}{}
439440
This method for the \class{Stats} class reverses the ordering of the basic
440441
list within the object. This method is provided primarily for
441442
compatibility with the old profiler. Its utility is questionable
442443
now that ascending vs descending order is properly selected based on
443444
the sort key of choice.
444445
\end{methoddesc}
445446

446-
\begin{methoddesc}{print_stats}{restriction\optional{, ...}}
447+
\begin{methoddesc}[Stats]{print_stats}{restriction\optional{, ...}}
447448
This method for the \class{Stats} class prints out a report as described
448449
in 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{, ...}}
482483
This method for the \class{Stats} class prints a list of all functions
483484
that called each function in the profiled database. The ordering is
484485
identical to that provided by \method{print_stats()}, and the definition
@@ -488,14 +489,14 @@ \subsection{The \module{Stats} Class}
488489
is 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{, ...}}
492493
This method for the \class{Stats} class prints a list of all function
493494
that were called by the indicated function. Aside from this reversal
494495
of direction of calls (re: called vs was called by), the arguments and
495496
ordering 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
500501
Python.\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

509510
There are two fundamental limitations on this profiler. The first is
510511
that it relies on the Python interpreter to dispatch \dfn{call},
@@ -539,13 +540,13 @@ \section{Limitations}
539540
After the profiler is calibrated, it will be more accurate (in a least
540541
square sense), but it will sometimes produce negative numbers (when
541542
call 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
543544
the profile. They should \emph{only} appear if you have calibrated
544545
your profiler, and the results are actually better than without
545546
calibration.
546547

547548

548-
\section{Calibration}
549+
\section{Calibration \label{profile-calibration}}
549550

550551
The profiler class has a hard coded constant that is added to each
551552
event handling time to compensate for the overhead of calling the time
@@ -657,7 +658,7 @@ \section{Extensions --- Deriving Better Profilers}
657658
constant :-).
658659

659660

660-
\subsection{OldProfile Class}
661+
\subsection{OldProfile Class \label{profile-old}}
661662

662663
The following derived profiler simulates the old style profiler,
663664
providing 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

724725
This profiler is the fastest derived profile example. It does not
725726
calculate caller-callee relationships, and does not calculate

0 commit comments

Comments
 (0)