From 646edfbd91008d22ae59807ea0209f26cbb57871 Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 08 三月 2023 10:50:18 +0800
Subject: [PATCH] Merge pull request #193 from RapidAI/main

---
 funasr/runtime/onnxruntime/tester/tester.cpp |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/funasr/runtime/onnxruntime/tester/tester.cpp b/funasr/runtime/onnxruntime/tester/tester.cpp
index 21b783f..b9a85b7 100644
--- a/funasr/runtime/onnxruntime/tester/tester.cpp
+++ b/funasr/runtime/onnxruntime/tester/tester.cpp
@@ -34,21 +34,24 @@
 
     gettimeofday(&end, NULL);
     long seconds = (end.tv_sec - start.tv_sec);
-    long micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
-    printf("Model initialization takes %lfs.\n", (double)micros / 1000000);
+    long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
+    printf("Model initialization takes %lfs.\n", (double)modle_init_micros / 1000000);
 
-    setbuf(stdout, NULL);
-    cout << "Result: \"";
+
+
     gettimeofday(&start, NULL);
 
     RPASR_RESULT Result=RapidAsrRecogPCMFile(AsrHanlde, argv[2], RASR_NONE, NULL);
     gettimeofday(&end, NULL);
-
+    float snippet_time = 0.0f;
     if (Result)
     {
         string msg = RapidAsrGetResult(Result, 0);
+        setbuf(stdout, NULL);
+        cout << "Result: \"";
         cout << msg << endl;
         cout << "\"." << endl;
+        snippet_time = RapidAsrGetRetSnippetTime(Result);
         RapidAsrFreeResult(Result);
     }
     else
@@ -56,11 +59,13 @@
         cout <<("no return data!");
     }
   
+    printf("Audio length %lfs.\n", (double)snippet_time);
+
     seconds = (end.tv_sec - start.tv_sec);
     long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
-    printf("Model inference takes %lfs.\n", (double)micros / 1000000);
+    printf("Model inference takes %lfs.\n", (double)taking_micros / 1000000);
 
-    printf("Model inference RTF: %04lf.\n", (double)taking_micros/micros );
+    printf("Model inference RTF: %04lf.\n", (double)taking_micros/ (snippet_time*1000000));
 
     RapidAsrUninit(AsrHanlde);
 

--
Gitblit v1.9.1