add profiling

Former-commit-id: df257a19fb3976072733b6933759358d7e5c6abb
pull/191/head
Yu Kun 2019-09-06 11:20:05 +08:00
parent 96d580ab41
commit ba0640dbf8
4 changed files with 16 additions and 16 deletions

View File

@ -96,6 +96,8 @@ define_option(MILVUS_WITH_ZLIB "Build with zlib compression" ON)
define_option(MILVUS_WITH_KNOWHERE "Build with Knowhere" OFF)
define_option(MILVUS_ENABLE_PROFILING "Build with profiling" ON)
if(CMAKE_VERSION VERSION_LESS 3.7)
set(MILVUS_WITH_ZSTD_DEFAULT OFF)
else()

View File

@ -10,7 +10,7 @@ namespace zilliz {
namespace milvus {
namespace engine {
constexpr uint64_t MAXINT = 99999;
constexpr uint64_t MAXINT = std::numeric_limits<uint32_t >::max();
uint64_t
ShortestPath(const ResourcePtr &src,

View File

@ -24,6 +24,7 @@ StartSchedulerService() {
try {
server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE);
//TODO: change const char * to standard
if (config.GetChildren().empty()) throw "resource_config null exception";
auto resources = config.GetChild(server::CONFIG_RESOURCES).GetChildren();

View File

@ -14,6 +14,7 @@
#include "GrpcMilvusServer.h"
#include "db/Utils.h"
#include "scheduler/SchedInst.h"
#include <gperftools/profiler.h>
#include "src/server/Server.h"
@ -473,8 +474,7 @@ InsertTask::OnExecute() {
rc.RecordSection("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->insert_param_->row_record_array_size()) + ".profiling";
ProfilerStart(fname.c_str());
#endif
@ -625,12 +625,6 @@ SearchTask::OnExecute() {
double span_check = rc.RecordSection("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_) + "_" +
GetCurrTimeStr() + ".profiling";
ProfilerStart(fname.c_str());
#endif
//step 5: prepare float data
auto record_array_size = search_param_->query_record_array_size();
@ -657,6 +651,11 @@ SearchTask::OnExecute() {
engine::QueryResults results;
auto record_count = (uint64_t) search_param_->query_record_array().size();
#ifdef MILVUS_ENABLE_PROFILING
std::string fname = "/tmp/search_nq_" + std::to_string(this->search_param_->query_record_array_size()) + ".profiling";
ProfilerStart(fname.c_str());
#endif
if (file_id_array_.empty()) {
stat = DBWrapper::DB()->Query(table_name_, (size_t) top_k, record_count, nprobe, vec_f.data(),
dates, results);
@ -665,6 +664,10 @@ SearchTask::OnExecute() {
record_count, nprobe, vec_f.data(), dates, results);
}
#ifdef MILVUS_ENABLE_PROFILING
ProfilerStop();
#endif
rc.ElapseFromBegin("search vectors from engine");
if (!stat.ok()) {
return SetError(DB_META_TRANSACTION_FAILED, stat.ToString());
@ -692,10 +695,6 @@ SearchTask::OnExecute() {
}
}
#ifdef MILVUS_ENABLE_PROFILING
ProfilerStop();
#endif
//step 8: print time cost percent
double span_result = rc.RecordSection("construct result");
rc.ElapseFromBegin("totally cost");
@ -832,9 +831,7 @@ DeleteByRangeTask::OnExecute() {
}
#ifdef MILVUS_ENABLE_PROFILING
std::string fname = "/tmp/search_nq_" + std::to_string(this->record_array_.size()) +
"_top_" + std::to_string(this->top_k_) + "_" +
GetCurrTimeStr() + ".profiling";
std::string fname = "/tmp/search_nq_" + this->delete_by_range_param_->table_name() + ".profiling";
ProfilerStart(fname.c_str());
#endif
engine::Status status = DBWrapper::DB()->DeleteTable(table_name, dates);