From 4f47b5f7a9ad9f1116563b97593f996f2a5bf9ef Mon Sep 17 00:00:00 2001 From: "yudong.cai" Date: Thu, 18 Jul 2019 10:27:33 +0800 Subject: [PATCH] MS-248 support Milvus profiling, bug fix Former-commit-id: 2375531ff984f2a30f6dd20c2189d469b6922117 --- cpp/CMakeLists.txt | 10 +++++----- cpp/src/server/RequestTask.cpp | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 0bbb0ef8..07b47197 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -116,6 +116,11 @@ set(MILVUS_ENGINE_SRC ${PROJECT_SOURCE_DIR}/src) add_compile_definitions(PROFILER=${PROFILER}) +message("MILVUS_ENABLE_PROFILING = ${MILVUS_ENABLE_PROFILING}") +if (MILVUS_ENABLE_PROFILING STREQUAL "ON") + ADD_DEFINITIONS(-DMILVUS_ENABLE_PROFILING) +endif() + include_directories(${MILVUS_ENGINE_INCLUDE}) include_directories(${MILVUS_ENGINE_SRC}) @@ -141,11 +146,6 @@ endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf/server_config.template ${CMAKE_CURRENT_SOURCE_DIR}/conf/server_config.yaml) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf/log_config.template ${CMAKE_CURRENT_SOURCE_DIR}/conf/log_config.conf) -message("MILVUS_ENABLE_PROFILING = ${MILVUS_ENABLE_PROFILING}") -if (MILVUS_ENABLE_PROFILING STREQUAL "ON") - ADD_DEFINITIONS(-DMILVUS_ENABLE_PROFILING) -endif() - #install install(DIRECTORY scripts/ DESTINATION scripts diff --git a/cpp/src/server/RequestTask.cpp b/cpp/src/server/RequestTask.cpp index adbde642..92467f27 100644 --- a/cpp/src/server/RequestTask.cpp +++ b/cpp/src/server/RequestTask.cpp @@ -420,11 +420,9 @@ ServerError AddVectorTask::OnExecute() { rc.Record("check validation"); #ifdef MILVUS_ENABLE_PROFILING - std::string fname = "/tmp/insert_" + std::to_string(this->record_array_.size()) + "_" + - GetCurrTimeStr() + ".profiling"; + std::string fname = "/tmp/insert_" + std::to_string(this->record_array_.size()) + + "_" + GetCurrTimeStr() + ".profiling"; ProfilerStart(fname.c_str()); -#else - std::cout << "CYD - MILVUS_ENABLE_PROFILING is OFF!" << std::endl; #endif //step 3: prepare float data @@ -533,8 +531,8 @@ ServerError SearchVectorTask::OnExecute() { rc.Record("check validation"); #ifdef MILVUS_ENABLE_PROFILING - std::string fname = "/tmp/search_nq_" + std::to_string(this->record_array_.size()) + "_" + - "top_" + std::to_string(this->top_k_) + "_" + + std::string fname = "/tmp/search_nq_" + std::to_string(this->record_array_.size()) + + "_top_" + std::to_string(this->top_k_) + "_" + GetCurrTimeStr() + ".profiling"; ProfilerStart(fname.c_str()); #endif -- GitLab