/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/developers/profiling.txt

  • Committer: Vincent Ladeuil
  • Date: 2009-04-27 16:10:10 UTC
  • mto: (4310.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4311.
  • Revision ID: v.ladeuil+lp@free.fr-20090427161010-7swfzeagf63cpixd
Fix bug #367726 by reverting some default user handling introduced
while fixing bug #256612.

* bzrlib/transport/ssh.py:
(_paramiko_auth): Explicitly use getpass.getuser() as default
user.

* bzrlib/transport/ftp/_gssapi.py:
(GSSAPIFtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/transport/ftp/__init__.py:
(FtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/tests/test_sftp_transport.py:
(TestUsesAuthConfig.test_sftp_is_none_if_no_config)
(TestUsesAuthConfig.test_sftp_doesnt_prompt_username): Revert to
None as the default user.

* bzrlib/tests/test_remote.py:
(TestRemoteSSHTransportAuthentication): The really offending one:
revert to None as the default user.

* bzrlib/tests/test_config.py:
(TestAuthenticationConfig.test_username_default_no_prompt): Update
test (and some PEP8).

* bzrlib/smtp_connection.py:
(SMTPConnection._authenticate): Revert to None as the default
user.

* bzrlib/plugins/launchpad/account.py:
(_get_auth_user): Revert default value handling.

* bzrlib/config.py:
(AuthenticationConfig.get_user): Fix doc-string. Leave default
value handling to callers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Profiling
 
2
=========
 
3
 
 
4
Using profilers
 
5
---------------
 
6
 
 
7
Bazaar has some built-in support for collecting and saving profiling
 
8
information. In the simpliest case, the ``--lsprof`` option can be used as
 
9
shown below::
 
10
 
 
11
  bzr --lsprof ...
 
12
 
 
13
This will dump the profiling information to stdout before exiting.
 
14
Alternatively, the ``--lsprof-file`` option can be used to specify a filename
 
15
to save the profiling data into to. By default, profiling data saved to a
 
16
file is a pickled Python object making it possible to reload the data and
 
17
do with it what you will. For convenience though:
 
18
 
 
19
* if the filename ends in ``.txt``, it will be dumped in a text format.
 
20
 
 
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.
 
24
 
 
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
 
29
is doing::
 
30
 
 
31
  bzr --lsprof-file callgrind.out.st001 status
 
32
  kcachegrind callgrind.out.st001 &
 
33
 
 
34
.. Note:: bzr also has a ``--profile`` option that uses the hotshot profiler
 
35
   instead of the lsprof profiler. The hotshot profiler can be useful
 
36
   though the lsprof one is generally recommended. See
 
37
   http://docs.python.org/lib/node795.html.
 
38
 
 
39
Note that to use ``--lsprof`` you must install the lsprof module, which you
 
40
can get with::
 
41
 
 
42
  svn co http://codespeak.net/svn/user/arigo/hack/misc/lsprof
 
43
 
 
44
 
 
45
Profiling locks
 
46
---------------
 
47
 
 
48
Bazaar can log when locks are taken or released, which can help in
 
49
identifying unnecessary lock traffic.  This is activated by the ``-Dlock``
 
50
global option.
 
51
 
 
52
This writes messages into ``~/.bzr.log``.
 
53
At present this only logs actions relating to the on-disk lockdir.  It 
 
54
doesn't describe actions on in-memory lock counters, or OS locks (which
 
55
are used for dirstate.)
 
56
 
 
57
 
 
58
Profiling HPSS Requests
 
59
-----------------------
 
60
 
 
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.