Skip to content

Commit

Permalink
Change callback func to match new data types
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Nov 11, 2013
1 parent bfe5e9d commit 368899c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/collectd.c
Expand Up @@ -30,13 +30,15 @@
/** Copy a 64bit unsigned integer into a double
*
*/
/*
static void _copy_uint64_to_double(UNUSED rs_t *conf, rs_stats_value_tmpl_t *tmpl)
{
assert(tmpl->src);
assert(tmpl->dst);
*((double *) tmpl->dst) = *((uint64_t *) tmpl->src);
}
*/

/*
static void _copy_uint64_to_uint64(UNUSED rs_t *conf, rs_stats_value_tmpl_t *tmpl)
Expand All @@ -53,7 +55,7 @@ static void _copy_double_to_double(UNUSED rs_t *conf, rs_stats_value_tmpl_t *tmp
assert(tmpl->src);
assert(tmpl->dst);

*((uint64_t *) tmpl->dst) = *((uint64_t *) tmpl->src);
*((double *) tmpl->dst) = *((double*) tmpl->src);
}


Expand Down Expand Up @@ -241,11 +243,11 @@ rs_stats_tmpl_t *rs_stats_collectd_init_latency(TALLOC_CTX *ctx, rs_stats_tmpl_t

/* not static so were thread safe */
rs_stats_value_tmpl_t const _packet_count[] = {
{ &stats->interval.received, LCC_TYPE_GAUGE, _copy_uint64_to_double, NULL },
{ &stats->interval.linked, LCC_TYPE_GAUGE, _copy_uint64_to_double, NULL },
{ &stats->interval.unlinked, LCC_TYPE_GAUGE, _copy_uint64_to_double, NULL },
{ &stats->interval.lost, LCC_TYPE_GAUGE, _copy_uint64_to_double, NULL },
{ &stats->interval.reused, LCC_TYPE_GAUGE, _copy_uint64_to_double, NULL },
{ &stats->interval.received, LCC_TYPE_GAUGE, _copy_double_to_double, NULL },
{ &stats->interval.linked, LCC_TYPE_GAUGE, _copy_double_to_double, NULL },
{ &stats->interval.unlinked, LCC_TYPE_GAUGE, _copy_double_to_double, NULL },
{ &stats->interval.lost, LCC_TYPE_GAUGE, _copy_double_to_double, NULL },
{ &stats->interval.reused, LCC_TYPE_GAUGE, _copy_double_to_double, NULL },
{ NULL, 0, NULL, NULL }
};

Expand Down Expand Up @@ -276,7 +278,7 @@ rs_stats_tmpl_t *rs_stats_collectd_init_latency(TALLOC_CTX *ctx, rs_stats_tmpl_t
for (i = 0; i < (int) (sizeof(rtx) / sizeof(rs_stats_value_tmpl_t)); i++) {
rtx[i].src = &stats->interval.rt[i];
rtx[i].type = LCC_TYPE_GAUGE;
rtx[i].cb = _copy_uint64_to_double;
rtx[i].cb = _copy_double_to_double;
rtx[i].dst = NULL;
}
memset(&rtx[RS_RETRANSMIT_MAX + 1], 0, sizeof(rs_stats_value_tmpl_t));
Expand Down

0 comments on commit 368899c

Please sign in to comment.