Tracing

Upstreaming some of @waywardmonkeys's stuff.  Bruce, should this get merged?