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