Exemple #1
0
int
lmt_cbr_get_metrics (char *names, List *rlp)
{
    int retval = -1;
    List rl = NULL;
    List nl = NULL;
    ListIterator itr = NULL;
    cerebro_t ch = NULL;
    char *name;

    if (!(ch = cerebro_handle_create()))
        goto done;
    nl = list_tok (names, ",");
    rl = list_create ((ListDelF)_destroy_cmetric);
    itr = list_iterator_create (nl);
    while ((name = list_next (itr))) {
        if (_get_metric_data (ch, name, rl) < 0)
            goto done;
    }
    *rlp = rl;
    retval = 0;
done:    
    if (itr)
        list_iterator_destroy (itr);
    if (retval < 0 && rl)
        list_destroy (rl);
    if (nl)
        list_destroy (nl);
    if (ch)
        cerebro_handle_destroy (ch);
    return retval;
}
Exemple #2
0
/* 
 * _cleanup_cerebro_stat
 *
 * cleanup globals
 */
static void
_cleanup_cerebro_stat(void)
{
  (void)cerebro_handle_destroy(handle);
}