コード例 #1
0
ファイル: ex_stat.c プロジェクト: EaseTech/wiredtiger
int
main(void)
{
	WT_CONNECTION *conn;
	WT_CURSOR *cursor;
	WT_SESSION *session;
	int ret;

	ret = wiredtiger_open(home, NULL, "create,statistics=(all)", &conn);
	ret = conn->open_session(conn, NULL, NULL, &session);
	ret = session->create(
	    session, "table:access", "key_format=S,value_format=S");

	ret = session->open_cursor(
	    session, "table:access", NULL, NULL, &cursor);
	cursor->set_key(cursor, "key");
	cursor->set_value(cursor, "value");
	ret = cursor->insert(cursor);
	cursor->close(cursor);

	ret = session->checkpoint(session, NULL);

	ret = print_database_stats(session);

	ret = print_file_stats(session);

	ret = print_overflow_pages(session);

	ret = print_derived_stats(session);

	return (conn->close(conn, NULL) == 0 ? ret : EXIT_FAILURE);
}
コード例 #2
0
ファイル: ex_stat.c プロジェクト: XinzeChi/wiredtiger
int
main(void)
{
	WT_CONNECTION *conn;
	WT_CURSOR *cursor;
	WT_SESSION *session;
	int ret;

	/*
	 * Create a clean test directory for this run of the test program if the
	 * environment variable isn't already set (as is done by make check).
	 */
	if (getenv("WIREDTIGER_HOME") == NULL) {
		home = "WT_HOME";
		ret = system("rm -rf WT_HOME && mkdir WT_HOME");
	} else
		home = NULL;

	ret = wiredtiger_open(home, NULL, "create,statistics=(all)", &conn);
	ret = conn->open_session(conn, NULL, NULL, &session);
	ret = session->create(
	    session, "table:access", "key_format=S,value_format=S");

	ret = session->open_cursor(
	    session, "table:access", NULL, NULL, &cursor);
	cursor->set_key(cursor, "key");
	cursor->set_value(cursor, "value");
	ret = cursor->insert(cursor);
	ret = cursor->close(cursor);

	ret = session->checkpoint(session, NULL);

	ret = print_database_stats(session);

	ret = print_file_stats(session);

	ret = print_overflow_pages(session);

	ret = print_derived_stats(session);

	return (conn->close(conn, NULL) == 0 ? ret : EXIT_FAILURE);
}
コード例 #3
0
ファイル: ex_stat.c プロジェクト: DINKIN/mongo
int
main(int argc, char *argv[])
{
	WT_CONNECTION *conn;
	WT_CURSOR *cursor;
	WT_SESSION *session;

	home = example_setup(argc, argv);

	error_check(
	    wiredtiger_open(home, NULL, "create,statistics=(all)", &conn));
	error_check(conn->open_session(conn, NULL, NULL, &session));
	error_check(session->create(session,
	    "table:access", "key_format=S,value_format=S,columns=(k,v)"));

	error_check(session->open_cursor(
	    session, "table:access", NULL, NULL, &cursor));
	cursor->set_key(cursor, "key");
	cursor->set_value(cursor, "value");
	error_check(cursor->insert(cursor));
	error_check(cursor->close(cursor));

	error_check(session->checkpoint(session, NULL));

	print_database_stats(session);

	print_file_stats(session);

	print_join_cursor_stats(session);

	print_overflow_pages(session);

	print_derived_stats(session);

	error_check(conn->close(conn, NULL));

	return (EXIT_SUCCESS);
}