Factor out the resource usage tracking out to a separate object, which can be passed around and copied independently of the logcontext itself.