ogg_packet * get_next_video_op() { return get_next_op(video_stream); }
void * populate_thread(void *arg) { CONFIG *cfg; WT_CONNECTION *conn; WT_CURSOR *cursor; WT_SESSION *session; char *data_buf, *key_buf; int ret; uint64_t op; cfg = (CONFIG *)arg; conn = cfg->conn; session = NULL; data_buf = key_buf = NULL; cfg->phase = WT_PERF_POP; data_buf = calloc(cfg->data_sz, 1); if (data_buf == NULL) { lprintf(cfg, ENOMEM, 0, "Populate data buffer"); goto err; } key_buf = calloc(cfg->key_sz + 1, 1); if (key_buf == NULL) { lprintf(cfg, ENOMEM, 0, "Populate key buffer"); goto err; } /* Open a session for the current thread's work. */ if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) { lprintf(cfg, ret, 0, "Error opening a session on %s", cfg->home); goto err; } /* Do a bulk load if populate is single-threaded. */ if ((ret = session->open_cursor( session, cfg->uri, NULL, cfg->populate_threads == 1 ? "bulk" : NULL, &cursor)) != 0) { lprintf(cfg, ret, 0, "Error opening cursor %s", cfg->uri); goto err; } memset(data_buf, 'a', cfg->data_sz - 1); cursor->set_value(cursor, data_buf); /* Populate the database. */ while (1) { get_next_op(&op); if (op > cfg->icount) break; sprintf(key_buf, "%0*" PRIu64, cfg->key_sz, op); cursor->set_key(cursor, key_buf); if ((ret = cursor->insert(cursor)) != 0) { lprintf(cfg, ret, 0, "Failed inserting"); goto err; } } /* To ensure managing thread knows if we exited early. */ err: if (ret != 0) ++g_threads_quit; if (session != NULL) session->close(session, NULL); if (data_buf) free(data_buf); if (key_buf) free(key_buf); return (arg); }
ogg_packet * get_next_audio_op() { return get_next_op(audio_stream); }