From 15706508f997160ec52012d39a4661c54cc5e506 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Tue, 2 Apr 2019 16:38:40 +0800 Subject: [PATCH] Fix press test case --- sdk-cpp/demo/text_classification_press.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sdk-cpp/demo/text_classification_press.cpp b/sdk-cpp/demo/text_classification_press.cpp index d258dc8f..e71bb18b 100644 --- a/sdk-cpp/demo/text_classification_press.cpp +++ b/sdk-cpp/demo/text_classification_press.cpp @@ -205,7 +205,7 @@ void thread_worker(PredictorApi *api, int thread_id) { } g_concurrency++; #if 1 - LOG(INFO) << "Currenent concurrency " << g_concurrency.load(); + LOG(INFO) << "Current concurrency " << g_concurrency.load(); #endif timeval start; @@ -228,9 +228,6 @@ void thread_worker(PredictorApi *api, int thread_id) { #if 1 LOG(INFO) << "Done. Current concurrency " << g_concurrency.load(); #endif - - // res will be returned in callback - usleep(50); } // while (true) std::vector *truth_label = local_feed->get_labels(); @@ -248,7 +245,7 @@ int main(int argc, char **argv) { PredictorApi api; - // initialize logger instance +// initialize logger instance #ifdef BCLOUD logging::LoggingSettings settings; settings.logging_dest = logging::LOG_TO_FILE; @@ -343,11 +340,11 @@ int main(int argc, char **argv) { LOG(INFO) << "Total requests: " << round_times.size(); LOG(INFO) << "Max concurrency: " << FLAGS_concurrency; - LOG(INFO) << "Elapse ms (wall-time): " << elapse_ms; + LOG(INFO) << "Total ms (absolute time): " << total_ms / FLAGS_concurrency; double qps = 0.0; if (elapse_ms != 0) { - qps = (static_cast(count) / elapse_ms) * 1000; + qps = (static_cast(count) / (total_ms / FLAGS_concurrency)) * 1000; } LOG(INFO) << "QPS: " << qps / FLAGS_batch_size << "/s"; @@ -355,7 +352,8 @@ int main(int argc, char **argv) { LOG(INFO) << "Latency statistics: "; if (round_times.size() != 0) { - LOG(INFO) << "Average ms: " << total_ms / round_times.size(); + LOG(INFO) << "Average ms: " + << static_cast(total_ms) / round_times.size(); LOG(INFO) << "50 percent ms: " << round_times[percent_pos_50]; LOG(INFO) << "80 percent ms: " << round_times[percent_pos_80]; LOG(INFO) << "90 percent ms: " << round_times[percent_pos_90]; -- GitLab