feat: cool profiler thingy

This commit is contained in:
Piotr Wilkin
2026-03-29 01:14:09 +01:00
parent 05e141a6b3
commit 3492073424
21 changed files with 2021 additions and 46 deletions

View File

@@ -252,6 +252,23 @@ int main(int argc, char ** argv) {
return 1;
}
// Export profiling data if profiling was enabled
if (params.profiling) {
ggml_backend_sched_t sched = llama_context_get_sched(ctx);
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) {
LOG("\nProfiling data exported to: %s\n", params.profiling_output.c_str());
} else {
LOG_ERR("\nFailed to export profiling data to: %s\n", params.profiling_output.c_str());
}
}
}
}
LOG("\n");
llama_perf_context_print(ctx);