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

Method ReadProcNetDevString

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

Source from the content-addressed store, hash-verified

161}
162
163void SystemStateInfo::ReadProcNetDevString(const string& dev_string) {
164 net_val_idx_ = 1 - net_val_idx_;
165 DCHECK(net_val_idx_ == 0 || net_val_idx_ == 1) << "net_val_idx_: " << net_val_idx_;
166 NetworkValues& sum_values = network_values_[net_val_idx_];
167 memset(&sum_values, 0, sizeof(sum_values));
168
169 StringPiece sp(dev_string);
170 vector<StringPiece> lines = Split(sp, "\n", SkipWhitespace());
171 // The first two lines contain the header, skip them.
172 DCHECK_GT(lines.size(), 2);
173 for (int i = 2; i < lines.size(); ++i) {
174 const StringPiece& line = lines[i];
175 NetworkValues line_values;
176 ReadProcNetDevLine(line, &line_values);
177 AddNetworkValues(line_values, &sum_values);
178 }
179}
180
181void SystemStateInfo::ReadProcNetDevLine(
182 const StringPiece& dev_string, NetworkValues* result) {

Callers 1

TEST_FFunction · 0.80

Calls 3

SplitFunction · 0.85
SkipWhitespaceClass · 0.85
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.64