Skip to content

Commit 3298df8

Browse files
committed
Add usage for test.
1 parent f65e78c commit 3298df8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,28 @@ void kt_helper(void *data, long index, int tid) {
3434
for(std::uint64_t i(index * todo), e(std::min(((kt_data *)data)->n_, (index + 1) * todo)); i < e; hll.addh(i++));
3535
}
3636

37+
void usage() {
38+
std::fprintf(stderr, "Usage: ./test <flags>\nFlags:\n-p\tSet number of threads. [8].\n-b\tSet size of sketch. [1 << 18]\n");
39+
std::exit(EXIT_FAILURE);
40+
}
41+
3742

3843
/*
3944
* If no arguments are provided, runs test with 1 << 22 elements.
4045
* Otherwise, it parses the first argument and tests that integer.
4146
*/
4247

4348
int main(int argc, char *argv[]) {
49+
if(argc < 2) usage();
4450
using clock_t = std::chrono::system_clock;
4551
unsigned nt(8), pb(1 << 18);
4652
std::vector<std::uint64_t> vals;
4753
int c;
48-
while((c = getopt(argc, argv, "p:b:")) >= 0) {
54+
while((c = getopt(argc, argv, "p:b:h")) >= 0) {
4955
switch(c) {
5056
case 'p': nt = atoi(optarg); break;
5157
case 'b': pb = atoi(optarg); break;
58+
case 'h': case '?': usage();
5259
}
5360
}
5461
for(c = optind; c < argc; ++c) vals.push_back(strtoull(argv[c], 0, 10));

0 commit comments

Comments
 (0)