extract_performance function

Internal function to extract performance metrics.