diff --git a/config.h b/config.h index 0398d0d..4995662 100644 --- a/config.h +++ b/config.h @@ -15,6 +15,7 @@ struct config { int mask; int interval; int limit; + int warmup; double rate; char *dev; }; diff --git a/main.c b/main.c index e6a2e38..77cfad6 100644 --- a/main.c +++ b/main.c @@ -25,10 +25,11 @@ int running = 1; /* Default settings */ struct config cfg = { - .limit = 100, - .rate = 1, + .limit = 5000, + .rate = 1000, .mark = 0xCD, .mask = 0xFFFFFFFF, + .warmup = 200, .dev = "eth0" }; @@ -58,12 +59,13 @@ int main(int argc, char *argv[]) " recorded measurements. This iCDF can either be used by tc(8) or 'netem table'\n" "\n" " OPTIONS:\n\n" - " -m --mark N apply emulation only to packet buffers with mark N\n" - " -M --mask N an optional mask for the fw mark\n" - " -i --interval N update the emulation parameters every N seconds\n" - " -r --rate rate limit used for measurements and updates of network emulation\n" - " -l --limit how many probes should we sent\n" - " -d --dev network interface\n" + " -m N apply emulation only to packet buffers with mark N\n" + " -M N an optional mask for the fw mark\n" + " -i N update the emulation parameters every N seconds\n" + " -r R rate limit used for measurements and updates of network emulation\n" + " -l L how many probes should we sent\n" + " -w W number of probe samples to be collected for estimating histogram boundaries\n" + " -d IF network interface\n" "\n" "netem util %s (built on %s %s)\n" " Copyright 2015, Steffen Vogel \n", argv[0], VERSION, __DATE__, __TIME__); @@ -86,7 +88,7 @@ int main(int argc, char *argv[]) /* Parse Arguments */ char c, *endptr; - while ((c = getopt (argc-1, argv+1, "h:m:M:i:l:d:r:")) != -1) { + while ((c = getopt (argc-1, argv+1, "h:m:M:i:l:d:r:w:")) != -1) { switch (c) { case 'm': cfg.mark = strtoul(optarg, &endptr, 0); @@ -94,6 +96,9 @@ int main(int argc, char *argv[]) case 'M': cfg.mask = strtoul(optarg, &endptr, 0); goto check; + case 'w': + cfg.warmup = strtoul(optarg, &endptr, 0); + goto check; case 'i': cfg.interval = strtoul(optarg, &endptr, 10); goto check; diff --git a/probe.c b/probe.c index 461cc12..1383540 100644 --- a/probe.c +++ b/probe.c @@ -165,7 +165,7 @@ int probe(int argc, char *argv[]) // hist.total, rtt, hist.lowest, hist.highest, hist_mean(&hist), hist_stddev(&hist)); /* Warmup: adjust histogram after rough estimation of RTT */ - if (run == 20) { + if (run == cfg.warmup) { double span = hist.highest - hist.lowest; hist_destroy(&hist); hist_create(&hist, MAX(0, hist.lowest - span * 0.1), hist.highest + span * 0.2, span / 20);