[MERGE] lsprof branch
Robey Pointer
robey at lag.net
Thu Jun 22 19:24:05 BST 2006
On 20 Jun 2006, at 11:49, John Arbash Meinel wrote:
> Robey Pointer wrote:
>>
>> On 19 Jun 2006, at 21:15, John Arbash Meinel wrote:
>>
>>> So I figured I would use '--lsprof-file' to generate a pickle,
>>> and then
>>> read that back in.
>>>
>>> But with the latest bzr.dev I have the problem that cPickle fails,
>>> because it can't serialize a 'code'.
>>>
>>> bzr: ERROR: cPickle.PicklingError: Can't pickle <type 'code'>:
>>> attribute
>>> lookup __builtin__.code failed
>>> at /home/jameinel/dev/bzr/bzr.dev/bzrlib/commands.py line 537
>>> in apply_lsprofiled
>>>
>>> Now, I can see in 'Stats' that the method 'freeze()' claims to
>>> convert
>>> 'code' entries into string descriptions.
>>>
>>> This patch seems to fix it for me:
>>
>> [snip] This code is from the original lsprof, but from scanning
>> the code
>> in your patch, I think the original indentation is correct. It
>> seems to
>> be a really arcane way of doing string conversion on the fields.
>>
>> What command did you lsprof? I just tried it on "bzr info" and it
>> worked here, so maybe a particular command is tickling it.
>>
>
> The original indentation doesn't collapse code to strings for children
> if e.code is already a string.
>
> bzr --lsprof --lsprof-file ,,foo root
>
> Caused it to happen every time. It also happens for 'bzr info' for me.
> It might depend on the python version that you are using.
> Why do you feel the original indenting is correct?
Yeah, 'root' works for me too. I'm using python 2.4.3.
It just looked to me like the function was trying to only alter
self.data[] elements that hadn't already been converted to strings.
The current indentation doesn't even check self.data[].calls[] if the
self.data[] element was already stringified.
But:
> Looking at my svn branch of lsprof.py, it has the indenting that I
> switched to. Where 'if e.calls' is on the same level as 'if not
> isinstance'. That was the major difference between the bzr one and the
> lsprof.py one.
If this is what the lsprof maintainer did, then they must have a
reason, so we should probably do it too. I just tried it and it
seems to work fine.
I wonder if there are any other changes they've made?
> I think we can leave in ddaa's patch. The indentation bug existed
> before
> his patch. We can have someone else try and get calltree output if you
> don't feel like messing with it.
Even better would be finding out what's the gtk equivalent of that
kde app. :)
robey
More information about the bazaar
mailing list