예제 #1
0
/**
 *******************************************************************************
 * \brief
 ******************************************************************************/
void kv_async_init_ctxt(uint32_t ctxt, uint32_t secs)
{
    char            *env_FVT = getenv("FVT_DEV");
    async_context_t *pCT     = pCTs+ctxt;

    if (ctxt < 0 || ctxt > KV_ASYNC_MAX_CONTEXTS)
    {
        printf("FFDC: kv_async_init_ctxt %d %X\n", ctxt, ctxt);
        return;
    }
    memset(pCT,       0, sizeof(async_context_t));
    memset(pCT->pCBs, 0, sizeof(async_CB_t)*KV_ASYNC_JOB_Q);

    ASSERT_EQ(0, ark_create_verbose(env_FVT, &pCT->ark,
                                    1048576,
                                    4096,
                                    1048576,
                                    20,
                                    256,
                                    8*1024,
                                    ARK_KV_VIRTUAL_LUN));
    ASSERT_TRUE(NULL != pCT->ark);

    pCT->flags |= KV_ASYNC_CT_RUNNING;
    pCT->secs   = secs;
    KV_TRC(pFT, "init_ctxt ctxt:%d ark:%p secs:%d", ctxt, pCT->ark, pCT->secs);
}
예제 #2
0
/**
 *******************************************************************************
 * \brief
 ******************************************************************************/
uint32_t kv_async_init_ctxt_perf(uint32_t ctxt, uint32_t npool, uint32_t secs)
{
    char            *env_FVT = getenv("FVT_DEV");
    async_context_t *pCT     = pCTs+ctxt;

    if (ctxt < 0 || ctxt > KV_ASYNC_MAX_CONTEXTS)
    {
        printf("FFDC: kv_async_init_ctxt %d %X\n", ctxt, ctxt);
        return EINVAL;
    }
    memset(pCT,       0, sizeof(async_context_t));
    memset(pCT->pCBs, 0, sizeof(async_CB_t)*KV_ASYNC_JOB_Q);

    if (ark_create_verbose(env_FVT, &pCT->ark,
                                        1048576,
                                        4096,
                                        1048576,
                                        npool,
                                        256,
                                        8*1024,
                                        ARK_KV_VIRTUAL_LUN))
    {
        printf("ark_create failed for ctxt:%d\n", ctxt);
        return ENOMEM;
    }
    if (NULL == pCT->ark) return ENOMEM;

    pCT->flags |= KV_ASYNC_CT_RUNNING;
    pCT->secs   = secs;
    KV_TRC(pFT, "init_ctxt ctxt:%d ark:%p", ctxt, pCT->ark);
    return 0;
}
예제 #3
0
int ark_create(char *path, ARK **arkret, uint64_t flags)
{
  return ark_create_verbose(path, arkret, 
                            ARK_VERBOSE_SIZE_DEF, 
                            ARK_VERBOSE_BSIZE_DEF,
                            ARK_VERBOSE_HASH_DEF,
                            ARK_VERBOSE_NTHRDS_DEF, 
                            ARK_MAX_ASYNC_OPS,
                            ARK_EA_BLK_ASYNC_CMDS,
                            flags);
}
예제 #4
0
/**
 *******************************************************************************
 * \brief
 ******************************************************************************/
void Sync_pth::run_multi_ctxt_wr(uint32_t  num_ctxt,
                                 uint32_t  num_pth,
                                 uint32_t  npool,
                                 uint32_t  vlen,
                                 uint32_t  LEN,
                                 uint32_t  secs)
{
    uint32_t        i        = 0;
    uint32_t        ctxt_i   = 0;
    uint32_t        pth_i    = 0;
    uint32_t        klen     = 16;
    uint32_t        tot_pth  = num_ctxt * num_pth;
    set_get_args_t  pth_args[tot_pth];
    ARK            *ark[num_ctxt];
    kv_t           *db[num_pth];
    struct timeval  stop, start;
    uint64_t        ops      = 0;
    uint64_t        ios      = 0;
    uint32_t        t_ops    = 0;
    uint32_t        t_ios    = 0;

    if (num_pth > MAX_PTH_PER_CONTEXT)
    {
        printf("cannot exceed %d pthreads for sync ops\n", MAX_PTH_PER_CONTEXT);
        return;
    }

    memset(pth_args, 0, sizeof(set_get_args_t) * tot_pth);

    /* alloc one set of db's, to be used for each context */
    for (i=0; i<num_pth; i++)
    {
        db[i] = (kv_t*)kv_db_create_fixed(LEN, klen+i, vlen+i);
    }
    /* alloc one ark for each context */
    for (ctxt_i=0; ctxt_i<num_ctxt; ctxt_i++)
    {
        ASSERT_EQ(0, ark_create_verbose(getenv("FVT_DEV"), &ark[ctxt_i],
                                        1048576,
                                        4096,
                                        1048576,
                                        npool,
                                        256,
                                        8*1024,
                                        ARK_KV_VIRTUAL_LUN));
        ASSERT_TRUE(NULL != ark[ctxt_i]);
    }

    /* start timer */
    gettimeofday(&start, NULL);

    /* init each pth per context and run the pth */
    ctxt_i = 0;
    i      = 0;
    while (i < tot_pth)
    {
        pth_args[i].ark  = ark[ctxt_i];
        pth_args[i].db   = db[pth_i];
        pth_args[i].vlen = vlen+pth_i;
        pth_args[i].LEN  = LEN;
        pth_args[i].secs = secs;
        run_write_loop(pth_args+i);
        ++pth_i;
        ++i;
        if ((i%num_pth) == 0)
        {
            /* reset for next context */
            ++ctxt_i;
            pth_i = 0;
        }
    }
    printf("SYNC %dx%dx%d ctxt:%d pth:%d npool:%d ",
                     klen, vlen, LEN, num_ctxt, num_pth, npool); fflush(stdout);
    for (i=0; i<tot_pth; i++)
    {
        wait(pth_args+i);
    }

    /* stop timer */
    gettimeofday(&stop, NULL);
    secs = stop.tv_sec - start.tv_sec;

    t_ops = 0;
    t_ios = 0;

    for (i=0; i<num_ctxt; i++)
    {
        (void)ark_stats(ark[i], &ops, &ios);
        t_ops += (uint32_t)ops;
        t_ios += (uint32_t)ios;
        EXPECT_EQ(0, ark_delete(ark[i]));
    }
    for (i=0; i<num_pth; i++)
    {
        kv_db_destroy(db[i], LEN);
    }
    t_ops = t_ops / secs;
    t_ios = t_ios / secs;
    printf("op/s:%d io/s:%d secs:%d\n", t_ops, t_ios, secs);
}