MCPcopy Create free account
hub / github.com/apache/impala / ComputeNetworkUsage

Method ComputeNetworkUsage

be/src/util/system-state-info.cc:207–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void SystemStateInfo::ComputeNetworkUsage(int64_t period_ms) {
208 if (period_ms <= 0) return;
209 // Compute network throughput in bytes per second
210 const NetworkValues& cur = network_values_[net_val_idx_];
211 const NetworkValues& old = network_values_[1 - net_val_idx_];
212 int64_t rx_bytes = cur[NET_RX_BYTES] - old[NET_RX_BYTES];
213 network_usage_.rx_rate.Store(rx_bytes * 1000L / period_ms);
214
215 int64_t tx_bytes = cur[NET_TX_BYTES] - old[NET_TX_BYTES];
216 network_usage_.tx_rate.Store(tx_bytes * 1000L / period_ms);
217}
218
219void SystemStateInfo::ReadCurrentProcDiskStats() {
220 string path = "/proc/diskstats";

Callers 1

TEST_FFunction · 0.80

Calls 1

StoreMethod · 0.45

Tested by 1

TEST_FFunction · 0.64