[MERGE] add stracing of specific functions support
John Arbash Meinel
john at arbash-meinel.com
Mon Mar 26 15:13:36 BST 2007
Robert Collins wrote:
> On Fri, 2007-03-23 at 09:18 -0500, John Arbash Meinel wrote:
>
>
>>> +import os
>>> +import signal
>>> +import subprocess
>>> +import tempfile
>>> +
>> v- Is this test focused? Or is it going to be something like "bzr
>> --lsprof command" ?
>
> At the moment its complete; it can be hooked in by a developer to
> analyse any particular function that is suspected of bad syscall
> behaviour, or whatever.
>
>>> +# this is currently test-focused, so importing bzrlib.tests is ok. We might
>>> +# want to move feature to its own module though.
>>> +from bzrlib.tests import Feature
>> -- Extra space here
>
> Huh? 2 spaces between top level items.
Correct. And I only see 1 space.
> +import tempfile
> +
> +# this is currently test-focused, so importing bzrlib.tests is ok. We might
> +# want to move feature to its own module though.
> +from bzrlib.tests import Feature
> +
> +def strace(function, *args, **kwargs):
^ You have 1 space between tempfile and 'from bzrlib' which is correct,
but you only have 1 space between "from bzrlib" and "def strace"
...
> Hmm. I dont really like this. We can pass the callable result back if
> you like, I don't object to that, but catching all exceptions like so -
> blech. If we pass the result back it should be
> return result, StraceResult(log)
> because thats the style our lsprof wrapper returns in.
>
>> I'm pretty strong on being able to get the return value of the function,
>> not so much about the exception. And I'm otherwise +1 on having this
>> included.
>
> Rob
>
Well, sometimes the thing you want to trace is raising an exception.
What *I've* wanted to do with lsprof is be able to run maybe 10
iterations and then stop, but there isn't really a good way to do that
(since the exception causes .profile() to not return).
As I said, I'm not stuck on the exception grabbing. But it could really
be nice if there were a way to do it. As you may be trying to use strace
to figure out why an exception is being raised. I agree that it is ugly,
so I wouldn't require it. I just don't see a better way.
John
=:->
More information about the bazaar
mailing list