From: Remi Gacogne Date: Fri, 11 May 2018 13:29:58 +0000 (+0200) Subject: calidns: Only write a 'plot' file when asked to X-Git-Tag: dnsdist-1.3.1~104^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4038b8d67cd018d459ca790a2eb25bfcb2160377;p=thirdparty%2Fpdns.git calidns: Only write a 'plot' file when asked to --- diff --git a/docs/manpages/calidns.1.rst b/docs/manpages/calidns.1.rst index 32cb08c435..98ffffe90e 100644 --- a/docs/manpages/calidns.1.rst +++ b/docs/manpages/calidns.1.rst @@ -40,4 +40,5 @@ Options by *NUM*. By default, this is 1.1. --maximum-qps Stop incrementing once this rate has been reached, to provide a stable load. +--plot-file Write results to the specified file. --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 e327bbc498..0c15260417 100644 --- a/pdns/calidns.cc +++ b/pdns/calidns.cc @@ -225,6 +225,7 @@ try ("ecs-from-file", "Read IP or subnet values from the query file and add them as EDNS Client Subnet options to outgoing queries") ("increment", po::value()->default_value(1.1), "Set the factor to increase the QPS load per run") ("maximum-qps", po::value(), "Stop incrementing once this rate has been reached, to provide a stable load") + ("plot-file", po::value(), "Write results to the specific file") ("want-recursion", "Set the Recursion Desired flag on queries"); po::options_description alloptions; po::options_description hidden("hidden options"); @@ -378,7 +379,15 @@ try new thread(recvThread, &sockets); uint32_t qps; - ofstream plot("plot"); + ofstream plot; + if (g_vm.count("plot-file")) { + plot.open(g_vm["plot-file"].as()); + if (!plot) { + cerr<<"Error opening "<()<<" for writing: "<