提交 f5628949 编写于 作者: Y Yu Kun

remove some ref


Former-commit-id: 052bf2dd4cd3e5832fb8c284511bdde1919bf9bb
上级 1503673a
......@@ -116,13 +116,12 @@ Status ExecutionEngineImpl::Serialize() {
}
Status ExecutionEngineImpl::Load(bool to_cache) {
double physical_size;
server::CollectExecutionEngineMetrics metrics(physical_size);
index_ = zilliz::milvus::cache::CpuCacheMgr::GetInstance()->GetIndex(location_);
bool already_in_cache = (index_ != nullptr);
if (!index_) {
try {
double physical_size = PhysicalSize();
server::CollectExecutionEngineMetrics metrics(physical_size);
index_ = read_index(location_);
ENGINE_LOG_DEBUG << "Disk io from: " << location_;
} catch (knowhere::KnowhereException &e) {
......@@ -135,14 +134,11 @@ Status ExecutionEngineImpl::Load(bool to_cache) {
if (!already_in_cache && to_cache) {
Cache();
physical_size = PhysicalSize();
}
return Status::OK();
}
Status ExecutionEngineImpl::CopyToGpu(uint64_t device_id) {
double physical_size;
server::CollectExecutionEngineMetrics metrics(physical_size);
index_ = zilliz::milvus::cache::GpuCacheMgr::GetInstance(device_id)->GetIndex(location_);
bool already_in_cache = (index_ != nullptr);
if (!index_) {
......@@ -159,15 +155,12 @@ Status ExecutionEngineImpl::CopyToGpu(uint64_t device_id) {
if (!already_in_cache) {
GpuCache(device_id);
physical_size = PhysicalSize();
}
return Status::OK();
}
Status ExecutionEngineImpl::CopyToCpu() {
double physical_size;
server::CollectExecutionEngineMetrics metrics(physical_size);
index_ = zilliz::milvus::cache::CpuCacheMgr::GetInstance()->GetIndex(location_);
bool already_in_cache = (index_ != nullptr);
if (!index_) {
......@@ -184,7 +177,6 @@ Status ExecutionEngineImpl::CopyToCpu() {
if(!already_in_cache) {
Cache();
physical_size = PhysicalSize();
}
return Status::OK();
}
......@@ -198,6 +190,8 @@ Status ExecutionEngineImpl::Merge(const std::string &location) {
auto to_merge = zilliz::milvus::cache::CpuCacheMgr::GetInstance()->GetIndex(location);
if (!to_merge) {
try {
double physical_size = server::CommonUtil::GetFileSize(location);
server::CollectExecutionEngineMetrics metrics(physical_size);
to_merge = read_index(location);
} catch (knowhere::KnowhereException &e) {
ENGINE_LOG_ERROR << e.what();
......
......@@ -80,12 +80,10 @@ bool MemTableFile::IsFull() {
}
Status MemTableFile::Serialize() {
size_t size;
size_t size = GetCurrentMem();
server::CollectSerializeMetrics metrics(size);
size = GetCurrentMem();
execution_engine_->Serialize();
table_file_schema_.file_size_ = execution_engine_->PhysicalSize();
table_file_schema_.row_count_ = execution_engine_->Count();
......
......@@ -120,7 +120,7 @@ private:
class CollectExecutionEngineMetrics {
public:
CollectExecutionEngineMetrics(double& physical_size) : physical_size_(physical_size) {
CollectExecutionEngineMetrics(double physical_size) : physical_size_(physical_size) {
start_time_ = METRICS_NOW_TIME;
}
......@@ -137,12 +137,12 @@ public:
private:
using TIME_POINT = std::chrono::system_clock::time_point;
TIME_POINT start_time_;
double& physical_size_;
double physical_size_;
};
class CollectSerializeMetrics {
public:
CollectSerializeMetrics(size_t& size) : size_(size) {
CollectSerializeMetrics(size_t size) : size_(size) {
start_time_ = METRICS_NOW_TIME;
}
......@@ -154,7 +154,7 @@ public:
private:
using TIME_POINT = std::chrono::system_clock::time_point;
TIME_POINT start_time_;
size_t& size_;
size_t size_;
};
class CollectorAddMetrics {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册