Added performance metric recording code.