mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Resync to upstream mdb.master
This commit is contained in:
parent
6bc0c7e685
commit
efec3ed235
27 changed files with 1081 additions and 843 deletions
46
external/db_drivers/liblmdb/mdb_stat.c
vendored
46
external/db_drivers/liblmdb/mdb_stat.c
vendored
|
@ -1,6 +1,6 @@
|
|||
/* mdb_stat.c - memory-mapped database status tool */
|
||||
/*
|
||||
* Copyright 2011-2015 Howard Chu, Symas Corp.
|
||||
* Copyright 2011-2018 Howard Chu, Symas Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -17,20 +17,8 @@
|
|||
#include <unistd.h>
|
||||
#include "lmdb.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define Z "I"
|
||||
#else
|
||||
#define Z "z"
|
||||
#endif
|
||||
#ifdef MDB_VL32
|
||||
#ifdef _WIN32
|
||||
#define Y "I64"
|
||||
#else
|
||||
#define Y "ll"
|
||||
#endif
|
||||
#else
|
||||
#define Y Z
|
||||
#endif
|
||||
#define Z MDB_FMT_Z
|
||||
#define Yu MDB_PRIy(u)
|
||||
|
||||
static void prstat(MDB_stat *ms)
|
||||
{
|
||||
|
@ -38,10 +26,10 @@ static void prstat(MDB_stat *ms)
|
|||
printf(" Page size: %u\n", ms->ms_psize);
|
||||
#endif
|
||||
printf(" Tree depth: %u\n", ms->ms_depth);
|
||||
printf(" Branch pages: %"Y"u\n", ms->ms_branch_pages);
|
||||
printf(" Leaf pages: %"Y"u\n", ms->ms_leaf_pages);
|
||||
printf(" Overflow pages: %"Y"u\n", ms->ms_overflow_pages);
|
||||
printf(" Entries: %"Y"u\n", ms->ms_entries);
|
||||
printf(" Branch pages: %"Yu"\n", ms->ms_branch_pages);
|
||||
printf(" Leaf pages: %"Yu"\n", ms->ms_leaf_pages);
|
||||
printf(" Overflow pages: %"Yu"\n", ms->ms_overflow_pages);
|
||||
printf(" Entries: %"Yu"\n", ms->ms_entries);
|
||||
}
|
||||
|
||||
static void usage(char *prog)
|
||||
|
@ -138,11 +126,11 @@ int main(int argc, char *argv[])
|
|||
(void)mdb_env_info(env, &mei);
|
||||
printf("Environment Info\n");
|
||||
printf(" Map address: %p\n", mei.me_mapaddr);
|
||||
printf(" Map size: %"Y"u\n", mei.me_mapsize);
|
||||
printf(" Map size: %"Yu"\n", mei.me_mapsize);
|
||||
printf(" Page size: %u\n", mst.ms_psize);
|
||||
printf(" Max pages: %"Y"u\n", mei.me_mapsize / mst.ms_psize);
|
||||
printf(" Number of pages used: %"Y"u\n", mei.me_last_pgno+1);
|
||||
printf(" Last transaction ID: %"Y"u\n", mei.me_last_txnid);
|
||||
printf(" Max pages: %"Yu"\n", mei.me_mapsize / mst.ms_psize);
|
||||
printf(" Number of pages used: %"Yu"\n", mei.me_last_pgno+1);
|
||||
printf(" Last transaction ID: %"Yu"\n", mei.me_last_txnid);
|
||||
printf(" Max readers: %u\n", mei.me_maxreaders);
|
||||
printf(" Number of readers used: %u\n", mei.me_numreaders);
|
||||
}
|
||||
|
@ -169,7 +157,7 @@ int main(int argc, char *argv[])
|
|||
if (freinfo) {
|
||||
MDB_cursor *cursor;
|
||||
MDB_val key, data;
|
||||
size_t pages = 0, *iptr;
|
||||
mdb_size_t pages = 0, *iptr;
|
||||
|
||||
printf("Freelist Status\n");
|
||||
dbi = 0;
|
||||
|
@ -189,7 +177,7 @@ int main(int argc, char *argv[])
|
|||
pages += *iptr;
|
||||
if (freinfo > 1) {
|
||||
char *bad = "";
|
||||
size_t pg, prev;
|
||||
mdb_size_t pg, prev;
|
||||
ssize_t i, j, span = 0;
|
||||
j = *iptr++;
|
||||
for (i = j, prev = 1; --i >= 0; ) {
|
||||
|
@ -200,20 +188,20 @@ int main(int argc, char *argv[])
|
|||
pg += span;
|
||||
for (; i >= span && iptr[i-span] == pg; span++, pg++) ;
|
||||
}
|
||||
printf(" Transaction %"Z"u, %"Z"d pages, maxspan %"Z"d%s\n",
|
||||
*(size_t *)key.mv_data, j, span, bad);
|
||||
printf(" Transaction %"Yu", %"Z"d pages, maxspan %"Z"d%s\n",
|
||||
*(mdb_size_t *)key.mv_data, j, span, bad);
|
||||
if (freinfo > 2) {
|
||||
for (--j; j >= 0; ) {
|
||||
pg = iptr[j];
|
||||
for (span=1; --j >= 0 && iptr[j] == pg+span; span++) ;
|
||||
printf(span>1 ? " %9"Z"u[%"Z"d]\n" : " %9"Z"u\n",
|
||||
printf(span>1 ? " %9"Yu"[%"Z"d]\n" : " %9"Yu"\n",
|
||||
pg, span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mdb_cursor_close(cursor);
|
||||
printf(" Free pages: %"Z"u\n", pages);
|
||||
printf(" Free pages: %"Yu"\n", pages);
|
||||
}
|
||||
|
||||
rc = mdb_open(txn, subname, 0, &dbi);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue