⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b_curalloc.c

📁 linux 下的源代码分析阅读器 red hat公司新版
💻 C
字号:
/* * $Id: b_curalloc.c,v 1.8 2007/05/29 17:39:15 bostic Exp $ */#include "bench.h"int usage(void);intmain(int argc, char *argv[]){	DB *dbp;	DBC *curp;	int ch, i, count;	cleanup_test_dir();	count = 100000;	while ((ch = getopt(argc, argv, "c:")) != EOF)		switch (ch) {		case 'c':			count = atoi(optarg);			break;		case '?':		default:			return (usage());		}	argc -= optind;	argv += optind;	if (argc != 0)		return (usage());	/* Create the database. */	DB_BENCH_ASSERT(db_create(&dbp, NULL, 0) == 0);	dbp->set_errfile(dbp, stderr);#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1	DB_BENCH_ASSERT(	    dbp->open(dbp, NULL, "a", NULL, DB_BTREE, DB_CREATE, 0666) == 0);#else	DB_BENCH_ASSERT(	    dbp->open(dbp, "a", NULL, DB_BTREE, DB_CREATE, 0666) == 0);#endif	/* Allocate a cursor count times. */	TIMER_START;	for (i = 0; i < count; ++i) {		DB_BENCH_ASSERT(dbp->cursor(dbp, NULL, &curp, 0) == 0);		DB_BENCH_ASSERT(curp->c_close(curp) == 0);	}	TIMER_STOP;	printf("# %d cursor allocations\n", count);	TIMER_DISPLAY(count);	return (0);}intusage(){	(void)fprintf(stderr, "usage: b_curalloc [-c count]\n");	return (EXIT_FAILURE);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -