int main(int argc, char **argv) { struct timeval t1, t2; if (argc != 3) { fprintf(stderr, "Usage: %s [--map|--btree] count\n", argv[0]); exit(1); } gettimeofday(&t1, NULL); if (std::string("--map") == argv[1]) { test_map(atoi(argv[2])); } else { test_btree(atoi(argv[2])); } gettimeofday(&t2, NULL); double ms = (t2.tv_sec - t1.tv_sec) / 1000.0 + (t2.tv_usec - t1.tv_usec) / 1000.0; fprintf(stderr, "insert into map, cost: %.3fms\n", ms); show_minfo(); sleep(30); return 0; }
int main(int argc, char *argv[]){ if(argc < 2){ printf("usage: test_btree file\n"); exit(0); } size_t sz; uint8_t *buf = mmap_filename(argv[1], 0, PROT_READ, &sz); if(!buf){ exit(1); } uint8_t *bufptr = buf; struct svector strings = make_svector(100); while(bufptr - buf < sz){ uint8_t *start = bufptr; while(!isspace(*bufptr)){ bufptr++; } string *str = make_string_ptr(start, bufptr-start); svector_push(str, &strings); do { bufptr++; } while((bufptr-buf < sz) && isspace(*bufptr)); } enable_backtraces(); test_btree((string**)svector_data(strings), svector_len(strings)); }
int main() { test_btree(); }