-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensuring we produce a valid JSON in case of empty string and -nan #273
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ae36f2b
Ensuring we produce a valid JSON in case of empty string and -nan
filipecosta90 21ede2f
Ensuring latency tracing is capped both on smallest and largest laten…
filipecosta90 5ce4f41
Added the latency test (command taking longer than 1 second) to CI
filipecosta90 de5019a
Cleaned up test_valid_json_using_debug_command
filipecosta90 bfe511c
Ensuring that the per second metrics are numeric non negative
filipecosta90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,10 +185,10 @@ | |
m_cur_stats.m_get_cmd.update_op(bytes_rx, bytes_tx, latency, hits, misses); | ||
m_cur_stats.m_total_cmd.update_op(bytes_rx, bytes_tx, latency, hits, misses); | ||
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
hdr_record_value(m_get_latency_histogram,latency); | ||
hdr_record_value(inst_m_get_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_get_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_get_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_set_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency) | ||
|
@@ -198,10 +198,10 @@ | |
m_cur_stats.m_set_cmd.update_op(bytes_rx, bytes_tx, latency); | ||
m_cur_stats.m_total_cmd.update_op(bytes_rx, bytes_tx, latency); | ||
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
hdr_record_value(m_set_latency_histogram,latency); | ||
hdr_record_value(inst_m_set_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_set_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_set_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_moved_get_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency) | ||
|
@@ -211,10 +211,10 @@ | |
m_cur_stats.m_get_cmd.update_moved_op(bytes_rx, bytes_tx, latency); | ||
m_cur_stats.m_total_cmd.update_op(bytes_rx, bytes_tx, latency); | ||
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
hdr_record_value(m_get_latency_histogram,latency); | ||
hdr_record_value(inst_m_get_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_get_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_get_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_moved_set_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency) | ||
|
@@ -224,10 +224,10 @@ | |
m_cur_stats.m_set_cmd.update_moved_op(bytes_rx, bytes_tx, latency); | ||
m_cur_stats.m_total_cmd.update_moved_op(bytes_rx, bytes_tx, latency); | ||
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
hdr_record_value(m_set_latency_histogram,latency); | ||
hdr_record_value(inst_m_set_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_set_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_set_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_moved_arbitrary_op(struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx, | ||
|
@@ -239,9 +239,9 @@ | |
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
|
||
struct hdr_histogram* hist = m_ar_commands_latency_histograms.at(request_index); | ||
hdr_record_value(hist,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(hist,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_ask_get_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency) | ||
|
@@ -251,10 +251,10 @@ | |
m_cur_stats.m_get_cmd.update_ask_op(bytes_rx, bytes_tx, latency); | ||
m_cur_stats.m_total_cmd.update_ask_op(bytes_rx, bytes_tx, latency); | ||
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
hdr_record_value(m_get_latency_histogram,latency); | ||
hdr_record_value(inst_m_get_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_get_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_get_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_ask_set_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency) | ||
|
@@ -264,10 +264,10 @@ | |
m_cur_stats.m_set_cmd.update_ask_op(bytes_rx, bytes_tx, latency); | ||
m_cur_stats.m_total_cmd.update_ask_op(bytes_rx, bytes_tx, latency); | ||
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
hdr_record_value(m_set_latency_histogram,latency); | ||
hdr_record_value(inst_m_set_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_set_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_set_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_ask_arbitrary_op(struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx, | ||
|
@@ -279,9 +279,9 @@ | |
m_totals.update_op(bytes_rx, bytes_tx, latency); | ||
|
||
struct hdr_histogram* hist = m_ar_commands_latency_histograms.at(request_index); | ||
hdr_record_value(hist,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(hist,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_wait_op(struct timeval *ts, unsigned int latency) | ||
|
@@ -291,10 +291,10 @@ | |
m_cur_stats.m_wait_cmd.update_op(0,0, latency); | ||
m_cur_stats.m_total_cmd.update_op(0,0, latency); | ||
m_totals.update_op(0,0, latency); | ||
hdr_record_value(m_wait_latency_histogram,latency); | ||
hdr_record_value(inst_m_wait_latency_histogram,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(m_wait_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_wait_latency_histogram,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
void run_stats::update_arbitrary_op(struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx, | ||
|
@@ -307,10 +307,10 @@ | |
|
||
struct hdr_histogram* hist = m_ar_commands_latency_histograms.at(request_index); | ||
struct hdr_histogram* inst_hist = inst_m_ar_commands_latency_histograms.at(request_index); | ||
hdr_record_value(hist,latency); | ||
hdr_record_value(inst_hist,latency); | ||
hdr_record_value(m_totals_latency_histogram,latency); | ||
hdr_record_value(inst_m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(hist,latency); | ||
hdr_record_value_capped(inst_hist,latency); | ||
hdr_record_value_capped(m_totals_latency_histogram,latency); | ||
hdr_record_value_capped(inst_m_totals_latency_histogram,latency); | ||
} | ||
|
||
unsigned int run_stats::get_duration(void) | ||
|
@@ -879,16 +879,17 @@ | |
result.m_ask_sec = (double) (totals.m_set_cmd.m_ask + totals.m_get_cmd.m_ask) / test_duration_usec * 1000000; | ||
} | ||
|
||
void result_print_to_json(json_handler * jsonhandler, const char * type, double ops, | ||
void result_print_to_json(json_handler * jsonhandler, const char * type, double ops_sec, | ||
double hits, double miss, double moved, double ask, double kbs, double kbs_rx, double kbs_tx, | ||
double latency, long m_total_latency, long ops, | ||
std::vector<float> quantile_list, struct hdr_histogram* latency_histogram, | ||
std::vector<unsigned int> timestamps, | ||
std::vector<one_sec_cmd_stats> timeserie_stats ) | ||
{ | ||
if (jsonhandler != NULL){ // Added for double verification in case someone accidently send NULL. | ||
jsonhandler->open_nesting(type); | ||
jsonhandler->write_obj("Count","%lld", hdr_total_count(latency_histogram)); | ||
jsonhandler->write_obj("Ops/sec","%.2f", ops); | ||
jsonhandler->write_obj("Count","%lld", ops); | ||
jsonhandler->write_obj("Ops/sec","%.2f", ops_sec); | ||
jsonhandler->write_obj("Hits/sec","%.2f", hits); | ||
jsonhandler->write_obj("Misses/sec","%.2f", miss); | ||
|
||
|
@@ -899,12 +900,13 @@ | |
jsonhandler->write_obj("ASK/sec","%.2f", ask); | ||
|
||
const bool has_samples = hdr_total_count(latency_histogram)>0; | ||
const double avg_latency = has_samples ? hdr_mean(latency_histogram)/ (double) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0; | ||
const double min_latency = has_samples ? hdr_min(latency_histogram)/ (double) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0; | ||
const double max_latency = has_samples ? hdr_max(latency_histogram)/ (double) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0; | ||
const double avg_latency = latency; | ||
const double min_latency = has_samples ? (hdr_min(latency_histogram) * 1.0)/ (double) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0; | ||
const double max_latency = has_samples ? (hdr_max(latency_histogram) * 1.0)/ (double) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0; | ||
// to be retrocompatible | ||
jsonhandler->write_obj("Latency","%.3f", avg_latency); | ||
jsonhandler->write_obj("Average Latency","%.3f", avg_latency); | ||
jsonhandler->write_obj("Accumulated Latency","%lld", m_total_latency / LATENCY_HDR_RESULTS_MULTIPLIER); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this just a sum of all command latency experienced throughout the test? Is it more-or-less equivalent to |
||
jsonhandler->write_obj("Min Latency","%.3f", min_latency); | ||
jsonhandler->write_obj("Max Latency","%.3f", max_latency); | ||
// preserve KB/sec for backwards compatibility | ||
|
@@ -925,6 +927,7 @@ | |
jsonhandler->write_obj("Count","%lld", cmd_stats.m_ops); | ||
if (sec_has_samples){ | ||
jsonhandler->write_obj("Average Latency","%.3f", cmd_stats.m_avg_latency); | ||
jsonhandler->write_obj("Accumulated Latency","%lld", cmd_stats.m_total_latency / LATENCY_HDR_RESULTS_MULTIPLIER); | ||
jsonhandler->write_obj("Min Latency","%.3f", cmd_stats.m_min_latency); | ||
jsonhandler->write_obj("Max Latency","%.3f", cmd_stats.m_max_latency); | ||
for (std::size_t i = 0; i < quantile_list.size(); i++){ | ||
|
@@ -1240,6 +1243,9 @@ | |
m_totals.m_ar_commands[i].m_bytes_sec, | ||
m_totals.m_ar_commands[i].m_bytes_sec_rx, | ||
m_totals.m_ar_commands[i].m_bytes_sec_tx, | ||
m_totals.m_ar_commands[i].m_latency, | ||
m_totals.m_ar_commands[i].m_total_latency, | ||
m_totals.m_ar_commands[i].m_ops, | ||
quantiles_list, | ||
arbitrary_command_latency_histogram, | ||
timestamps, | ||
|
@@ -1258,6 +1264,9 @@ | |
m_totals.m_set_cmd.m_bytes_sec, | ||
m_totals.m_set_cmd.m_bytes_sec_rx, | ||
m_totals.m_set_cmd.m_bytes_sec_tx, | ||
m_totals.m_set_cmd.m_latency, | ||
m_totals.m_set_cmd.m_total_latency, | ||
m_totals.m_set_cmd.m_ops, | ||
quantiles_list, | ||
m_set_latency_histogram, | ||
timestamps, | ||
|
@@ -1271,6 +1280,9 @@ | |
m_totals.m_get_cmd.m_bytes_sec, | ||
m_totals.m_get_cmd.m_bytes_sec_rx, | ||
m_totals.m_get_cmd.m_bytes_sec_tx, | ||
m_totals.m_get_cmd.m_latency, | ||
m_totals.m_get_cmd.m_total_latency, | ||
m_totals.m_get_cmd.m_ops, | ||
quantiles_list, | ||
m_get_latency_histogram, | ||
timestamps, | ||
|
@@ -1284,6 +1296,9 @@ | |
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
m_totals.m_wait_cmd.m_ops, | ||
quantiles_list, | ||
m_wait_latency_histogram, | ||
timestamps, | ||
|
@@ -1299,6 +1314,9 @@ | |
m_totals.m_bytes_sec, | ||
m_totals.m_bytes_sec_rx, | ||
m_totals.m_bytes_sec_tx, | ||
m_totals.m_latency, | ||
m_totals.m_total_latency, | ||
m_totals.m_ops, | ||
quantiles_list, | ||
m_totals.latency_histogram, | ||
timestamps, | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still being used anywhere? Can it be removed?
If not, and you're keeping it for compat purposes, should the method docs be updated to indicate it's deprecated or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DrEsteban it's coming from the original repo: https://github.com/HdrHistogram/HdrHistogram_c
I believe it's best to create an issue there and document this further on the function signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went ahead and did that: HdrHistogram/HdrHistogram_c#126
Please add details or clarifications as necessary.