38 #include <boost/algorithm/string.hpp>
46 parse_measurement(measurement, len);
50 vector<String> splits;
53 version = atoi(splits[0].c_str());
56 if (splits.size() != 11)
58 format(
"Measurement string '%s' has %d components, expected 11.",
59 str.c_str(), (int)splits.size()));
61 else if (version == 3) {
62 if (splits.size() != 12)
64 format(
"Measurement string '%s' has %d components, expected 12.",
65 str.c_str(), (int)splits.size()));
69 format(
"ServerMetrics version=%d expected 2", (
int)version));
73 timestamp = strtoll(splits[i++].c_str(), 0, 0);
74 disk_used = strtoll(splits[i++].c_str(), 0, 0);
75 memory_used = strtoll(splits[i++].c_str(), 0, 0);
77 compression_ratio = strtod(splits[i++].c_str(), 0);
78 disk_byte_read_rate = strtod(splits[i++].c_str(), 0);
79 byte_write_rate = strtod(splits[i++].c_str(), 0);
80 byte_read_rate = strtod(splits[i++].c_str(), 0);
81 update_rate = strtod(splits[i++].c_str(), 0);
82 scan_rate = strtod(splits[i++].c_str(), 0);
83 cell_write_rate = strtod(splits[i++].c_str(), 0);
84 cell_read_rate = strtod(splits[i++].c_str(), 0);
89 : m_server_id(server_id), m_table_id(table_id), m_end_row(end_row), m_start_row_set(false),
90 m_last_move_set(false) {
static const char * METADATA_ID
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.
Declarations for TableIdentifier and TableIdentifierManaged.
Po::typed_value< String > * str(String *v=0)
Declarations for RangeMetrics.
Logging routines and macros.
Compatibility Macros for C/C++.
void parse_measurement(const char *measurement, size_t len)
RangeMetrics(const char *server, const char *table_id, const char *end_row)
void add_measurement(const char *measurement, size_t len)
Single range metrics measurement.
bool split(int flags)
Tests the SPLIT bit of flags
This is a generic exception class for Hypertable.
static const char * END_ROOT_ROW
void set_last_move(const char *move, size_t len)
String extensions and helpers: sets, maps, append operators etc.
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
std::vector< RangeMeasurement > m_measurements
int code() const
Returns the error code.