void test()

in src/bench.c [248:276]


void test(candidate *c, int n, int lookups) {
  printf("Testing bulk insert of %d elements and %d random lookups\n", n, lookups);

  printf("  Candidate: %s\n", c->name);
  rm_all_rec(c->files());

  float t1_wall = wall();
  float t1_cpu = cpu();

  c->create(n);

  float t2_wall = wall();
  float t2_cpu = cpu();
  printf("    creation time (wall):     %2.2f\n", t2_wall - t1_wall);
  printf("    creation time (cpu):      %2.2f\n", t2_cpu - t1_cpu);
  printf("    throughput (puts/cpusec): %2.2f\n", (float) n / (t2_cpu - t1_cpu));
  printf("    file size:                %zu\n", total_file_size(c->files()));

  c->randomaccess(n, lookups);

  float t3_wall = wall();
  float t3_cpu = cpu();
  printf("    lookup time (wall):          %2.2f\n", t3_wall - t2_wall);
  printf("    lookup time (cpu):           %2.2f\n", t3_cpu - t2_cpu);
  printf("    throughput (lookups/cpusec): %2.2f\n", (float) lookups / (t3_cpu - t2_cpu));
  rm_all_rec(c->files());

  printf("\n");
}