1 /* mdb_stat.c - memory-mapped database status tool */
3 * Copyright 2011 Howard Chu, Symas Corp.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted only as authorized by the OpenLDAP
10 * A copy of this license is available in the file LICENSE in the
11 * top-level directory of the distribution or, alternatively, at
12 * <http://www.OpenLDAP.org/license.html>.
19 int main(int argc,char * argv[])
26 char *envname = argv[1];
32 rc = mdbenv_create(&env);
33 rc = mdbenv_open(env, envname, MDB_RDONLY, 0);
35 printf("mdbenv_open failed, error %d\n", rc);
38 rc = mdb_txn_begin(env, 1, &txn);
40 printf("mdb_txn_begin failed, error %d\n", rc);
43 rc = mdb_open(txn, subname, 0, &dbi);
45 printf("mdb_open failed, error %d\n", rc);
49 rc = mdb_stat(txn, dbi, &mst);
50 printf("Page size: %u\n", mst.ms_psize);
51 printf("Tree depth: %u\n", mst.ms_depth);
52 printf("Branch pages: %lu\n", mst.ms_branch_pages);
53 printf("Leaf pages: %lu\n", mst.ms_leaf_pages);
54 printf("Overflow pages: %lu\n", mst.ms_overflow_pages);
55 printf("Entries: %lu\n", mst.ms_entries);