| 308 | } |
| 309 | |
| 310 | void Metrics::parse(const std::string& json) { |
| 311 | success = json_bool(json, "success", false); |
| 312 | error = json_string(json, "error"); |
| 313 | cloud_handoff = json_bool(json, "cloud_handoff", false); |
| 314 | response = json_string(json, "response"); |
| 315 | thinking = json_string(json, "thinking"); |
| 316 | function_calls = json_array(json, "function_calls"); |
| 317 | confidence = json_number(json, "confidence", -1.0); |
| 318 | ttft = json_number(json, "time_to_first_token_ms"); |
| 319 | total_ms = json_number(json, "total_time_ms"); |
| 320 | prefill_tps = json_number(json, "prefill_tps"); |
| 321 | decode_tps = json_number(json, "decode_tps"); |
| 322 | ram_mb = json_number(json, "ram_usage_mb"); |
| 323 | prefill_tokens = json_number(json, "prefill_tokens"); |
| 324 | completion_tokens = json_number(json, "decode_tokens"); |
| 325 | total_tokens = json_number(json, "total_tokens"); |
| 326 | segments = json_array(json, "segments"); |
| 327 | } |
| 328 | |
| 329 | void Metrics::print_json() const { |
| 330 | std::cout << " \"success\": " << (success ? "true" : "false") << ",\n" |
no test coverage detected