4
7
Bazaar has some built-in support for collecting and saving profiling
5
information. In the simpliest case, the --lsprof option can be used as
8
information. In the simpliest case, the ``--lsprof`` option can be used as
10
13
This will dump the profiling information to stdout before exiting.
11
Alternatively, the --lsprof-file option can be used to specify a filename
14
Alternatively, the ``--lsprof-file`` option can be used to specify a filename
12
15
to save the profiling data into to. By default, profiling data saved to a
13
16
file is a pickled Python object making it possible to reload the data and
14
17
do with it what you will. For convenience though:
16
* if the filename ends in ".txt", it will be dumped in a text format.
18
* if the filename ends in ".callgrind", it will be converted to a format
19
loadable by the KCacheGrind visualization tool.
21
Here is an example of how to use the --lsprof-file option in combination
22
with KCacheGrind to visualize what the "status" command is doing::
24
bzr --lsprof-file status001.callgrind status
25
kcachegrind status001.callgrind &
27
.. Note:: bzr also has a --profile option that uses the hotshot profiler
19
* if the filename ends in ``.txt``, it will be dumped in a text format.
21
* if the filename either starts with ``callgrind.out`` or ends with
22
``.callgrind``, it will be converted to a format loadable by the
23
KCacheGrind visualization tool.
25
Note that KCacheGrind's Open Dialog has a default filter than only shows
26
files starting with ``callgrind.out`` so the longer filename is usually
27
preferable. Here is an example of how to use the ``--lsprof-file`` option
28
in combination with KCacheGrind to visualize what the ``status`` command
31
bzr --lsprof-file callgrind.out.st001 status
32
kcachegrind callgrind.out.st001 &
34
.. Note:: bzr also has a ``--profile`` option that uses the hotshot profiler
28
35
instead of the lsprof profiler. The hotshot profiler can be useful
29
36
though the lsprof one is generally recommended. See
30
37
http://docs.python.org/lib/node795.html.
32
Note that to use --lsprof you must install the lsprof module, which you
39
Note that to use ``--lsprof`` you must install the lsprof module, which you
35
42
svn co http://codespeak.net/svn/user/arigo/hack/misc/lsprof
42
49
identifying unnecessary lock traffic. This is activated by the ``-Dlock``
45
This writes messages into ~/.bzr.log.
52
This writes messages into ``~/.bzr.log``.
46
53
At present this only logs actions relating to the on-disk lockdir. It
47
54
doesn't describe actions on in-memory lock counters, or OS locks (which
48
55
are used for dirstate.)
58
Profiling HPSS Requests
59
-----------------------
61
When trying to improve network performance, it is often useful to know
62
what requests are being made, and how long they are taking. The ``-Dhpss``
63
global option will enable logging smart server requests, including the
64
time spent in each request.