@@ -150,23 +150,30 @@ void run_stats::set_end_time(struct timeval* end_time)
150
150
end_time = &tv;
151
151
}
152
152
m_end_time = *end_time;
153
+ summarize_current_second ();
153
154
m_stats.push_back (m_cur_stats);
154
155
}
155
156
157
+ void run_stats::summarize_current_second (){
158
+ m_cur_stats.m_get_cmd .summarize_quantiles (inst_m_get_latency_histogram,quantiles_list);
159
+ m_cur_stats.m_set_cmd .summarize_quantiles (inst_m_set_latency_histogram,quantiles_list);
160
+ m_cur_stats.m_wait_cmd .summarize_quantiles (inst_m_wait_latency_histogram,quantiles_list);
161
+ m_cur_stats.m_total_cmd .summarize_quantiles (inst_m_totals_latency_histogram,quantiles_list);
162
+ for (unsigned int i=0 ; i<m_cur_stats.m_ar_commands .size (); i++) {
163
+ m_cur_stats.m_ar_commands [i].summarize_quantiles (inst_m_ar_commands_latency_histograms[i],quantiles_list);
164
+ hdr_reset (inst_m_ar_commands_latency_histograms[i]);
165
+ }
166
+ hdr_reset (inst_m_get_latency_histogram);
167
+ hdr_reset (inst_m_set_latency_histogram);
168
+ hdr_reset (inst_m_wait_latency_histogram);
169
+ hdr_reset (inst_m_totals_latency_histogram);
170
+ }
171
+
156
172
void run_stats::roll_cur_stats (struct timeval * ts)
157
173
{
158
174
const unsigned int sec = ts_diff (m_start_time, *ts) / 1000000 ;
159
175
if (sec > m_cur_stats.m_second ) {
160
- m_cur_stats.m_get_cmd .summarize_quantiles (inst_m_get_latency_histogram,quantiles_list);
161
- m_cur_stats.m_set_cmd .summarize_quantiles (inst_m_set_latency_histogram,quantiles_list);
162
- m_cur_stats.m_wait_cmd .summarize_quantiles (inst_m_wait_latency_histogram,quantiles_list);
163
- for (unsigned int i=0 ; i<m_cur_stats.m_ar_commands .size (); i++) {
164
- m_cur_stats.m_ar_commands [i].summarize_quantiles (inst_m_ar_commands_latency_histograms[i],quantiles_list);
165
- hdr_reset (inst_m_ar_commands_latency_histograms[i]);
166
- }
167
- hdr_reset (inst_m_get_latency_histogram);
168
- hdr_reset (inst_m_set_latency_histogram);
169
- hdr_reset (inst_m_wait_latency_histogram);
176
+ summarize_current_second ();
170
177
m_stats.push_back (m_cur_stats);
171
178
m_cur_stats.reset (sec);
172
179
}
@@ -176,104 +183,134 @@ void run_stats::update_get_op(struct timeval* ts, unsigned int bytes_rx, unsigne
176
183
{
177
184
roll_cur_stats (ts);
178
185
m_cur_stats.m_get_cmd .update_op (bytes_rx, bytes_tx, latency, hits, misses);
186
+ m_cur_stats.m_total_cmd .update_op (bytes_rx, bytes_tx, latency, hits, misses);
179
187
m_totals.update_op (bytes_rx, bytes_tx, latency);
180
188
hdr_record_value (m_get_latency_histogram,latency);
181
189
hdr_record_value (inst_m_get_latency_histogram,latency);
190
+ hdr_record_value (m_totals_latency_histogram,latency);
191
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
182
192
}
183
193
184
194
void run_stats::update_set_op (struct timeval * ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency)
185
195
{
186
196
roll_cur_stats (ts);
187
197
188
198
m_cur_stats.m_set_cmd .update_op (bytes_rx, bytes_tx, latency);
199
+ m_cur_stats.m_total_cmd .update_op (bytes_rx, bytes_tx, latency);
189
200
m_totals.update_op (bytes_rx, bytes_tx, latency);
190
201
hdr_record_value (m_set_latency_histogram,latency);
191
202
hdr_record_value (inst_m_set_latency_histogram,latency);
203
+ hdr_record_value (m_totals_latency_histogram,latency);
204
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
192
205
}
193
206
194
207
void run_stats::update_moved_get_op (struct timeval * ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency)
195
208
{
196
209
roll_cur_stats (ts);
197
210
198
211
m_cur_stats.m_get_cmd .update_moved_op (bytes_rx, bytes_tx, latency);
212
+ m_cur_stats.m_total_cmd .update_op (bytes_rx, bytes_tx, latency);
199
213
m_totals.update_op (bytes_rx, bytes_tx, latency);
200
214
hdr_record_value (m_get_latency_histogram,latency);
201
215
hdr_record_value (inst_m_get_latency_histogram,latency);
216
+ hdr_record_value (m_totals_latency_histogram,latency);
217
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
202
218
}
203
219
204
220
void run_stats::update_moved_set_op (struct timeval * ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency)
205
221
{
206
222
roll_cur_stats (ts);
207
223
208
224
m_cur_stats.m_set_cmd .update_moved_op (bytes_rx, bytes_tx, latency);
225
+ m_cur_stats.m_total_cmd .update_moved_op (bytes_rx, bytes_tx, latency);
209
226
m_totals.update_op (bytes_rx, bytes_tx, latency);
210
227
hdr_record_value (m_set_latency_histogram,latency);
211
228
hdr_record_value (inst_m_set_latency_histogram,latency);
229
+ hdr_record_value (m_totals_latency_histogram,latency);
230
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
212
231
}
213
232
214
233
void run_stats::update_moved_arbitrary_op (struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx,
215
234
unsigned int latency, size_t request_index) {
216
235
roll_cur_stats (ts);
217
236
218
237
m_cur_stats.m_ar_commands .at (request_index).update_moved_op (bytes_rx, bytes_tx, latency);
238
+ m_cur_stats.m_total_cmd .update_op (bytes_rx, bytes_tx, latency);
219
239
m_totals.update_op (bytes_rx, bytes_tx, latency);
220
240
221
241
struct hdr_histogram * hist = m_ar_commands_latency_histograms.at (request_index);
222
242
hdr_record_value (hist,latency);
243
+ hdr_record_value (m_totals_latency_histogram,latency);
244
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
223
245
}
224
246
225
247
void run_stats::update_ask_get_op (struct timeval * ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency)
226
248
{
227
249
roll_cur_stats (ts);
228
250
229
251
m_cur_stats.m_get_cmd .update_ask_op (bytes_rx, bytes_tx, latency);
252
+ m_cur_stats.m_total_cmd .update_ask_op (bytes_rx, bytes_tx, latency);
230
253
m_totals.update_op (bytes_rx, bytes_tx, latency);
231
254
hdr_record_value (m_get_latency_histogram,latency);
232
255
hdr_record_value (inst_m_get_latency_histogram,latency);
256
+ hdr_record_value (m_totals_latency_histogram,latency);
257
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
233
258
}
234
259
235
260
void run_stats::update_ask_set_op (struct timeval * ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency)
236
261
{
237
262
roll_cur_stats (ts);
238
263
239
264
m_cur_stats.m_set_cmd .update_ask_op (bytes_rx, bytes_tx, latency);
265
+ m_cur_stats.m_total_cmd .update_ask_op (bytes_rx, bytes_tx, latency);
240
266
m_totals.update_op (bytes_rx, bytes_tx, latency);
241
267
hdr_record_value (m_set_latency_histogram,latency);
242
268
hdr_record_value (inst_m_set_latency_histogram,latency);
269
+ hdr_record_value (m_totals_latency_histogram,latency);
270
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
243
271
}
244
272
245
273
void run_stats::update_ask_arbitrary_op (struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx,
246
274
unsigned int latency, size_t request_index) {
247
275
roll_cur_stats (ts);
248
276
249
277
m_cur_stats.m_ar_commands .at (request_index).update_ask_op (bytes_rx, bytes_tx, latency);
278
+ m_cur_stats.m_total_cmd .update_ask_op (bytes_rx, bytes_tx, latency);
250
279
m_totals.update_op (bytes_rx, bytes_tx, latency);
251
280
252
281
struct hdr_histogram * hist = m_ar_commands_latency_histograms.at (request_index);
253
282
hdr_record_value (hist,latency);
283
+ hdr_record_value (m_totals_latency_histogram,latency);
284
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
254
285
}
255
286
256
287
void run_stats::update_wait_op (struct timeval *ts, unsigned int latency)
257
288
{
258
289
roll_cur_stats (ts);
259
290
260
291
m_cur_stats.m_wait_cmd .update_op (0 ,0 , latency);
292
+ m_cur_stats.m_total_cmd .update_op (0 ,0 , latency);
261
293
m_totals.update_op (0 ,0 , latency);
262
294
hdr_record_value (m_wait_latency_histogram,latency);
263
295
hdr_record_value (inst_m_wait_latency_histogram,latency);
296
+ hdr_record_value (m_totals_latency_histogram,latency);
297
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
264
298
}
265
299
266
300
void run_stats::update_arbitrary_op (struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx,
267
301
unsigned int latency, size_t request_index) {
268
302
roll_cur_stats (ts);
269
303
270
304
m_cur_stats.m_ar_commands .at (request_index).update_op (bytes_rx, bytes_tx, latency);
305
+ m_cur_stats.m_total_cmd .update_op (bytes_rx, bytes_tx, latency);
271
306
m_totals.update_op (bytes_rx, bytes_tx, latency);
272
307
273
308
struct hdr_histogram * hist = m_ar_commands_latency_histograms.at (request_index);
274
309
struct hdr_histogram * inst_hist = inst_m_ar_commands_latency_histograms.at (request_index);
275
310
hdr_record_value (hist,latency);
276
311
hdr_record_value (inst_hist,latency);
312
+ hdr_record_value (m_totals_latency_histogram,latency);
313
+ hdr_record_value (inst_m_totals_latency_histogram,latency);
277
314
}
278
315
279
316
unsigned int run_stats::get_duration (void )
@@ -384,17 +421,9 @@ std::vector<one_sec_cmd_stats> run_stats::get_one_sec_cmd_stats_wait() {
384
421
std::vector<one_sec_cmd_stats> run_stats::get_one_sec_cmd_stats_totals () {
385
422
std::vector<one_sec_cmd_stats> result;
386
423
result.reserve (m_stats.size ());
387
- for (std::list<one_second_stats>::iterator i = m_stats.begin (); i != m_stats.end (); ++i)
388
- {
389
- one_second_stats current_second_stats = *i;
390
- one_sec_cmd_stats total_stat = one_sec_cmd_stats (current_second_stats.m_get_cmd );
391
- total_stat.merge (current_second_stats.m_set_cmd );
392
- total_stat.merge (current_second_stats.m_wait_cmd );
393
- for (size_t j = 0 ; j < current_second_stats.m_ar_commands .size (); j++)
394
- {
395
- total_stat.merge (current_second_stats.m_ar_commands .at (j));
396
- }
397
- result.push_back (total_stat);
424
+ for (std::list<one_second_stats>::iterator i = m_stats.begin ();
425
+ i != m_stats.end (); i++) {
426
+ result.push_back (i->m_total_cmd );
398
427
}
399
428
return result;
400
429
}
@@ -734,6 +763,7 @@ void run_stats::aggregate_average(const std::vector<run_stats>& all_stats)
734
763
hdr_add (m_get_latency_histogram,i->m_get_latency_histogram );
735
764
hdr_add (m_set_latency_histogram,i->m_set_latency_histogram );
736
765
hdr_add (m_wait_latency_histogram,i->m_wait_latency_histogram );
766
+ hdr_add (m_totals_latency_histogram,i->m_totals_latency_histogram );
737
767
738
768
for (unsigned int j=0 ; j < i->m_ar_commands_latency_histograms .size (); j++) {
739
769
hdr_add (m_ar_commands_latency_histograms.at (j),i->m_ar_commands_latency_histograms .at (j));
@@ -743,6 +773,7 @@ void run_stats::aggregate_average(const std::vector<run_stats>& all_stats)
743
773
m_totals.m_set_cmd .aggregate_average (all_stats.size ());
744
774
m_totals.m_get_cmd .aggregate_average (all_stats.size ());
745
775
m_totals.m_wait_cmd .aggregate_average (all_stats.size ());
776
+ m_totals.m_total_cmd .aggregate_average (all_stats.size ());
746
777
m_totals.m_ar_commands .aggregate_average (all_stats.size ());
747
778
m_totals.m_ops_sec /= all_stats.size ();
748
779
m_totals.m_hits_sec /= all_stats.size ();
@@ -790,7 +821,7 @@ void run_stats::merge(const run_stats& other, int iteration)
790
821
m_totals.add (other.m_totals );
791
822
792
823
// aggregate latency data
793
- // hdr_add(m_totals.latency_histogram ,other.m_totals.latency_histogram);
824
+ hdr_add (m_totals_latency_histogram ,other.m_totals .latency_histogram );
794
825
hdr_add (m_get_latency_histogram,other.m_get_latency_histogram );
795
826
hdr_add (m_set_latency_histogram,other.m_set_latency_histogram );
796
827
hdr_add (m_wait_latency_histogram,other.m_wait_latency_histogram );
0 commit comments