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

Function ReadIntArray

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

Source from the content-addressed store, hash-verified

53
54template <class T>
55void ReadIntArray(const StringPiece& sp, int expected_num_values, T* out) {
56 vector<StringPiece> counters = Split(sp, " ", SkipWhitespace());
57
58 // Something is wrong with the number of values that we read
59 if (expected_num_values > counters.size()) {
60 memset(out, 0, sizeof(*out));
61 KLOG_EVERY_N_SECS(WARNING, 60) << "Failed to parse enough values: expected "
62 << expected_num_values << " but found " << counters.size() << ". Input was: "
63 << sp;
64 return;
65 }
66
67 for (int i = 0; i < expected_num_values; ++i) {
68 int64_t* v = &(*out)[i];
69 if (!safe_strto64(counters[i].as_string(), v)) {
70 KLOG_EVERY_N_SECS(WARNING, 60) << "Failed to parse value: " << *v;
71 *v = 0;
72 }
73 DCHECK_GE(*v, 0) << "Value " << i << ": " << *v;
74 }
75}
76} // anonymous namespace
77
78namespace impala {

Callers 3

ReadProcStatStringMethod · 0.85
ReadProcNetDevLineMethod · 0.85
ReadProcDiskStatsLineMethod · 0.85

Calls 5

SplitFunction · 0.85
SkipWhitespaceClass · 0.85
safe_strto64Function · 0.85
as_stringMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected