예제 #1
0
파일: network.c 프로젝트: accre/lstore
int tbx_network_counter(tbx_network_t *net)
{
    int count;

    count = tbx_atomic_get(_cuid_counter);

    return(count);
}
예제 #2
0
int get_hpc_thread_count(portal_context_t *hpc)
{
    int n;

//  apr_thread_mutex_lock(hpc->lock);
//  n = hpc->running_threads;
//  apr_thread_mutex_unlock(hpc->lock);

    n = tbx_atomic_get(hpc->running_threads);
    return(n);
}
예제 #3
0
void thread_pool_stats_print()
{
    int i, total;

    log_printf(0, "--------Thread Pool Stats----------\n");
    log_printf(0, "Max Concurrency: %d\n", _tp_concurrent_max);
    log_printf(0, "Level  Concurrent     Total\n");
    for (i=0; i<TP_MAX_DEPTH; i++) {
        total = tbx_atomic_get(_tp_depth_total[i]);
        log_printf(0, " %2d    %10d  %10d\n", i, _tp_depth_concurrent_max[i], total);
    }
}
예제 #4
0
파일: data_block.c 프로젝트: accre/lstore
int data_block_serialize_text(lio_data_block_t *b, lio_exnode_exchange_t *exp)
{
    static int bufsize=2048;
    char capsbuf[bufsize];
    char *etext, *ekey;
    int cused, refcount;
    lio_data_block_attr_t *attr;

    cused = 0;

    tbx_append_printf(capsbuf, &cused, bufsize, "[block-" XIDT "]\n", b->id);
    tbx_append_printf(capsbuf, &cused, bufsize, "type=%s\n", ds_type(b->ds));
    tbx_append_printf(capsbuf, &cused, bufsize, "rid_key=%s\n", b->rid_key);
    tbx_append_printf(capsbuf, &cused, bufsize, "size=" XOT "\n", b->size);
    tbx_append_printf(capsbuf, &cused, bufsize, "max_size=" XOT "\n", b->max_size);
    refcount = tbx_atomic_get(b->ref_count);
    tbx_append_printf(capsbuf, &cused, bufsize, "ref_count=%d\n", refcount);

    etext = tbx_stk_escape_text("=#[]", '\\', ds_get_cap(b->ds, b->cap, DS_CAP_READ));
    tbx_append_printf(capsbuf, &cused, bufsize, "read_cap=%s\n", etext);
    free(etext);
    etext = tbx_stk_escape_text("=#[]", '\\', ds_get_cap(b->ds, b->cap, DS_CAP_WRITE));
    tbx_append_printf(capsbuf, &cused, bufsize, "write_cap=%s\n", etext);
    free(etext);
    etext = tbx_stk_escape_text("=#[]", '\\', ds_get_cap(b->ds, b->cap, DS_CAP_MANAGE));
    tbx_append_printf(capsbuf, &cused, bufsize, "manage_cap=%s\n", etext);
    free(etext);

    if (b->attr_stack != NULL) {  //** Deserialze the other attributes
        while ((attr = (lio_data_block_attr_t *)tbx_stack_pop(b->attr_stack)) != NULL) {
            if (attr->value != NULL) {
                ekey = tbx_stk_escape_text("=#[]", '\\', attr->key);
                etext = tbx_stk_escape_text("=#[]", '\\', attr->value);
                tbx_append_printf(capsbuf, &cused, bufsize, "%s=%s\n", ekey, etext);
                free(etext);
                free(ekey);
                free(attr->value);
            }

            free(attr->key);
            free(attr);
        }
    }

    tbx_append_printf(capsbuf, &cused, bufsize, "\n");

    //** Merge everything together and return it
    lio_exnode_exchange_t cexp;
    cexp.text.text = capsbuf;
    exnode_exchange_append(exp, &cexp);

    return(0);
}
예제 #5
0
int thread_pool_direct(gop_thread_pool_context_t *tpc, apr_thread_start_t fn, void *arg)
{
    int err = apr_thread_pool_push(tpc->tp, fn, arg, APR_THREAD_TASK_PRIORITY_NORMAL, NULL);

    tbx_atomic_inc(tpc->n_direct);

    log_printf(10, "tpd=%d\n", tbx_atomic_get(tpc->n_direct));
    if (err != APR_SUCCESS) {
        log_printf(0, "ERROR submiting task!  err=%d\n", err);
    }

    return((err == APR_SUCCESS) ? 0 : 1);
}
예제 #6
0
파일: op.c 프로젝트: accre/lstore
apr_time_t gop_get_end_time(gop_op_generic_t *gop, int *state)
{
    apr_time_t end_time;
    gop_command_op_t *cmd = &(gop->op->cmd);

    if (*state == 0) {
        *state = tbx_atomic_get(cmd->on_top);
        if (*state == 0) {
            end_time = apr_time_now() + apr_time_make(10,0);  //** Default to 10 secs while percolating to the top
        } else {  //** We're on top so use the official end time
            end_time = cmd->end_time;
        }
    } else {
        end_time = cmd->end_time;  //** This won't change after we're on top so no need to lock
    }
    return(end_time);
}