Commit 16e470ca authored by Joanne Hugé's avatar Joanne Hugé

Properly display histogram if timestamps are not enabled on server

parent 9ecb27f2
...@@ -254,27 +254,29 @@ static void print_histograms() { ...@@ -254,27 +254,29 @@ static void print_histograms() {
interval = param->interval / 1000; interval = param->interval / 1000;
printf("{\"measure_sets\": [{" if(enable_timestamps) {
"\"measure_type\": \"packet_recv_timestamps\"," printf("{\"measure_sets\": [{"
"\"props_names\": [\"user_space\", \"kernel_space\"]," "\"measure_type\": \"packet_recv_timestamps\","
"\"units\": [\"us\", \"us\"]," "\"props_names\": [\"user_space\", \"kernel_space\"],"
"\"props_type\": \"histogram\"," "\"units\": [\"us\", \"us\"],"
"\"metadata\": {" "\"props_type\": \"histogram\","
"\"i\": \"%dus\", \"duration\": \"%dh%d\"" "\"metadata\": {"
"}," "\"i\": \"%dus\", \"duration\": \"%dh%d\""
"\"props\": [", interval, duration_hour, duration_minutes); "},"
"\"props\": [", interval, duration_hour, duration_minutes);
max_hist_val = 0;
for (int i = 0; i < 2; i++) max_hist_val = 0;
for (int j = 0; j < MAX_HIST_VAL; j++) for (int i = 0; i < 2; i++)
if (histograms[i][j]) for (int j = 0; j < MAX_HIST_VAL; j++)
max_hist_val = j > max_hist_val ? j : max_hist_val; if (histograms[i][j])
max_hist_val = j > max_hist_val ? j : max_hist_val;
for (int i = 0; i < 2; i++) {
printf("["); for (int i = 0; i < 2; i++) {
for (int j = 0; j < max_hist_val; j++) printf("[");
printf("%" PRIi64 "%s", histograms[i][j], (j + 1 < max_hist_val ? ", " : "")); for (int j = 0; j < max_hist_val; j++)
printf("%s", (i + 1 < 2 ? "], " : "]")); printf("%" PRIi64 "%s", histograms[i][j], (j + 1 < max_hist_val ? ", " : ""));
printf("%s", (i + 1 < 2 ? "], " : "]"));
}
} }
max_hist_val = 0; max_hist_val = 0;
...@@ -286,8 +288,12 @@ static void print_histograms() { ...@@ -286,8 +288,12 @@ static void print_histograms() {
if(histograms[2][j]) if(histograms[2][j])
min_hist_val = j; min_hist_val = j;
printf( "]}, {" if(!enable_timestamps)
"\"measure_type\": \"packet_jitter\"," printf("{\"measure_sets\": [{");
else
printf( "]}, {");
printf( "\"measure_type\": \"packet_jitter\","
"\"props_names\": [\"jitter\"]," "\"props_names\": [\"jitter\"],"
"\"units\": [\"us\"]," "\"units\": [\"us\"],"
"\"props_type\": \"histogram\"," "\"props_type\": \"histogram\","
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment