summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 648990a)
raw | patch | inline | side by side (parent: 648990a)
author | Florian Forster <ff@octo.it> | |
Thu, 9 Oct 2014 14:39:00 +0000 (16:39 +0200) | ||
committer | Florian Forster <ff@octo.it> | |
Thu, 9 Oct 2014 14:39:00 +0000 (16:39 +0200) |
src/mans/oping.pod | patch | blob | history | |
src/oping.c | patch | blob | history |
diff --git a/src/mans/oping.pod b/src/mans/oping.pod
index 19d45042f6d237c451fb4649b6d75bce60bd6368..8ed738e5d1e92d4f784a7ec6628fbf5f834edebd 100644 (file)
--- a/src/mans/oping.pod
+++ b/src/mans/oping.pod
I<noping only> B<-u> forces UTF-8 output, B<-U> disables UTF-8 output. If
neither is given, the codeset is automatically determined from the locale.
+=item B<-g> B<none>|B<prettyping>|B<boxplot>
+
+I<noping only> Selects the graph to display.
+
+=over 4
+
+=item B<none>
+
+Do not shot a graph.
+
+=item B<prettyping>
+
+Show a graph with time on the x-axis in a round-robin fashion, i.e. continue on
+the left if the right edge is reached. The y-axis shows the round-trip time.
+This is the default.
+
+=item B<boxplot>
+
+Shows a box plot where the x-axis, i.e. the width of the window, is the
+round-trip time. The entire width of the window it the ping interval, set with
+the B<-i> option.
+
+The box is sized so it contains 50% of the replies. The vertical line shows the
+median. The whiskers are sized to contain 95% of the replies -- 2.5% below the
+whiskers and 2.5% above.
+
+=back
+
=item B<-P> I<percent>
Configures the latency percentile to report. I<percent> must be a number
diff --git a/src/oping.c b/src/oping.c
index b7ef0454395a60c8da3d4666ee16e861b01651c1..ce2a08f75d54eb0e48a9ffc1fbe23986ceadc2a3 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
#endif
/* "─" */
-#define BOXPLOT_WHISKER_BAR (113 | A_ALTCHARSET)
+#define BOXPLOT_WHISKER_BAR (113 | A_ALTCHARSET)
/* "├" */
-#define BOXPLOT_WHISKER_LEFT_END (116 | A_ALTCHARSET)
+#define BOXPLOT_WHISKER_LEFT_END (116 | A_ALTCHARSET)
/* "┤" */
#define BOXPLOT_WHISKER_RIGHT_END (117 | A_ALTCHARSET)
-#define BOXPLOT_BOX ' '
-/* "│" */
-#define BOXPLOT_MEDIAN (120 | A_ALTCHARSET)
+/* Inverted */
+#define BOXPLOT_BOX ' '
+/* "│", inverted */
+#define BOXPLOT_MEDIAN (120 | A_ALTCHARSET)
#include "oping.h"
static double opt_percentile = -1.0;
static double opt_exit_status_threshold = 1.0;
#if USE_NCURSES
+static int opt_show_graph = 1;
static int opt_utf8 = 0;
#endif
{
optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:P:"
#if USE_NCURSES
- "uU"
+ "uUg:"
#endif
);
break;
#if USE_NCURSES
+ case 'g':
+ if (strcasecmp ("none", optarg) == 0)
+ opt_show_graph = 0;
+ else if (strcasecmp ("prettyping", optarg) == 0)
+ opt_show_graph = 1;
+ else if (strcasecmp ("boxplot", optarg) == 0)
+ opt_show_graph = 2;
+ else
+ fprintf (stderr, "Unknown graph option: %s\n", optarg);
+ break;
+
case 'u':
opt_utf8 = 2;
break;
case 'h':
usage_exit (argv[0], 0);
break;
+
default:
usage_exit (argv[0], 1);
}
@@ -1011,7 +1025,10 @@ static int update_stats_from_context (ping_context_t *ctx, pingobj_iter_t *iter)
deviation);
}
- update_prettyping_graph (ctx, latency, sequence);
+ if (opt_show_graph == 1)
+ update_prettyping_graph (ctx, latency, sequence);
+ else if (opt_show_graph == 2)
+ update_boxplot (ctx);
wrefresh (ctx->window);
int width = 0;
int height = 0;
int main_win_height;
+ int box_height = (opt_show_graph == 0) ? 4 : 5;
getmaxyx (stdscr, height, width);
if ((height < 1) || (width < 1))
return (EINVAL);
- main_win_height = height - (5 * host_num);
+ main_win_height = height - (box_height * host_num);
wresize (main_win, main_win_height, /* width = */ width);
/* Allow scrolling */
scrollok (main_win, TRUE);
delwin (context->window);
context->window = NULL;
}
- context->window = newwin (/* height = */ 5,
+ context->window = newwin (/* height = */ box_height,
/* width = */ width,
- /* y = */ main_win_height + (5 * context->index),
+ /* y = */ main_win_height + (box_height * context->index),
/* x = */ 0);
}
int width = 0;
int height = 0;
int main_win_height;
+ int box_height = (opt_show_graph == 0) ? 4 : 5;
initscr ();
cbreak ();
init_pair (OPING_RED_HIST, COLOR_RED, COLOR_YELLOW);
}
- main_win_height = height - (5 * host_num);
+ main_win_height = height - (box_height * host_num);
main_win = newwin (/* height = */ main_win_height,
/* width = */ width,
/* y = */ 0, /* x = */ 0);
delwin (context->window);
context->window = NULL;
}
- context->window = newwin (/* height = */ 5,
+ context->window = newwin (/* height = */ box_height,
/* width = */ width,
- /* y = */ main_win_height + (5 * context->index),
+ /* y = */ main_win_height + (box_height * context->index),
/* x = */ 0);
}