From 23165000de34a334503e60e178ba8e309f4a279d Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 11 May 2018 16:34:11 +0200 Subject: [PATCH] calidns: Add a --quiet option --- docs/manpages/calidns.1.rst | 2 ++ pdns/calidns.cc | 35 +++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/manpages/calidns.1.rst b/docs/manpages/calidns.1.rst index 96ee6fa394..8ec977b8c8 100644 --- a/docs/manpages/calidns.1.rst +++ b/docs/manpages/calidns.1.rst @@ -43,4 +43,6 @@ Options --minimum-success-rate Stop the test as soon as the success rate drops below this value, in percent. --plot-file Write results to the specified file. +--quiet Whether to run quietly, outputting only the maximum QPS reached. + This option is mostly useful when used with --minimum-success-rate. --want-recursion Set this flag to send queries with the Recursion Desired flag set. diff --git a/pdns/calidns.cc b/pdns/calidns.cc index 90dbfa90cf..503e932de9 100644 --- a/pdns/calidns.cc +++ b/pdns/calidns.cc @@ -227,6 +227,7 @@ try ("maximum-qps", po::value(), "Stop incrementing once this rate has been reached, to provide a stable load") ("minimum-success-rate", po::value()->default_value(0), "Stop the test as soon as the success rate drops below this value, in percent") ("plot-file", po::value(), "Write results to the specific file") + ("quiet", "Whether to run quietly, outputting only the maximum QPS reached. This option is mostly useful when used with --minimum-success-rate") ("want-recursion", "Set the Recursion Desired flag on queries"); po::options_description alloptions; po::options_description hidden("hidden options"); @@ -269,6 +270,7 @@ try } bool wantRecursion = g_vm.count("want-recursion"); + bool beQuiet = g_vm.count("quiet"); bool useECSFromFile = g_vm.count("ecs-from-file"); double hitrate = g_vm["hitrate"].as(); @@ -303,7 +305,9 @@ try return EXIT_FAILURE; } - cout<<"Adding ECS option to outgoing queries with random addresses from the "<>(packet)); } random_shuffle(unknown.begin(), unknown.end()); - cout<<"Generated "< sockets; ComboAddress dest; @@ -401,13 +407,17 @@ try for(qps=qpsstart;;) { double seconds=1; - cout<<"Aiming at "< unknown.size()) { cerr<<"Not enough queries remaining (need at least "< 0.0 && perc < minimumSuccessRate) { - cout<<"The latest success rate ("<