Пример #1
0
CSTUB_FN(int, treadp)(struct usr_inv_cap *uc,
                      spdid_t spdid, td_t td, int *off, int *sz)
{
    int ret;
    long fault = 0;
    CSTUB_INVOKE_3RETS(ret, fault, *off, *sz, uc, 2, spdid, td);
    return ret;
}
CSTUB_FN(int, treadp)(struct usr_inv_cap *uc,
                      spdid_t spdid, td_t td, int len, int *off, int *sz)
{
    int ret;
    long fault = 0;


    /* printc("<<<rtorrent In: call treadp (thread %d, spd %ld) >>>\n", cos_get_thd_id(), cos_spd_id()); */
    struct rec_data_tor *rd;
    volatile unsigned long long start, end;

redo:
    /* printc("cli: treadp (spd %ld thd %d td %d)\n", cos_spd_id(), cos_get_thd_id(), td); */
    rd = rd_update(td, STATE_TREAD);
    assert(rd);

    /* printc("treadp cli (before): len %d off %d sz %d\n", len, *off, *sz); */

    rdtscll(ubenchmark_end);
    if (treadp_ubenchmark_flag) {
        treadp_ubenchmark_flag = 0;
        printc("treadp(c3):recover per object end-end cost: %llu\n",
               ubenchmark_end - ubenchmark_start);
    }
    CSTUB_INVOKE_3RETS(ret, fault, *off, *sz, uc, 3, spdid, rd->s_tid, len);
    if (unlikely(fault)) {
        /* printc("treadp found a fault and ready to go to redo\n"); */
        /* printc("treadp cli (in fault): ret %d len %d off %d sz %d\n",  */
        /*        ret, len, *off, *sz); */
        treadp_ubenchmark_flag = 1;
        rdtscll(ubenchmark_start);


        CSTUB_FAULT_UPDATE();
        goto redo;
    }

    /* printc("treadp cli (after): len %d off %d sz %d\n", len, *off, *sz); */

    return ret;
}