@@ -879,16 +879,19 @@ void run_stats::summarize(totals& result) const
879
879
result.m_ask_sec = (double ) (totals.m_set_cmd .m_ask + totals.m_get_cmd .m_ask ) / test_duration_usec * 1000000 ;
880
880
}
881
881
882
- void result_print_to_json (json_handler * jsonhandler, const char * type, double ops ,
882
+ void result_print_to_json (json_handler * jsonhandler, const char * type, double ops_sec ,
883
883
double hits, double miss, double moved, double ask, double kbs, double kbs_rx, double kbs_tx,
884
+ double latency, long ops,
884
885
std::vector<float > quantile_list, struct hdr_histogram * latency_histogram,
885
886
std::vector<unsigned int > timestamps,
886
887
std::vector<one_sec_cmd_stats> timeserie_stats )
887
888
{
888
889
if (jsonhandler != NULL ){ // Added for double verification in case someone accidently send NULL.
889
890
jsonhandler->open_nesting (type);
890
- jsonhandler->write_obj (" Count" ," %lld" , hdr_total_count (latency_histogram));
891
- jsonhandler->write_obj (" Ops/sec" ," %.2f" , ops);
891
+ const long hdr_count = hdr_total_count (latency_histogram);
892
+ assert (hdr_count < ops && " reported ops and tracked ops via hdrhistogram are same" );
893
+ jsonhandler->write_obj (" Count" ," %lld" , hdr_count);
894
+ jsonhandler->write_obj (" Ops/sec" ," %.2f" , ops_sec);
892
895
jsonhandler->write_obj (" Hits/sec" ," %.2f" , hits);
893
896
jsonhandler->write_obj (" Misses/sec" ," %.2f" , miss);
894
897
@@ -899,9 +902,9 @@ void result_print_to_json(json_handler * jsonhandler, const char * type, double
899
902
jsonhandler->write_obj (" ASK/sec" ," %.2f" , ask);
900
903
901
904
const bool has_samples = hdr_total_count (latency_histogram)>0 ;
902
- const double avg_latency = has_samples ? hdr_mean (latency_histogram)/ ( double ) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0 ;
903
- const double min_latency = has_samples ? hdr_min (latency_histogram)/ (double ) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0 ;
904
- const double max_latency = has_samples ? hdr_max (latency_histogram)/ (double ) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0 ;
905
+ const double avg_latency = latency ;
906
+ const double min_latency = has_samples ? ( hdr_min (latency_histogram) * 1.0 )/ (double ) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0 ;
907
+ const double max_latency = has_samples ? ( hdr_max (latency_histogram) * 1.0 )/ (double ) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0 ;
905
908
// to be retrocompatible
906
909
jsonhandler->write_obj (" Latency" ," %.3f" , avg_latency);
907
910
jsonhandler->write_obj (" Average Latency" ," %.3f" , avg_latency);
@@ -1240,6 +1243,8 @@ void run_stats::print_json(json_handler *jsonhandler, arbitrary_command_list& co
1240
1243
m_totals.m_ar_commands [i].m_bytes_sec ,
1241
1244
m_totals.m_ar_commands [i].m_bytes_sec_rx ,
1242
1245
m_totals.m_ar_commands [i].m_bytes_sec_tx ,
1246
+ m_totals.m_ar_commands [i].m_latency ,
1247
+ m_totals.m_ar_commands [i].m_ops ,
1243
1248
quantiles_list,
1244
1249
arbitrary_command_latency_histogram,
1245
1250
timestamps,
@@ -1258,6 +1263,8 @@ void run_stats::print_json(json_handler *jsonhandler, arbitrary_command_list& co
1258
1263
m_totals.m_set_cmd .m_bytes_sec ,
1259
1264
m_totals.m_set_cmd .m_bytes_sec_rx ,
1260
1265
m_totals.m_set_cmd .m_bytes_sec_tx ,
1266
+ m_totals.m_set_cmd .m_latency ,
1267
+ m_totals.m_set_cmd .m_ops ,
1261
1268
quantiles_list,
1262
1269
m_set_latency_histogram,
1263
1270
timestamps,
@@ -1271,6 +1278,8 @@ void run_stats::print_json(json_handler *jsonhandler, arbitrary_command_list& co
1271
1278
m_totals.m_get_cmd .m_bytes_sec ,
1272
1279
m_totals.m_get_cmd .m_bytes_sec_rx ,
1273
1280
m_totals.m_get_cmd .m_bytes_sec_tx ,
1281
+ m_totals.m_get_cmd .m_latency ,
1282
+ m_totals.m_get_cmd .m_ops ,
1274
1283
quantiles_list,
1275
1284
m_get_latency_histogram,
1276
1285
timestamps,
@@ -1284,6 +1293,8 @@ void run_stats::print_json(json_handler *jsonhandler, arbitrary_command_list& co
1284
1293
0.0 ,
1285
1294
0.0 ,
1286
1295
0.0 ,
1296
+ 0.0 ,
1297
+ m_totals.m_wait_cmd .m_ops ,
1287
1298
quantiles_list,
1288
1299
m_wait_latency_histogram,
1289
1300
timestamps,
@@ -1299,6 +1310,8 @@ void run_stats::print_json(json_handler *jsonhandler, arbitrary_command_list& co
1299
1310
m_totals.m_bytes_sec ,
1300
1311
m_totals.m_bytes_sec_rx ,
1301
1312
m_totals.m_bytes_sec_tx ,
1313
+ m_totals.m_latency ,
1314
+ m_totals.m_ops ,
1302
1315
quantiles_list,
1303
1316
m_totals.latency_histogram ,
1304
1317
timestamps,
0 commit comments