| 1493 | } |
| 1494 | |
| 1495 | std::string |
| 1496 | HGraph::GetMemoryUsageDetail() const { |
| 1497 | JsonType memory_usage; |
| 1498 | if (this->ignore_reorder_) { |
| 1499 | this->use_reorder_ = false; |
| 1500 | } |
| 1501 | memory_usage["basic_flatten_codes"].SetInt(this->basic_flatten_codes_->CalcSerializeSize()); |
| 1502 | memory_usage["bottom_graph"].SetInt(this->bottom_graph_->CalcSerializeSize()); |
| 1503 | if (this->use_reorder_) { |
| 1504 | memory_usage["high_precise_codes"].SetInt(this->high_precise_codes_->CalcSerializeSize()); |
| 1505 | } |
| 1506 | size_t route_graph_size = 0; |
| 1507 | for (const auto& route_graph : this->route_graphs_) { |
| 1508 | route_graph_size += route_graph->CalcSerializeSize(); |
| 1509 | } |
| 1510 | memory_usage["route_graph"].SetInt(route_graph_size); |
| 1511 | if (this->extra_info_size_ > 0 && this->extra_infos_ != nullptr) { |
| 1512 | memory_usage["extra_infos"].SetInt(this->extra_infos_->CalcSerializeSize()); |
| 1513 | } |
| 1514 | memory_usage["__total_size__"].SetInt(this->CalSerializeSize()); |
| 1515 | return memory_usage.Dump(); |
| 1516 | } |
| 1517 | |
| 1518 | float |
| 1519 | HGraph::CalcDistanceById(const float* query, int64_t id) const { |