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 <chenxuqiang3@hisilicon.com>
}
};
+void usage(const char *name) {
+ cout << name << " <threads> <lines>\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]);