[PATCH] Improve profiling doc and make the data easier to visualise

Robert Collins robertc at robertcollins.net
Tue May 29 23:57:33 BST 2007


On Mon, 2007-05-28 at 12:43 +1000, Ian Clatworthy wrote:
> All,
> 
> Here's a patch that fixes some bugs in the conversion of lsprof data to 
> make it viewable in KCacheGrind. ddaa had this going some time back 
> (http://ddaa.net/blog/python/lsprof-calltree) but it looks like changes 
> to Python (2.5 I'm guessing) broke it. I've checked with Jean Paul 
> Calderone re including his fixes and he has agreed. I've also added 
> automatic conversion to either text format or callgrind format based on 
> the filename given to --lsprof-file and enhanced HACKING to include some 
> doc on how to get at the profiling data.
> 
> Ian C.


A few things..

I'm not convinced that doing it magically is the right thing to do...
but if we do, surely the endswith test should be for '.txt' not 'txt'
etc?

I think the logic for what to add to the output file should not be in
the UI layer; that should be a helper function or something in the
lsprof module so that it can be tested directly and reused.

Its a shame about needing to do isinstance, that would seem to be a
defect in the lsprof internals? Perhaps a note in the code about what is
being achieved by the isinstance calls ? e.g.

# where isinstance(code, str) is used it is to determine if the code 
# object is actually a code object and thus has a filename and other
# details we can print, or if its just a string and as such we can only
# print its str() representation.

I think we are trying to split HACKING into more smaller pieces. Perhaps
you could add this to the developers index and give it its own file?

+1 with these points addressed (either by telling me I'm wrong, or
changing things :).

-Rob



-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070530/d0a97c2f/attachment.pgp 


More information about the bazaar mailing list