diff --git a/daemon/aux.h b/daemon/aux.h index 3552393da..b5092526d 100644 --- a/daemon/aux.h +++ b/daemon/aux.h @@ -547,6 +547,11 @@ INLINE u_int64_t atomic_uint64_get_set(atomic_uint64 *u, u_int64_t a) { return old; } while (1); } +INLINE void atomic_uint64_local_copy_zero(atomic_uint64 *dst, atomic_uint64 *src) { + atomic_uint64_set_na(dst, atomic_uint64_get_set(src, 0)); +} +#define atomic_uint64_local_copy_zero_struct(d, s, member) \ + atomic_uint64_local_copy_zero(&((d)->member), &((s)->member)) #endif diff --git a/daemon/call.c b/daemon/call.c index a54c55bef..b81755b88 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1086,7 +1086,6 @@ next: for (i = c->monologues; i; i = i->next) { ml = i->data; - memset(&ml->terminated,0,sizeof(struct timeval)); gettimeofday(&(ml->terminated),NULL); if (tmp_t_reason==1) { ml->term_reason = TIMEOUT; @@ -1306,9 +1305,9 @@ static void callmaster_timer(void *ptr) { g_hash_table_foreach(m->callhash, call_timer_iterator, &hlp); rwlock_unlock_r(&m->hashlock); - atomic_uint64_set_na(&tmpstats.bytes, atomic_uint64_get_set(&m->statsps.bytes, 0)); - atomic_uint64_set_na(&tmpstats.packets, atomic_uint64_get_set(&m->statsps.packets, 0)); - atomic_uint64_set_na(&tmpstats.errors, atomic_uint64_get_set(&m->statsps.errors, 0)); + atomic_uint64_local_copy_zero_struct(&tmpstats, &m->statsps, bytes); + atomic_uint64_local_copy_zero_struct(&tmpstats, &m->statsps, packets); + atomic_uint64_local_copy_zero_struct(&tmpstats, &m->statsps, errors); atomic_uint64_set(&m->stats.bytes, atomic_uint64_get_na(&tmpstats.bytes)); atomic_uint64_set(&m->stats.packets, atomic_uint64_get_na(&tmpstats.packets)); @@ -1413,7 +1412,8 @@ struct callmaster *callmaster_new(struct poller *p) { poller_add_timer(p, callmaster_timer, &c->obj); - mutex_init(&c->totalstats_lock); + mutex_init(&c->totalstats.total_average_lock); + mutex_init(&c->totalstats_interval.total_average_lock); c->totalstats.started = poller_now; mutex_init(&c->cngs_lock); @@ -2379,9 +2379,9 @@ void timeval_multiply(struct timeval *result, const struct timeval *a, const lon result->tv_usec = microseconds%(long)1000000; } -void timeval_devide(struct timeval *result, const struct timeval *a, const long devisor) { +void timeval_divide(struct timeval *result, const struct timeval *a, const long divisor) { long microseconds=0; - microseconds = (((long)a->tv_sec * 1000000) + (long)a->tv_usec) / devisor; + microseconds = (((long)a->tv_sec * 1000000) + (long)a->tv_usec) / divisor; result->tv_sec = microseconds/(long)1000000; result->tv_usec = microseconds%(long)1000000; } @@ -2393,6 +2393,31 @@ void timeval_add(struct timeval *result, const struct timeval *a, const struct t result->tv_usec = microseconds%(long)1000000; } +static void timeval_totalstats_average_add(struct totalstats *s, const struct timeval *add) { + struct timeval dp, oa; + + mutex_lock(&s->total_average_lock); + + // new average = ((old average * old num sessions) + datapoint) / new num sessions + // ... but this will overflow when num sessions becomes very large + + // timeval_multiply(&t, &s->total_average_call_dur, s->total_managed_sess); + // timeval_add(&t, &t, add); + // s->total_managed_sess++; + // timeval_divide(&s->total_average_call_dur, &t, s->total_managed_sess); + + // alternative: + // new average = old average + (datapoint / new num sessions) - (old average / new num sessions) + + s->total_managed_sess++; + timeval_divide(&dp, add, s->total_managed_sess); + timeval_divide(&oa, &s->total_average_call_dur, s->total_managed_sess); + timeval_add(&s->total_average_call_dur, &s->total_average_call_dur, &dp); + timeval_subtract(&s->total_average_call_dur, &s->total_average_call_dur, &oa); + + mutex_unlock(&s->total_average_lock); +} + /* called lock-free, but must hold a reference to the call */ void call_destroy(struct call *c) { struct callmaster *m = c->callmaster; @@ -2437,9 +2462,8 @@ void call_destroy(struct call *c) { cdrbufcur += sprintf(cdrbufcur,"tos=%u, ", (unsigned int)c->tos); for (l = c->monologues; l; l = l->next) { ml = l->data; + timeval_subtract(&tim_result_duration,&ml->terminated,&ml->started); if (_log_facility_cdr) { - memset(&tim_result_duration,0,sizeof(struct timeval)); - timeval_subtract(&tim_result_duration,&ml->terminated,&ml->started); cdrbufcur += sprintf(cdrbufcur, "ml%i_start_time=%ld.%06lu, " "ml%i_end_time=%ld.%06ld, " "ml%i_duration=%ld.%06ld, " @@ -2509,12 +2533,14 @@ void call_destroy(struct call *c) { atomic_uint64_get(&ps->stats.errors), (unsigned long long) atomic_uint64_get(&ps->last_packet)); - mutex_lock(&m->totalstats_lock); - m->totalstats.total_relayed_packets += atomic_uint64_get(&ps->stats.packets); - m->totalstats_interval.total_relayed_packets += atomic_uint64_get(&ps->stats.packets); - m->totalstats.total_relayed_errors += atomic_uint64_get(&ps->stats.errors); - m->totalstats_interval.total_relayed_errors += atomic_uint64_get(&ps->stats.errors); - mutex_unlock(&m->totalstats_lock); + atomic_uint64_add(&m->totalstats.total_relayed_packets, + atomic_uint64_get(&ps->stats.packets)); + atomic_uint64_add(&m->totalstats_interval.total_relayed_packets, + atomic_uint64_get(&ps->stats.packets)); + atomic_uint64_add(&m->totalstats.total_relayed_errors, + atomic_uint64_get(&ps->stats.errors)); + atomic_uint64_add(&m->totalstats_interval.total_relayed_errors, + atomic_uint64_get(&ps->stats.errors)); } } if (_log_facility_cdr) @@ -2522,10 +2548,7 @@ void call_destroy(struct call *c) { } // --- for statistics getting one way stream or no relay at all - mutex_lock(&m->totalstats_lock); - m->totalstats.total_nopacket_relayed_sess *= 2; - m->totalstats_interval.total_nopacket_relayed_sess *= 2; - mutex_unlock(&m->totalstats_lock); + int total_nopacket_relayed_sess = 0; for (l = c->monologues; l; l = l->next) { ml = l->data; @@ -2564,51 +2587,37 @@ void call_destroy(struct call *c) { } if (ps && ps2 && atomic_uint64_get(&ps2->stats.packets)==0) { - mutex_lock(&m->totalstats_lock); if (atomic_uint64_get(&ps->stats.packets)!=0) { - m->totalstats.total_oneway_stream_sess++; - m->totalstats_interval.total_oneway_stream_sess++; + atomic_uint64_inc(&m->totalstats.total_oneway_stream_sess); + atomic_uint64_inc(&m->totalstats_interval.total_oneway_stream_sess); } else { - m->totalstats.total_nopacket_relayed_sess++; - m->totalstats_interval.total_nopacket_relayed_sess++; + total_nopacket_relayed_sess++; } - mutex_unlock(&m->totalstats_lock); } } - mutex_lock(&m->totalstats_lock); - - m->totalstats.total_nopacket_relayed_sess /= 2; - m->totalstats_interval.total_nopacket_relayed_sess /= 2; - m->totalstats.total_managed_sess += 1; - m->totalstats_interval.total_managed_sess += 1; + atomic_uint64_add(&m->totalstats.total_nopacket_relayed_sess, total_nopacket_relayed_sess / 2); + atomic_uint64_add(&m->totalstats_interval.total_nopacket_relayed_sess, total_nopacket_relayed_sess / 2); ml = c->monologues->data; if (ml->term_reason==TIMEOUT) { - m->totalstats.total_timeout_sess++; - m->totalstats_interval.total_timeout_sess++; + atomic_uint64_inc(&m->totalstats.total_timeout_sess); + atomic_uint64_inc(&m->totalstats_interval.total_timeout_sess); } else if (ml->term_reason==SILENT_TIMEOUT) { - m->totalstats.total_silent_timeout_sess++; - m->totalstats_interval.total_silent_timeout_sess++; + atomic_uint64_inc(&m->totalstats.total_silent_timeout_sess); + atomic_uint64_inc(&m->totalstats_interval.total_silent_timeout_sess); } else if (ml->term_reason==REGULAR) { - m->totalstats.total_regular_term_sess++; - m->totalstats_interval.total_regular_term_sess++; + atomic_uint64_inc(&m->totalstats.total_regular_term_sess); + atomic_uint64_inc(&m->totalstats_interval.total_regular_term_sess); } else if (ml->term_reason==FORCED) { - m->totalstats.total_forced_term_sess++; - m->totalstats_interval.total_forced_term_sess++; + atomic_uint64_inc(&m->totalstats.total_forced_term_sess); + atomic_uint64_inc(&m->totalstats_interval.total_forced_term_sess); } - timeval_multiply(&m->totalstats.total_average_call_dur,&m->totalstats.total_average_call_dur,m->totalstats.total_managed_sess-1); - timeval_add(&m->totalstats.total_average_call_dur,&m->totalstats.total_average_call_dur,&tim_result_duration); - timeval_devide(&m->totalstats.total_average_call_dur,&m->totalstats.total_average_call_dur,m->totalstats.total_managed_sess); - - timeval_multiply(&m->totalstats_interval.total_average_call_dur,&m->totalstats_interval.total_average_call_dur,m->totalstats_interval.total_managed_sess-1); - timeval_add(&m->totalstats_interval.total_average_call_dur,&m->totalstats_interval.total_average_call_dur,&tim_result_duration); - timeval_devide(&m->totalstats_interval.total_average_call_dur,&m->totalstats_interval.total_average_call_dur,m->totalstats_interval.total_managed_sess); - - mutex_unlock(&m->totalstats_lock); + timeval_totalstats_average_add(&m->totalstats, &tim_result_duration); + timeval_totalstats_average_add(&m->totalstats_interval, &tim_result_duration); if (_log_facility_cdr) /* log it */ @@ -2846,6 +2855,7 @@ struct call_monologue *__monologue_create(struct call *call) { ret->created = poller_now; ret->other_tags = g_hash_table_new(str_hash, str_equal); g_queue_init(&ret->medias); + gettimeofday(&ret->started, NULL); call->monologues = g_slist_prepend(call->monologues, ret); @@ -3020,7 +3030,6 @@ int call_delete_branch(struct callmaster *m, const str *callid, const str *branc for (i = c->monologues; i; i = i->next) { ml = i->data; - memset(&ml->terminated,0,sizeof(struct timeval)); gettimeofday(&(ml->terminated), NULL); ml->term_reason = REGULAR; } diff --git a/daemon/call.h b/daemon/call.h index b1954b88c..731d80abf 100644 --- a/daemon/call.h +++ b/daemon/call.h @@ -195,16 +195,18 @@ struct stats { struct totalstats { time_t started; + atomic_uint64 total_timeout_sess; + atomic_uint64 total_silent_timeout_sess; + atomic_uint64 total_regular_term_sess; + atomic_uint64 total_forced_term_sess; + atomic_uint64 total_relayed_packets; + atomic_uint64 total_relayed_errors; + atomic_uint64 total_nopacket_relayed_sess; + atomic_uint64 total_oneway_stream_sess; + + mutex_t total_average_lock; /* for these two below */ u_int64_t total_managed_sess; - u_int64_t total_timeout_sess; - u_int64_t total_silent_timeout_sess; - u_int64_t total_regular_term_sess; - u_int64_t total_forced_term_sess; - u_int64_t total_relayed_packets; - u_int64_t total_relayed_errors; - u_int64_t total_nopacket_relayed_sess; - u_int64_t total_oneway_stream_sess; - struct timeval total_average_call_dur; + struct timeval total_average_call_dur; }; struct udp_fd { @@ -409,7 +411,6 @@ struct callmaster { /* XXX rework these */ struct stats statsps; /* per second stats, running timer */ struct stats stats; /* copied from statsps once a second */ - mutex_t totalstats_lock; /* for both of them */ struct totalstats totalstats; struct totalstats totalstats_interval; /* control_ng_stats stuff */ @@ -468,7 +469,7 @@ const struct transport_protocol *transport_protocol(const str *s); void timeval_subtract (struct timeval *result, const struct timeval *a, const struct timeval *b); void timeval_multiply(struct timeval *result, const struct timeval *a, const long multiplier); -void timeval_devide(struct timeval *result, const struct timeval *a, const long devisor); +void timeval_divide(struct timeval *result, const struct timeval *a, const long divisor); void timeval_add(struct timeval *result, const struct timeval *a, const struct timeval *b); diff --git a/daemon/cli.c b/daemon/cli.c index afb376507..010656a69 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -25,36 +25,39 @@ static const char* TRUNCATED = " ... Output truncated. Increase Output Buffer static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m, char* replybuffer, const char* outbufend) { int printlen=0; + struct timeval avg; + u_int64_t num_sessions; - mutex_lock(&m->totalstats_lock); + mutex_lock(&m->totalstats.total_average_lock); + avg = m->totalstats.total_average_call_dur; + num_sessions = m->totalstats.total_managed_sess; + mutex_unlock(&m->totalstats.total_average_lock); printlen = snprintf(replybuffer,(outbufend-replybuffer), "\nTotal statistics (does not include current running sessions):\n\n"); ADJUSTLEN(printlen,outbufend,replybuffer); printlen = snprintf(replybuffer,(outbufend-replybuffer), " Uptime of rtpengine :%llu seconds\n", (unsigned long long)time(NULL)-m->totalstats.started); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total managed sessions :"UINT64F"\n", m->totalstats.total_managed_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total managed sessions :"UINT64F"\n", num_sessions); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total timed-out sessions via TIMEOUT :"UINT64F"\n",m->totalstats.total_timeout_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total timed-out sessions via TIMEOUT :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_timeout_sess)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total timed-out sessions via SILENT_TIMEOUT :"UINT64F"\n",m->totalstats.total_silent_timeout_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total timed-out sessions via SILENT_TIMEOUT :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_silent_timeout_sess)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total regular terminated sessions :"UINT64F"\n",m->totalstats.total_regular_term_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total regular terminated sessions :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_regular_term_sess)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total forced terminated sessions :"UINT64F"\n",m->totalstats.total_forced_term_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total forced terminated sessions :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_forced_term_sess)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total relayed packets :"UINT64F"\n",m->totalstats.total_relayed_packets); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total relayed packets :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_relayed_packets)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total relayed packet errors :"UINT64F"\n",m->totalstats.total_relayed_errors); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total relayed packet errors :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_relayed_errors)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total number of streams with no relayed packets :"UINT64F"\n", m->totalstats.total_nopacket_relayed_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total number of streams with no relayed packets :"UINT64F"\n", atomic_uint64_get(&m->totalstats.total_nopacket_relayed_sess)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total number of 1-way streams :"UINT64F"\n",m->totalstats.total_oneway_stream_sess); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Total number of 1-way streams :"UINT64F"\n",atomic_uint64_get(&m->totalstats.total_oneway_stream_sess)); ADJUSTLEN(printlen,outbufend,replybuffer); - printlen = snprintf(replybuffer,(outbufend-replybuffer), " Average call duration :%ld.%06ld\n\n",m->totalstats.total_average_call_dur.tv_sec,m->totalstats.total_average_call_dur.tv_usec); + printlen = snprintf(replybuffer,(outbufend-replybuffer), " Average call duration :%ld.%06ld\n\n",avg.tv_sec,avg.tv_usec); ADJUSTLEN(printlen,outbufend,replybuffer); - mutex_unlock(&m->totalstats_lock); - printlen = snprintf(replybuffer,(outbufend-replybuffer), "Control statistics:\n\n"); ADJUSTLEN(printlen,outbufend,replybuffer); printlen = snprintf(replybuffer,(outbufend-replybuffer), " %10s | %10s | %10s | %10s | %10s | %10s | %10s | %10s \n", diff --git a/daemon/graphite.c b/daemon/graphite.c index 482dae3a1..1c76ccfbb 100644 --- a/daemon/graphite.c +++ b/daemon/graphite.c @@ -87,23 +87,36 @@ int send_graphite_data() { char data_to_send[8192]; memset(&data_to_send,0,8192); char* ptr = data_to_send; - mutex_lock(&cm->totalstats_lock); - - rc = sprintf(ptr,"%s.totals.average_call_dur.tv_sec %llu %llu\n",hostname, (unsigned long long) cm->totalstats_interval.total_average_call_dur.tv_sec,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.average_call_dur.tv_usec %llu %llu\n",hostname, (unsigned long long) cm->totalstats_interval.total_average_call_dur.tv_usec,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.forced_term_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_forced_term_sess,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.managed_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_managed_sess,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.nopacket_relayed_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_nopacket_relayed_sess,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.oneway_stream_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_oneway_stream_sess,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.regular_term_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_regular_term_sess,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.relayed_errors "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_relayed_errors,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.relayed_packets "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_relayed_packets,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.silent_timeout_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_silent_timeout_sess,(unsigned long long)g_now); ptr += rc; - rc = sprintf(ptr,"%s.totals.timeout_sess "UINT64F" %llu\n",hostname, cm->totalstats_interval.total_timeout_sess,(unsigned long long)g_now); ptr += rc; - - ZERO(cm->totalstats_interval); - - mutex_unlock(&cm->totalstats_lock); + struct totalstats ts; + + /* atomically copy values to stack and reset to zero */ + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_timeout_sess); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_silent_timeout_sess); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_regular_term_sess); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_forced_term_sess); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_relayed_packets); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_relayed_errors); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_nopacket_relayed_sess); + atomic_uint64_local_copy_zero_struct(&ts, &cm->totalstats_interval, total_oneway_stream_sess); + + mutex_lock(&cm->totalstats_interval.total_average_lock); + ts.total_average_call_dur = cm->totalstats_interval.total_average_call_dur; + ts.total_managed_sess = cm->totalstats_interval.total_managed_sess; + ZERO(ts.total_average_call_dur); + ZERO(ts.total_managed_sess); + mutex_unlock(&cm->totalstats_interval.total_average_lock); + + rc = sprintf(ptr,"%s.totals.average_call_dur.tv_sec %llu %llu\n",hostname, (unsigned long long) ts.total_average_call_dur.tv_sec,(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.average_call_dur.tv_usec %llu %llu\n",hostname, (unsigned long long) ts.total_average_call_dur.tv_usec,(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.forced_term_sess "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_forced_term_sess),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.managed_sess "UINT64F" %llu\n",hostname, ts.total_managed_sess,(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.nopacket_relayed_sess "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_nopacket_relayed_sess),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.oneway_stream_sess "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_oneway_stream_sess),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.regular_term_sess "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_regular_term_sess),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.relayed_errors "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_relayed_errors),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.relayed_packets "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_relayed_packets),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.silent_timeout_sess "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_silent_timeout_sess),(unsigned long long)g_now); ptr += rc; + rc = sprintf(ptr,"%s.totals.timeout_sess "UINT64F" %llu\n",hostname, atomic_uint64_get_na(&ts.total_timeout_sess),(unsigned long long)g_now); ptr += rc; rc = write(graphite_sock, data_to_send, strlen(data_to_send)); if (rc<0) {