mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-05-13 12:34:05 +00:00
feat: cool profiler thingy
This commit is contained in:
@@ -644,6 +644,23 @@ int main(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());
|
||||
|
||||
Reference in New Issue
Block a user