From a1ee3b4e47b70d1c059abc82e356d5c6706b3564 Mon Sep 17 00:00:00 2001 From: wbpxre150 Date: Mon, 17 Apr 2023 15:04:35 +0800 Subject: [PATCH] print timings on ctrl+c exit --- examples/main/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 3e4b0034e..56dc7afab 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -25,6 +25,7 @@ #endif static console_state con_st; +llama_context * ctx; static bool is_interacting = false; @@ -36,6 +37,8 @@ void sigint_handler(int signo) { if (!is_interacting) { is_interacting=true; } else { + llama_print_timings(ctx); + llama_free(ctx); _exit(130); } } @@ -93,8 +96,6 @@ 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; - // load the model { auto lparams = llama_context_default_params();