Rev 2659: (Ian Clatworthy) Dump profiling data for KCacheGrind if the filename starts with callgrind.out in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Jul 30 06:14:24 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2659
revision-id: pqm at pqm.ubuntu.com-20070730051419-0jdj7g8fm4iuoz7h
parent: pqm at pqm.ubuntu.com-20070728030946-tfjmxwe9y2eq1gzo
parent: ian.clatworthy at internode.on.net-20070730032503-4w8lmn0s42nxpxna
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-07-30 06:14:19 +0100
message:
(Ian Clatworthy) Dump profiling data for KCacheGrind if the filename starts with callgrind.out
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/help_topics.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/lsprof.py lsprof.py-20051208071030-833790916798ceed
doc/developers/profiling.txt profiling.txt-20070531045713-j15mxufywgzwdeu8-1
------------------------------------------------------------
revno: 2658.1.1
merged: ian.clatworthy at internode.on.net-20070730032503-4w8lmn0s42nxpxna
parent: pqm at pqm.ubuntu.com-20070728030946-tfjmxwe9y2eq1gzo
parent: ian.clatworthy at internode.on.net-20070730015544-7g5r7kbv1nejica3
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: ianc-integration
timestamp: Mon 2007-07-30 13:25:03 +1000
message:
(Ian Clatworthy) Dump profiling data for KCacheGrind if the filename starts with callgrind.out
------------------------------------------------------------
revno: 2654.2.2
merged: ian.clatworthy at internode.on.net-20070730015544-7g5r7kbv1nejica3
parent: ian.clatworthy at internode.on.net-20070727055727-yxxco3di19yykrev
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.callgrind-out
timestamp: Mon 2007-07-30 11:55:44 +1000
message:
Put all format detection stuff in one spot as requested by John Arbash Meinel
------------------------------------------------------------
revno: 2654.2.1
merged: ian.clatworthy at internode.on.net-20070727055727-yxxco3di19yykrev
parent: pqm at pqm.ubuntu.com-20070726223348-t2howycr63c04q7r
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.callgrind-out
timestamp: Fri 2007-07-27 15:57:27 +1000
message:
Dump profiling data for KCacheGrind if the filename starts with callgrind.out
=== modified file 'NEWS'
--- a/NEWS 2007-07-27 16:48:04 +0000
+++ b/NEWS 2007-07-30 03:25:03 +0000
@@ -95,6 +95,10 @@
``other`` is large. This improves ``VF.get_graph([version_id])`` for
a 12.5k graph from 2.9s down to 200ms. (John Arbash Meinel)
+ * The ``--lsprof-file`` option now generates output for KCacheGrind if
+ the file starts with ``callgrind.out``. This matches the default file
+ filtering done by KCacheGrind's Open Dialog. (Ian Clatworthy)
+
LIBRARY API BREAKS:
* Deprecated dictionary ``bzrlib.option.SHORT_OPTIONS`` removed.
=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py 2007-07-12 12:07:13 +0000
+++ b/bzrlib/help_topics.py 2007-07-27 05:57:27 +0000
@@ -194,9 +194,10 @@
--lsprof Profile execution using the lsprof profiler
--lsprof-file Profile execution using the lsprof profiler, and write the
results to a specified file. If the filename ends with ".txt",
- text format will be used. If the filename ends with
- ".callgrind", output will be formatted for use with KCacheGrind.
- Otherwise, the output will be a pickle.
+ text format will be used. If the filename either starts with
+ "callgrind.out" or end with ".callgrind", the output will be
+ formatted for use with KCacheGrind. Otherwise, the output
+ will be a pickle.
See doc/developers/profiling.txt for more information on profiling.
=== modified file 'bzrlib/lsprof.py'
--- a/bzrlib/lsprof.py 2007-06-06 10:45:08 +0000
+++ b/bzrlib/lsprof.py 2007-07-30 01:55:44 +0000
@@ -113,13 +113,17 @@
:param format: 'txt' for a text representation;
'callgrind' for calltree format;
otherwise a pickled Python object. A format of None indicates
- that the format to use is to be found from the extension of
- filename.
+ that the format to use is to be found from the filename. If
+ the name starts with callgrind.out, callgrind format is used
+ otherwise the format is given by the filename extension.
"""
if format is None:
- ext = os.path.splitext(filename)[1]
- if len(ext) > 1:
- format = ext[1:]
+ if filename.startswith('callgrind.out'):
+ format = "callgrind"
+ else:
+ ext = os.path.splitext(filename)[1]
+ if len(ext) > 1:
+ format = ext[1:]
outfile = open(filename, 'wb')
try:
if format == "callgrind":
=== modified file 'doc/developers/profiling.txt'
--- a/doc/developers/profiling.txt 2007-06-27 09:39:45 +0000
+++ b/doc/developers/profiling.txt 2007-07-27 05:57:27 +0000
@@ -1,35 +1,42 @@
Profiling
=========
+Using profilers
+---------------
+
Bazaar has some built-in support for collecting and saving profiling
-information. In the simpliest case, the --lsprof option can be used as
+information. In the simpliest case, the ``--lsprof`` option can be used as
shown below::
bzr --lsprof ...
This will dump the profiling information to stdout before exiting.
-Alternatively, the --lsprof-file option can be used to specify a filename
+Alternatively, the ``--lsprof-file`` option can be used to specify a filename
to save the profiling data into to. By default, profiling data saved to a
file is a pickled Python object making it possible to reload the data and
do with it what you will. For convenience though:
-* if the filename ends in ".txt", it will be dumped in a text format.
-
-* if the filename ends in ".callgrind", it will be converted to a format
- loadable by the KCacheGrind visualization tool.
-
-Here is an example of how to use the --lsprof-file option in combination
-with KCacheGrind to visualize what the "status" command is doing::
-
- bzr --lsprof-file status001.callgrind status
- kcachegrind status001.callgrind &
-
-.. Note:: bzr also has a --profile option that uses the hotshot profiler
+* if the filename ends in ``.txt``, it will be dumped in a text format.
+
+* if the filename either starts with ``callgrind.out`` or ends with
+ ``.callgrind``, it will be converted to a format loadable by the
+ KCacheGrind visualization tool.
+
+Note that KCacheGrind's Open Dialog has a default filter than only shows
+files starting with ``callgrind.out`` so the longer filename is usually
+preferable. Here is an example of how to use the ``--lsprof-file`` option
+in combination with KCacheGrind to visualize what the ``status`` command
+is doing::
+
+ bzr --lsprof-file callgrind.out.st001 status
+ kcachegrind callgrind.out.st001 &
+
+.. Note:: bzr also has a ``--profile`` option that uses the hotshot profiler
instead of the lsprof profiler. The hotshot profiler can be useful
though the lsprof one is generally recommended. See
http://docs.python.org/lib/node795.html.
-Note that to use --lsprof you must install the lsprof module, which you
+Note that to use ``--lsprof`` you must install the lsprof module, which you
can get with::
svn co http://codespeak.net/svn/user/arigo/hack/misc/lsprof
@@ -42,7 +49,7 @@
identifying unnecessary lock traffic. This is activated by the ``-Dlock``
global option.
-This writes messages into ~/.bzr.log.
+This writes messages into ``~/.bzr.log``.
At present this only logs actions relating to the on-disk lockdir. It
doesn't describe actions on in-memory lock counters, or OS locks (which
are used for dirstate.)
More information about the bazaar-commits
mailing list