[MERGE] add stracing of specific functions support

Robert Collins robertc at robertcollins.net
Fri Mar 23 22:10:07 GMT 2007


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.

> > +
> > +def strace(function, *args, **kwargs):
> > +    """Invoke strace on function.
> > +
> > +    :return: A StraceResult.
> > +    """
> 
> Do you want to just return an StraceResult? It seems like it would be
> more useful to also return the return value of the function.
> 
> Also, I've found that it would be useful if we could give an --lsprof
> even if there is an exception raised. And I assume it would be the same
> here. So possibly we could do:

> return (StraceResult(log), result, exc)

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

-- 
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/20070324/65ace352/attachment-0001.pgp 


More information about the bazaar mailing list