diff options
author | wbpxre150 <100937007+wbpxre150@users.noreply.github.com> | 2023-04-22 16:56:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-22 11:56:35 +0300 |
commit | 36b4f7e06406eed8a605cc9f2921d9244ef6a8e5 (patch) | |
tree | 06a364b6fdead7c76c4c7809270944bad952706b | |
parent | 10f19c1121068ce3dab9bece03a8b9caaea2db36 (diff) |
llama : print timings on ctrl+c exit (#1021)
* print timings on ctrl+c exit
* remove redundant free memory call.
* add global pointer to ctx.
-rw-r--r-- | examples/main/main.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 65db792..6d79a7e 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -25,6 +25,7 @@ #endif static console_state con_st; +static llama_context ** g_ctx; static bool is_interacting = false; @@ -36,6 +37,7 @@ void sigint_handler(int signo) { if (!is_interacting) { is_interacting=true; } else { + llama_print_timings(*g_ctx); _exit(130); } } @@ -92,8 +94,9 @@ int main(int argc, char ** argv) { // params.prompt = R"(// this function checks if the number n is prime //bool is_prime(int n) {)"; - + llama_context * ctx; + g_ctx = &ctx; // load the model { |