[RFC] test suite strace -c support

Robert Collins robertc at robertcollins.net
Wed Jun 14 14:13:50 BST 2006


I think it would be nice to have an option to the benchmark suite to do
'strace -c' on only the code in the 'self.time()' call. This can be
useful in clearly identifying what is involved in executing a small
piece of code without all the overhead of *getting to* the code to run.

I'm focused on integrating dirstate into a working tree at the moment
(the branch is 'dirstate' in the usual place) so I wont get to this
soon, but I thought I'd sketch it in the hope someone else will code it
up ;).

Heres how I think it might work - be sure to check strace man page, its
rather evil...

when the option is on:
rather than just calling the callable in TestCase.time():
fork()
in the parent, do a waitpid with WUNTRACED
then use subprocess to run strace -p PID
and send a SIGCONT to the child to resume it.
capture the output from strace, and show that like we show the lsprof
output now - use the same idioms for storing and showing it.
If the child process returns non-zero, raise an exception to indicate
some failure.


in the child process, send SIGSTOP to itself, then run the callable in a
try: except block. If it raises an exception, use sys._exit(1),
otherwise use sys._exit(0) - we deliberately do not want to run normal
cleanups here.


This clearly loses the return code from the timed call, but for this
specialist case I think that that is ok.

What do you all think?

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: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060614/20e74f5a/attachment.pgp 


More information about the bazaar mailing list