| 755 | } |
| 756 | |
| 757 | void TabletNodeSysInfo::CollectHardwareInfo() { |
| 758 | MutexLock lock(&mutex_); |
| 759 | if (!info_.unique()) { |
| 760 | SwitchInfo(); |
| 761 | } |
| 762 | assert(info_.unique()); |
| 763 | std::shared_ptr<CollectorReport> latest_report = |
| 764 | CollectorReportPublisher::GetInstance().GetCollectorReport(); |
| 765 | |
| 766 | int64_t cpu_usage = latest_report->FindMetricValue(kInstCpuMetricName); |
| 767 | info_->set_cpu_usage(static_cast<float>(cpu_usage)); |
| 768 | |
| 769 | int64_t mem_usage = latest_report->FindMetricValue(kInstMemMetricName); |
| 770 | info_->set_mem_used(mem_usage); |
| 771 | |
| 772 | int64_t net_rx_usage = latest_report->FindMetricValue(kInstNetRXMetricName); |
| 773 | info_->set_net_rx(net_rx_usage); |
| 774 | |
| 775 | int64_t net_tx_usage = latest_report->FindMetricValue(kInstNetTXMetricName); |
| 776 | info_->set_net_tx(net_tx_usage); |
| 777 | } |
| 778 | |
| 779 | void TabletNodeSysInfo::GetTabletNodeInfo(TabletNodeInfo* info) { |
| 780 | MutexLock lock(&mutex_); |
no test coverage detected