google/tracing-framework — pull request #31 by benvanik (2012-12-03 23:32:18+00:00)
Title: Changing the generated event functions to be more efficient.

They now use captured closure variables instead of 'this' to get access
to global data structures (such as the current session). Since event
lifetime is a bit odd (independent of session lifetime, most created before
the TraceManager is around, and required at invocation time) there
are some hoops to jump through here, such as the 'session pointer' hack
to give the generated functions access to the current session pointer.

The overhead of each trace function call goes down by about 0.03ms with
this - about 4% (I think).