Added instrumentation to monitor resource usage.