File: speed1.c

package info (click to toggle)
whitedb 0.7.3%2Bgit211004%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,244 kB
  • sloc: ansic: 31,363; javascript: 3,299; python: 790; lex: 359; java: 277; makefile: 195; sh: 164; yacc: 138; sed: 41
file content (32 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
creating and deleting a 1 GB database 1000 times:

real	0m9.694s
user	0m2.044s
sys	0m7.642s

creating and deleting a 10 MB database 100000 times:

real	0m12.800s
user	0m2.622s
sys	0m10.137s

*/

#include <whitedb/dbapi.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
  void *db;
  char *name="1";
  int i;
  for(i=0;i<1000;i++) { // 100000
    db = wg_attach_database(name,1000000000);  // 10000000
    if (!db) { printf("failed at try %d\n", i);  exit(0); }
    wg_detach_database(db);
    wg_delete_database(name);
  }  
  printf("i %d\n", i);
  return 0;
}