+ else /* if (!(latency >= 0.0)) */
+ wattron (ctx->window, A_BOLD);
+
+ if (has_colors () == TRUE)
+ wattron (ctx->window, COLOR_PAIR(color));
+
+ if (has_utf8())
+ mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2, symbol);
+ else
+ mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2, symbolc);
+
+ if (has_colors () == TRUE)
+ wattroff (ctx->window, COLOR_PAIR(color));
+
+ /* Use negation here to handle NaN correctly. */
+ if (!(latency >= 0.0))
+ wattroff (ctx->window, A_BOLD);
+ } /* for (x) */
+
+ return (0);
+} /* }}} int update_graph_prettyping */
+
+static int update_graph_histogram (ping_context_t *ctx) /* {{{ */
+{
+ uint32_t *counters;
+ uint32_t *accumulated;
+ uint32_t max;
+ size_t i;
+ size_t x_max;
+ size_t x;
+
+ size_t symbols_num = hist_symbols_acs_num;
+
+ clean_history (ctx);
+
+ if (ctx->history_received == 0)
+ return (ENOENT);
+
+ if (has_utf8 ())
+ symbols_num = hist_symbols_utf8_num;
+
+ x_max = (size_t) getmaxx (ctx->window);
+ if (x_max <= 4)
+ return (EINVAL);
+ x_max -= 4;
+
+ counters = calloc (x_max, sizeof (*counters));
+ accumulated = calloc (x_max, sizeof (*accumulated));
+
+ /* Bucketize */
+ max = 0;
+ for (i = 0; i < ctx->history_received; i++)
+ {
+ double latency = ctx->history_by_value[i] / 1000.0;
+ size_t index = (size_t) (((double) x_max) * latency / opt_interval);
+
+ if (index >= x_max)
+ index = x_max - 1;
+
+ counters[index]++;
+ if (max < counters[index])
+ max = counters[index];