feat: cool profiler thingy

This commit is contained in:
Piotr Wilkin
2026-03-29 01:14:09 +01:00
parent 31e82494c0
commit 893aa72363
21 changed files with 2020 additions and 45 deletions
+17
View File
@@ -649,6 +649,23 @@ int llama_cli(int argc, char ** argv) {
ctx_cli.ctx_server.terminate();
inference_thread.join();
// Export profiling data if profiling was enabled
if (params.profiling) {
ggml_backend_sched_t sched = llama_context_get_sched(ctx_cli.ctx_server.get_llama_context());
if (sched != nullptr) {
if (params.profiling_output.empty()) {
ggml_backend_sched_print_profiling(sched);
} else {
int ret = ggml_backend_sched_export_profiling_json(sched, params.profiling_output.c_str());
if (ret == 0) {
console::log("\nProfiling data exported to: %s\n", params.profiling_output.c_str());
} else {
console::error("\nFailed to export profiling data to: %s\n", params.profiling_output.c_str());
}
}
}
}
// bump the log level to display timings
common_log_set_verbosity_thold(LOG_LEVEL_INFO);
common_memory_breakdown_print(ctx_cli.ctx_server.get_llama_context());