fix wall clock timing

This commit is contained in:
Dhanji Prasanna
2025-10-17 10:36:21 +11:00
parent e42c76f3b9
commit aa7eda0331

View File

@@ -1181,7 +1181,6 @@ The tool will execute immediately and you'll receive the result (success or erro
let mut full_response = String::new(); let mut full_response = String::new();
let mut first_token_time: Option<Duration> = None; let mut first_token_time: Option<Duration> = None;
let stream_start = Instant::now(); let stream_start = Instant::now();
let mut total_execution_time = Duration::new(0, 0);
let mut iteration_count = 0; let mut iteration_count = 0;
const MAX_ITERATIONS: usize = 400; // Prevent infinite loops const MAX_ITERATIONS: usize = 400; // Prevent infinite loops
let mut response_started = false; let mut response_started = false;
@@ -1546,7 +1545,6 @@ The tool will execute immediately and you'll receive the result (success or erro
} }
}; };
let exec_duration = exec_start.elapsed(); let exec_duration = exec_start.elapsed();
total_execution_time += exec_duration;
// Track tool call metrics // Track tool call metrics
let tool_success = !tool_result.contains(""); let tool_success = !tool_result.contains("");
@@ -1606,7 +1604,7 @@ The tool will execute immediately and you'll receive the result (success or erro
format!( format!(
"{}\n\n🕝 {} | 💭 {}", "{}\n\n🕝 {} | 💭 {}",
full_response, full_response,
Self::format_duration(total_execution_time), Self::format_duration(stream_start.elapsed()),
Self::format_duration(_ttft) Self::format_duration(_ttft)
) )
} else { } else {
@@ -1864,7 +1862,7 @@ The tool will execute immediately and you'll receive the result (success or erro
format!( format!(
"{}\n\n⏱️ {} | 💭 {}", "{}\n\n⏱️ {} | 💭 {}",
full_response, full_response,
Self::format_duration(total_execution_time), Self::format_duration(stream_start.elapsed()),
Self::format_duration(_ttft) Self::format_duration(_ttft)
) )
} else { } else {
@@ -1956,7 +1954,7 @@ The tool will execute immediately and you'll receive the result (success or erro
format!( format!(
"{}\n\n⏱️ {} | 💭 {}", "{}\n\n⏱️ {} | 💭 {}",
full_response, full_response,
Self::format_duration(total_execution_time), Self::format_duration(stream_start.elapsed()),
Self::format_duration(_ttft) Self::format_duration(_ttft)
) )
} else { } else {
@@ -1977,7 +1975,7 @@ The tool will execute immediately and you'll receive the result (success or erro
format!( format!(
"{}\n\n⏱️ {} | 💭 {}", "{}\n\n⏱️ {} | 💭 {}",
full_response, full_response,
Self::format_duration(total_execution_time), Self::format_duration(stream_start.elapsed()),
Self::format_duration(_ttft) Self::format_duration(_ttft)
) )
} else { } else {