Commit 747f4518 authored by Joanne Hugé's avatar Joanne Hugé

Modify the histogram print function

parent cf1a24e0
......@@ -232,10 +232,15 @@ static void print_histograms() {
\"props_names\": [\"user_space\", \"kernel_space\"],\
\"units\": [\"us\", \"us\"],\
\"props\": [");
int max_hist_val = 0;
for (int i = 0; i < NB_HISTOGRAMS; i++) {
int max_hist_val = MAX_HIST_VAL;
for (int j = 0; j < MAX_HIST_VAL; j++)
max_hist_val = histograms[i][j] ? j : max_hist_val;
if(histograms[i][j])
max_hist_val = j > max_hist_val ? j : max_hist_val;
}
for (int i = 0; i < NB_HISTOGRAMS; i++) {
printf("[");
for (int j = 0; j < max_hist_val; j++) {
......
......@@ -11,7 +11,7 @@
#define SERVER_PORT "50000"
#define SERVER_PORT_INT 50000
#define MAX_HIST_VAL 1000
#define NB_HISTOGRAMS 3
#define NB_HISTOGRAMS 2
uint64_t ts_to_uint(struct timespec t);
void add_ns(struct timespec *t, uint64_t ns);
......
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