这篇教程C++ testutil_check函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中testutil_check函数的典型用法代码示例。如果您正苦于以下问题:C++ testutil_check函数的具体用法?C++ testutil_check怎么用?C++ testutil_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了testutil_check函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: do_checkpoints/* * Function for repeatedly running checkpoint operations. */static WT_THREAD_RETdo_checkpoints(void *_opts){ TEST_OPTS *opts; WT_SESSION *session; time_t now, start; int ret; opts = (TEST_OPTS *)_opts; (void)time(&start); (void)time(&now); while (difftime(now, start) < RUNTIME) { testutil_check( opts->conn->open_session(opts->conn, NULL, NULL, &session)); if ((ret = session->checkpoint(session, "force")) != 0) if (ret != EBUSY && ret != ENOENT) testutil_die(ret, "session.checkpoint"); testutil_check(session->close(session, NULL)); /* * A short sleep to let operations process and avoid back to * back checkpoints locking up resources. */ sleep(1); (void)time(&now); } return (WT_THREAD_RET_VALUE);}
开发者ID:DINKIN,项目名称:mongo,代码行数:35,
示例2: op_cursor/* * Open and close cursor on a table. */voidop_cursor(void *arg){ TEST_OPTS *opts; TEST_PER_THREAD_OPTS *args; WT_CURSOR *cursor; WT_SESSION *session; int i, ret; args = (TEST_PER_THREAD_OPTS *)arg; opts = args->testopts; testutil_check( opts->conn->open_session(opts->conn, NULL, NULL, &session)); if ((ret = session->open_cursor( session, opts->uri, NULL, NULL, &cursor)) != 0) { if (ret != ENOENT && ret != EBUSY) testutil_die(ret, "session.open_cursor"); } else { /* Put some data in if asked to. */ if (args->testopts->do_data_ops) { for (i = 0; i < 1000; i++) { cursor->set_key(cursor, i); cursor->set_value(cursor, "abcdef"); cursor->insert(cursor); } } testutil_check(cursor->close(cursor)); } testutil_check(session->close(session, NULL)); args->thread_counter++;}
开发者ID:ajdavis,项目名称:mongo,代码行数:37,
示例3: op_bulk/* * Create a table and open a bulk cursor on it. */voidop_bulk(void *arg){ TEST_OPTS *opts; TEST_PER_THREAD_OPTS *args; WT_CURSOR *c; WT_SESSION *session; int ret; args = (TEST_PER_THREAD_OPTS *)arg; opts = args->testopts; testutil_check( opts->conn->open_session(opts->conn, NULL, NULL, &session)); if ((ret = session->create(session, opts->uri, DEFAULT_TABLE_SCHEMA)) != 0) if (ret != EEXIST && ret != EBUSY) testutil_die(ret, "session.create"); if (ret == 0) { __wt_yield(); if ((ret = session->open_cursor(session, opts->uri, NULL, "bulk,checkpoint_wait=false", &c)) == 0) { testutil_check(c->close(c)); } else if (ret != ENOENT && ret != EBUSY && ret != EINVAL) testutil_die(ret, "session.open_cursor bulk"); } testutil_check(session->close(session, NULL)); args->thread_counter++;}
开发者ID:ajdavis,项目名称:mongo,代码行数:35,
示例4: index_comparestatic intindex_compare(WT_COLLATOR *collator, WT_SESSION *session, const WT_ITEM *key1, const WT_ITEM *key2, int *cmp){ WT_ITEM ikey1, pkey1, ikey2, pkey2; (void)collator; testutil_check(wiredtiger_struct_unpack(session, key1->data, key1->size, "uu", &ikey1, &pkey1)); testutil_check(wiredtiger_struct_unpack(session, key2->data, key2->size, "uu", &ikey2, &pkey2)); print_int_item("index_compare: index key1 = ", &ikey1); print_int_item(", primary key1 = ", &pkey1); print_int_item(", index key2 = ", &ikey2); print_int_item(", primary key2 = ", &pkey2); printf("/n"); if ((*cmp = compare_int_items(&ikey1, &ikey2)) != 0) return (0); if (pkey1.size != 0 && pkey2.size != 0) *cmp = compare_int_items(&pkey1, &pkey2); else if (pkey1.size != 0) *cmp = 1; else if (pkey2.size != 0) *cmp = -1; else *cmp = 0; return (0);}
开发者ID:DINKIN,项目名称:mongo,代码行数:32,
示例5: sweep_statsstatic voidsweep_stats(void){ static const int list[] = { WT_STAT_CONN_CURSOR_SWEEP_BUCKETS, WT_STAT_CONN_CURSOR_SWEEP_CLOSED, WT_STAT_CONN_CURSOR_SWEEP_EXAMINED, WT_STAT_CONN_CURSOR_SWEEP, WT_STAT_CONN_DH_SWEEP_REF, WT_STAT_CONN_DH_SWEEP_CLOSE, WT_STAT_CONN_DH_SWEEP_REMOVE, WT_STAT_CONN_DH_SWEEP_TOD, WT_STAT_CONN_DH_SWEEPS, WT_STAT_CONN_DH_SESSION_SWEEPS, -1 }; WT_SESSION *session; WT_CURSOR *cursor; uint64_t value; int i; const char *desc, *pvalue; testutil_check(conn->open_session(conn, NULL, NULL, &session)); testutil_check(session->open_cursor( session, "statistics:", NULL, NULL, &cursor)); for (i = 0;; ++i) { if (list[i] == -1) break; cursor->set_key(cursor, list[i]); testutil_check(cursor->search(cursor)); testutil_check( cursor->get_value(cursor, &desc, &pvalue, &value)); printf("/t" "%s=%s/n", desc, pvalue); }}
开发者ID:ajdavis,项目名称:mongo,代码行数:35,
示例6: page_initstatic voidpage_init(uint64_t n){ WT_CONNECTION *conn; WT_CURSOR *cursor; WT_SESSION *session; uint64_t recno, vrecno; char buf[64]; conn = opts->conn; testutil_check(conn->open_session(conn, NULL, NULL, &session)); testutil_check( session->open_cursor(session, opts->uri, NULL, "append", &cursor)); vrecno = 0; buf[0] = '/2'; for (recno = 1;; ++recno) { if (opts->table_type == TABLE_FIX) cursor->set_value(cursor, buf[0]); else { if (recno % 3 == 0) ++vrecno; testutil_check(__wt_snprintf(buf, sizeof(buf), "%" PRIu64 " VALUE ------", vrecno)); cursor->set_value(cursor, buf); } testutil_check(cursor->insert(cursor)); testutil_check(cursor->get_key(cursor, &opts->max_inserted_id)); if (opts->max_inserted_id >= n) break; }}
开发者ID:ajdavis,项目名称:mongo,代码行数:33,
示例7: mainintmain(void){ uint8_t buf[10], *p, *end; int64_t i; for (i = 1; i < 1LL << 60; i <<= 1) { end = buf; testutil_check( __wt_vpack_uint(&end, sizeof(buf), (uint64_t)i)); printf("%" PRId64 " ", i); for (p = buf; p < end; p++) printf("%02x", *p); printf("/n"); end = buf; testutil_check(__wt_vpack_int(&end, sizeof(buf), -i)); printf("%" PRId64 " ", -i); for (p = buf; p < end; p++) printf("%02x", *p); printf("/n"); } return (0);}
开发者ID:Machyne,项目名称:mongo,代码行数:25,
示例8: setupvoidsetup(void){ WT_CONNECTION *conn; WT_SESSION *session; int ret; char config[512]; if ((ret = system("rm -f WiredTiger* *.bf")) != 0) testutil_die(ret, "system cleanup call failed"); /* * This test doesn't test public Wired Tiger functionality, it still * needs connection and session handles. */ /* * Open configuration -- put command line configuration options at the * end so they can override "standard" configuration. */ snprintf(config, sizeof(config), "create,error_prefix=/"%s/",cache_size=%" PRIu32 "MB,%s", g.progname, g.c_cache, g.config_open == NULL ? "" : g.config_open); testutil_check(wiredtiger_open(NULL, NULL, config, &conn)); testutil_check(conn->open_session(conn, NULL, NULL, &session)); g.wt_conn = conn; g.wt_session = session; populate_entries();}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:32,
示例9: start_workers/* * start_workers -- * Setup the configuration for the tables being populated, then start * the worker thread(s) and wait for them to finish. */intstart_workers(table_type type){ struct timeval start, stop; WT_SESSION *session; wt_thread_t *tids; double seconds; int i, ret; ret = 0; /* Create statistics and thread structures. */ if ((tids = calloc((size_t)(g.nworkers), sizeof(*tids))) == NULL) return (log_print_err("calloc", errno, 1)); if ((ret = g.conn->open_session(g.conn, NULL, NULL, &session)) != 0) { (void)log_print_err("conn.open_session", ret, 1); goto err; } /* Setup the cookies */ for (i = 0; i < g.ntables; ++i) { g.cookies[i].id = i; if (type == MIX) g.cookies[i].type = (table_type)((i % MAX_TABLE_TYPE) + 1); else g.cookies[i].type = type; testutil_check(__wt_snprintf( g.cookies[i].uri, sizeof(g.cookies[i].uri), "%s%04d", URI_BASE, g.cookies[i].id)); /* Should probably be atomic to avoid races. */ if ((ret = create_table(session, &g.cookies[i])) != 0) goto err; } (void)gettimeofday(&start, NULL); /* Create threads. */ for (i = 0; i < g.nworkers; ++i) testutil_check(__wt_thread_create( NULL, &tids[i], worker, &g.cookies[i])); /* Wait for the threads. */ for (i = 0; i < g.nworkers; ++i) testutil_check(__wt_thread_join(NULL, tids[i])); (void)gettimeofday(&stop, NULL); seconds = (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) * 1e-6; printf("Ran workers for: %f seconds/n", seconds);err: free(tids); return (ret);}
开发者ID:bsamek,项目名称:wiredtiger,代码行数:61,
示例10: mainintmain(int argc, char *argv[]){ WT_SESSION *session; clock_t ce, cs; pthread_t idlist[100]; uint64_t i, id; char buf[100]; opts = &_opts; memset(opts, 0, sizeof(*opts)); opts->table_type = TABLE_ROW; opts->n_append_threads = N_APPEND_THREADS; opts->nrecords = N_RECORDS; testutil_check(testutil_parse_opts(argc, argv, opts)); testutil_make_work_dir(opts->home); snprintf(buf, sizeof(buf), "create," "cache_size=%s," "eviction=(threads_max=5)," "statistics=(fast)", opts->table_type == TABLE_FIX ? "500MB" : "2GB"); testutil_check(wiredtiger_open(opts->home, NULL, buf, &opts->conn)); testutil_check( opts->conn->open_session(opts->conn, NULL, NULL, &session)); snprintf(buf, sizeof(buf), "key_format=r,value_format=%s," "allocation_size=4K,leaf_page_max=64K", opts->table_type == TABLE_FIX ? "8t" : "S"); testutil_check(session->create(session, opts->uri, buf)); testutil_check(session->close(session, NULL)); page_init(5000); /* Force to disk and re-open. */ testutil_check(opts->conn->close(opts->conn, NULL)); testutil_check(wiredtiger_open(opts->home, NULL, NULL, &opts->conn)); (void)signal(SIGINT, onsig); cs = clock(); id = 0; for (i = 0; i < opts->n_append_threads; ++i, ++id) { printf("append: %" PRIu64 "/n", id); testutil_check(pthread_create( &idlist[id], NULL, thread_append, (void *)opts)); } for (i = 0; i < id; ++i) testutil_check(pthread_join(idlist[i], NULL)); ce = clock(); printf("%" PRIu64 "M records: %.2lf processor seconds/n", opts->max_inserted_id / MILLION, (ce - cs) / (double)CLOCKS_PER_SEC); testutil_cleanup(opts); return (EXIT_SUCCESS);}
开发者ID:judahschvimer,项目名称:mongo,代码行数:60,
示例11: cleanupvoidcleanup(void){ uint32_t i; for (i = 0; i < g.c_ops; i++) free(g.entries[i]); free(g.entries); testutil_check(g.wt_session->close(g.wt_session, NULL)); testutil_check(g.wt_conn->close(g.wt_conn, NULL));}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:11,
示例12: verifyvoidverify(const char *name){ WT_SESSION *session; testutil_check(conn->open_session(conn, NULL, NULL, &session)); testutil_check(session->verify(session, name, NULL)); testutil_check(session->close(session, NULL));}
开发者ID:bsamek,项目名称:wiredtiger,代码行数:11,
示例13: op_bulk_unique/* * Create a guaranteed unique table and open and close a bulk cursor on it. */voidop_bulk_unique(void *arg){ TEST_OPTS *opts; TEST_PER_THREAD_OPTS *args; WT_CURSOR *c; WT_RAND_STATE rnd; WT_SESSION *session; int ret; char new_uri[64]; args = (TEST_PER_THREAD_OPTS *)arg; opts = args->testopts; __wt_random_init_seed(NULL, &rnd); testutil_check( opts->conn->open_session(opts->conn, NULL, NULL, &session)); /* Generate a unique object name. */ testutil_check(__wt_snprintf( new_uri, sizeof(new_uri), "%s.%" PRIu64, opts->uri, __wt_atomic_add64(&opts->unique_id, 1))); testutil_check(session->create(session, new_uri, DEFAULT_TABLE_SCHEMA)); __wt_yield(); /* * Opening a bulk cursor may have raced with a forced checkpoint * which created a checkpoint of the empty file, and triggers an EINVAL. */ if ((ret = session->open_cursor( session, new_uri, NULL, "bulk,checkpoint_wait=false", &c)) == 0) { testutil_check(c->close(c)); } else if (ret != EINVAL && ret != EBUSY) testutil_die(ret, "session.open_cursor bulk unique: %s", new_uri); while ((ret = session->drop(session, new_uri, __wt_random(&rnd) & 1 ? "force,checkpoint_wait=false" : "checkpoint_wait=false")) != 0) if (ret != EBUSY) testutil_die(ret, "session.drop: %s", new_uri); else /* * The EBUSY is expected when we run with * checkpoint_wait set to false, so we increment the * counter while in this loop to avoid false positives. */ args->thread_counter++; testutil_check(session->close(session, NULL)); args->thread_counter++;}
开发者ID:ajdavis,项目名称:mongo,代码行数:55,
示例14: salvage/* * salvage -- * A single salvage. */static voidsalvage(void){ WT_CONNECTION *conn; WT_SESSION *session; conn = g.wts_conn; track("salvage", 0ULL, NULL); testutil_check(conn->open_session(conn, NULL, NULL, &session)); testutil_check(session->salvage(session, g.uri, "force=true")); testutil_check(session->close(session, NULL));}
开发者ID:wiredtiger,项目名称:wiredtiger,代码行数:17,
示例15: thread_func/* * Each thread inserts a set of keys into the record store database. The keys * are generated in such a way that there are large gaps in the key range. */static void *thread_func(void *arg){ TEST_OPTS *opts; WT_CURSOR *cursor, *idx_cursor; WT_SESSION *session; uint64_t i, ins_rotor, ins_thr_idx, thr_idx, ts; uint64_t *obj_data; opts = (TEST_OPTS *)arg; thr_idx = __wt_atomic_fetch_addv64(&opts->next_threadid, 1); ts = g_ts; obj_data = dcalloc( (NR_OBJECTS/NR_THREADS + 1) * NR_FIELDS, sizeof(*obj_data)); testutil_check(opts->conn->open_session( opts->conn, NULL, NULL, &session)); testutil_check(session->open_cursor( session, opts->uri, NULL, NULL, &cursor)); testutil_check(session->open_cursor( session, "table:index", NULL, NULL, &idx_cursor)); for (ins_rotor = 1; ins_rotor < 10; ++ins_rotor) { for (ins_thr_idx = thr_idx, i = 0; ins_thr_idx < NR_OBJECTS; ins_thr_idx += NR_THREADS, i += NR_FIELDS) { testutil_check( session->begin_transaction(session, "sync=false")); cursor->set_key(cursor, ins_thr_idx << 40 | ins_rotor); cursor->set_value(cursor, ts, obj_data[i+0], obj_data[i+1], obj_data[i+2], obj_data[i+3], obj_data[i+4], obj_data[i+5], obj_data[i+6], obj_data[i+7]); testutil_check(cursor->insert(cursor)); idx_cursor->set_key( idx_cursor, ins_thr_idx << 40 | ts); idx_cursor->set_value(idx_cursor, ins_rotor); testutil_check(idx_cursor->insert(idx_cursor)); testutil_check( session->commit_transaction(session, NULL)); /* change object fields */ ++obj_data[i + ((ins_thr_idx + ins_rotor) % NR_FIELDS)]; ++obj_data[i + ((ins_thr_idx + ins_rotor + 1) % NR_FIELDS)]; ++g_ts; /* 5K updates/sec */ (void)usleep(1000000ULL * NR_THREADS / 5000); } } testutil_check(session->close(session, NULL)); free(obj_data); return (NULL);}
开发者ID:jbreams,项目名称:mongo,代码行数:64,
示例16: query_docsstatic voidquery_docs(WT_CURSOR *cursor, bool mod){ WT_ITEM key, value; int i; for (i = 0; i < NUM_QUERIES; i++) { testutil_check(cursor->next(cursor)); testutil_check(cursor->get_key(cursor, &key)); testutil_check(cursor->get_value(cursor, &value)); check_str((uint64_t)key.data, (char *)value.data, mod); } printf("%d documents read/n", NUM_QUERIES);}
开发者ID:ajdavis,项目名称:mongo,代码行数:14,
示例17: salvage/* * salvage -- * A single salvage. */static voidsalvage(void){ WT_CONNECTION *conn; WT_DECL_RET; WT_SESSION *session; conn = g.wts_conn; track("salvage", 0ULL, NULL); testutil_check(conn->open_session(conn, NULL, NULL, &session)); if ((ret = session->salvage(session, g.uri, "force=true")) != 0) testutil_die(ret, "session.salvage: %s", g.uri); testutil_check(session->close(session, NULL));}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:19,
示例18: setup_log_file/* Setup the logging output mechanism. */intsetup_log_file(WTPERF *wtperf){ CONFIG_OPTS *opts; size_t len; int ret; char *fname; opts = wtperf->opts; ret = 0; if (opts->verbose < 1) return (0); len = strlen(wtperf->monitor_dir) + strlen(opts->table_name) + strlen(".stat") + 2; fname = dmalloc(len); testutil_check(__wt_snprintf(fname, len, "%s/%s.stat", wtperf->monitor_dir, opts->table_name)); if ((wtperf->logf = fopen(fname, "w")) == NULL) { ret = errno; fprintf(stderr, "%s: %s/n", fname, strerror(ret)); } free(fname); if (wtperf->logf == NULL) return (ret); /* Use line buffering for the log file. */ __wt_stream_set_line_buffer(wtperf->logf); return (0);}
开发者ID:DINKIN,项目名称:mongo,代码行数:32,
示例19: obj_create_uniquevoidobj_create_unique(int force){ WT_SESSION *session; int ret; char new_uri[64]; if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) testutil_die(ret, "conn.session"); /* Generate a unique object name. */ if ((ret = pthread_rwlock_wrlock(&single)) != 0) testutil_die(ret, "pthread_rwlock_wrlock single"); testutil_check(__wt_snprintf( new_uri, sizeof(new_uri), "%s.%u", uri, ++uid)); if ((ret = pthread_rwlock_unlock(&single)) != 0) testutil_die(ret, "pthread_rwlock_unlock single"); if ((ret = session->create(session, new_uri, config)) != 0) testutil_die(ret, "session.create"); __wt_yield(); while ((ret = session->drop( session, new_uri, force ? "force" : NULL)) != 0) if (ret != EBUSY) testutil_die(ret, "session.drop: %s", new_uri); if ((ret = session->close(session, NULL)) != 0) testutil_die(ret, "session.close");}
开发者ID:DINKIN,项目名称:mongo,代码行数:30,
注:本文中的testutil_check函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tet_printf函数代码示例 C++ tests_start_mpfr函数代码示例 |