/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 1997, 1998
* Sleepycat Software. All rights reserved.
*/
#include "config.h"
#ifndef lint
static const char copyright[] =
"@(#) Copyright (c) 1996, 1997, 1998\n\
Sleepycat Software Inc. All rights reserved.\n";
static const char sccsid[] = "@(#)db_stat.c 8.41 (Sleepycat) 10/3/98";
#endif
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#endif
#undef stat
#include "db_int.h"
#include "shqueue.h"
#include "db_shash.h"
#include "lock.h"
#include "mp.h"
#include "clib_ext.h"
typedef enum { T_NOTSET, T_DB, T_LOCK, T_LOG, T_MPOOL, T_TXN } test_t;
int argcheck __P((char *, const char *));
void btree_stats __P((DB *));
DB_ENV *db_init __P((char *, test_t));
void dl __P((const char *, u_long));
void hash_stats __P((DB *));
int lock_ok __P((char *));
void lock_stats __P((DB_ENV *));
void log_stats __P((DB_ENV *));
int main __P((int, char *[]));
int mpool_ok __P((char *));
void mpool_stats __P((DB_ENV *));
void nosig __P((void));
void prflags __P((u_int32_t, const FN *));
int txn_compare __P((const void *, const void *));
void txn_stats __P((DB_ENV *));
void usage __P((void));
char *internal;
const char
*progname = "db_stat"; /* Program name. */
int
main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind;
DB *dbp;
DB_ENV *dbenv;
test_t ttype;
int ch;
char *db, *home;
ttype = T_NOTSET;
db = home = NULL;
while ((ch = getopt(argc, argv, "C:cd:h:lM:mNt")) != EOF)
switch (ch) {
case 'C':
ttype = T_LOCK;
if (!argcheck(internal = optarg, "Acflmo"))
usage();
break;
case 'c':
ttype = T_LOCK;
break;
case 'd':
db = optarg;
ttype = T_DB;
break;
case 'h':
home = optarg;
break;
case 'l':
ttype = T_LOG;
break;
case 'M':
ttype = T_MPOOL;
if (!argcheck(internal = optarg, "Ahlm"))
usage();
break;
case 'm':
ttype = T_MPOOL;
break;
case