From: chenxuqiang Date: Tue, 19 Nov 2019 14:04:12 +0000 (+0800) Subject: test/bench_log: add usage function X-Git-Tag: v15.1.0~716^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=51ca9190974979949f040c766efb2ada377c395b;p=ceph-ci.git test/bench_log: add usage function Currently, the bench_log does not have a usage function, so that when it is used, if no pararmeters are given, a segmentation error will occur. This causes confusion. Now, we add the usage function and add (argc < 3) conditional judgment. Signed-off-by: Xuqiang Chen --- diff --git a/src/test/bench_log.cc b/src/test/bench_log.cc index 2acbf1de48d..205dfe97b62 100644 --- a/src/test/bench_log.cc +++ b/src/test/bench_log.cc @@ -30,8 +30,19 @@ struct T : public Thread { } }; +void usage(const char *name) { + cout << name << " \n" + << "\t threads: the number of threads for this test.\n" + << "\t lines: the number of log entries per thread.\n"; +} + int main(int argc, const char **argv) { + if (argc < 3) { + usage(argv[0]); + return EXIT_FAILURE; + } + int threads = atoi(argv[1]); int num = atoi(argv[2]);