33 #include <boost/algorithm/string.hpp>
41 parse_measurement(measurement, len);
45 vector<String> splits;
49 version = atoi(splits[0].c_str());
51 if (splits.size() != 12)
53 format(
"Measurement string '%s' has %d components, expected 12.",
54 str.c_str(), (int)splits.size()));
56 else if (version == 3) {
57 if (splits.size() != 14)
59 format(
"Measurement string '%s' has %d components, expected 14.",
60 str.c_str(), (int)splits.size()));
64 format(
"ServerMetrics version=%d expected 2", (
int)version));
67 timestamp = strtoll(splits[1].c_str(), 0, 0);
68 loadavg = strtod(splits[2].c_str(), 0);
69 disk_bytes_read_rate = strtod(splits[3].c_str(), 0);
70 bytes_written_rate = strtod(splits[4].c_str(), 0);
71 bytes_scanned_rate = strtod(splits[5].c_str(), 0);
72 updates_rate = strtod(splits[6].c_str(), 0);
73 scans_rate = strtod(splits[7].c_str(), 0);
74 cells_written_rate = strtod(splits[8].c_str(), 0);
75 cells_scanned_rate = strtod(splits[9].c_str(), 0);
76 page_in = strtod(splits[10].c_str(), 0);
77 page_out = strtod(splits[11].c_str(), 0);
79 disk_total = strtoll(splits[12].c_str(), 0, 0);
80 disk_avail = strtoll(splits[13].c_str(), 0, 0);
87 m_measurements.push_back(sm);
std::string String
A String is simply a typedef to std::string.
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
Facilities for reading and writing sys/RS_METRICS table.
Po::typed_value< String > * str(String *v=0)
Declarations for ServerMetrics.
Logging routines and macros.
Compatibility Macros for C/C++.
void parse_measurement(const char *measurement, size_t len)
bool split(int flags)
Tests the SPLIT bit of flags
This is a generic exception class for Hypertable.
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
void add_measurement(const char *measurement, size_t len)
Single server metrics measurement.
int code() const
Returns the error code.