diff options
author | Håvard Pettersen <havardpe@oath.com> | 2022-03-31 11:44:10 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2022-04-01 10:24:32 +0000 |
commit | d71f76a73fe54558f613e75a3a8cfd70fc46a7e8 (patch) | |
tree | 7d170e5b792dbf5fed06ff7c7b2db398b6cb64c7 /searchlib/src/tests/attribute/benchmark | |
parent | 1bb3dd192f4bcb91e710fe19ca54b2b8935ffb83 (diff) |
use getopt/getopt_long directly
Diffstat (limited to 'searchlib/src/tests/attribute/benchmark')
-rw-r--r-- | searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index 7d168407328..4a690a28cc8 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -11,6 +11,7 @@ #include "attributesearcher.h" #include "attributeupdater.h" #include <sys/resource.h> +#include <unistd.h> #include <vespa/log/log.h> LOG_SETUP("attributebenchmark"); @@ -485,62 +486,60 @@ AttributeBenchmark::Main() dc._prefixLength = 2; dc._prefixSearch = false; - int idx = 1; int opt; - const char * arg; bool optError = false; - while ((opt = GetOpt("n:u:v:s:q:p:r:c:l:h:i:a:e:S:E:D:L:bRPtw", arg, idx)) != -1) { + while ((opt = getopt(_argc, _argv, "n:u:v:s:q:p:r:c:l:h:i:a:e:S:E:D:L:bRPtw")) != -1) { switch (opt) { case 'n': - dc._numDocs = atoi(arg); + dc._numDocs = atoi(optarg); break; case 'u': - dc._numUpdates = atoi(arg); + dc._numUpdates = atoi(optarg); break; case 'v': - dc._numValues = atoi(arg); + dc._numValues = atoi(optarg); break; case 's': - dc._numSearchers = atoi(arg); + dc._numSearchers = atoi(optarg); break; case 'q': - dc._numQueries = atoi(arg); + dc._numQueries = atoi(optarg); break; case 'p': - dc._populateRuns = atoi(arg); + dc._populateRuns = atoi(optarg); break; case 'r': - dc._updateRuns = atoi(arg); + dc._updateRuns = atoi(optarg); break; case 'c': - dc._commitFreq = atoi(arg); + dc._commitFreq = atoi(optarg); break; case 'l': - dc._minValueCount = atoi(arg); + dc._minValueCount = atoi(optarg); break; case 'h': - dc._maxValueCount = atoi(arg); + dc._maxValueCount = atoi(optarg); break; case 'i': - dc._minStringLen = atoi(arg); + dc._minStringLen = atoi(optarg); break; case 'a': - dc._maxStringLen = atoi(arg); + dc._maxStringLen = atoi(optarg); break; case 'e': - dc._seed = atoi(arg); + dc._seed = atoi(optarg); break; case 'S': - dc._rangeStart = strtoll(arg, NULL, 10); + dc._rangeStart = strtoll(optarg, NULL, 10); break; case 'E': - dc._rangeEnd = strtoll(arg, NULL, 10); + dc._rangeEnd = strtoll(optarg, NULL, 10); break; case 'D': - dc._rangeDelta = strtoll(arg, NULL, 10); + dc._rangeDelta = strtoll(optarg, NULL, 10); break; case 'L': - dc._prefixLength = atoi(arg); + dc._prefixLength = atoi(optarg); break; case 'b': dc._searchersOnly = false; @@ -563,12 +562,12 @@ AttributeBenchmark::Main() } } - if (_argc != (idx + 1) || optError) { + if (_argc != (optind + 1) || optError) { usage(); return -1; } - dc._attribute = vespalib::string(_argv[idx]); + dc._attribute = vespalib::string(_argv[optind]); _threadPool = new FastOS_ThreadPool(256000); |