40 double clocks_per_usec = (double)CLOCKS_PER_SEC / 1000000.0;
42 std::lock_guard<std::mutex> lock(m_state.mutex);
44 m_state.total_cells = 0;
45 m_state.total_bytes = 0;
46 m_state.cum_latency = 0;
47 m_state.cum_sq_latency = 0;
48 m_state.min_latency = 0;
49 m_state.max_latency = 0;
56 clock_t start_clocks, stop_clocks;
58 if (
has(
"query-delay"))
59 delay = get_i32(
"query-delay");
66 std::this_thread::sleep_for(std::chrono::milliseconds(delay));
70 scan_spec.
add_row((*iter).row_key);
72 start_clocks = clock();
76 while (scanner->
next(cell)) {
78 m_state.total_cells++;
79 m_state.total_bytes += strlen(cell.
row_key)
85 stop_clocks = clock();
86 if (stop_clocks < start_clocks)
87 latency += (int64_t)((
double)((std::numeric_limits<clock_t>::max() - start_clocks) + stop_clocks) / clocks_per_usec);
89 latency += (int64_t)((
double)(stop_clocks - start_clocks) / clocks_per_usec);
90 m_state.cum_latency += latency;
91 m_state.cum_sq_latency += ::pow(latency, 2);
92 if (latency < m_state.min_latency)
93 m_state.min_latency = latency;
94 if (latency > m_state.max_latency)
95 m_state.max_latency = latency;
103 m_state.elapsed_time = stopwatch.
elapsed();
double elapsed()
Returns the elapsed time.
ScanSpec & get()
Returns the built ScanSpec object.
void clear()
Clears the state.
void add_row(const string &str)
Adds a row to be returned in the scan.
bool has(const String &name)
Check existence of a configuration value.
bool next(Cell &cell)
Gets the next cell.
Compatibility Macros for C/C++.
Helper class for building a ScanSpec.
Synchronous table scanner.
void add_column(const string &str)
Adds a column family to be returned by the scan.
Provides an STL-style iterator on DataGenerator objects.
const char * column_family
The Stopwatch class measures elapsed time between instantiation (or a call to start) and a call to st...
This is a generic exception class for Hypertable.
Encapsulates decomposed key and value.