Browse Source

TT#101150 use STATS_INC macro for req stats

Change-Id: I7d205e4f6b168ac1031737e80a3bb6d7f455dc25
pull/1373/head
Richard Fuchs 4 years ago
parent
commit
2b60a678e2
2 changed files with 9 additions and 9 deletions
  1. +3
    -3
      daemon/control_ng.c
  2. +6
    -6
      t/test-stats.c

+ 3
- 3
daemon/control_ng.c View File

@ -350,15 +350,15 @@ int control_ng_process(str *buf, const endpoint_t *sin, char *addr,
// XXX could generalise these, same as above
switch (command) {
case NGC_OFFER:
atomic64_inc(&rtpe_stats.ax.offers);
RTPE_STATS_INC(offers);
timeval_update_request_time(&rtpe_totalstats_interval.offer, &cmd_process_time);
break;
case NGC_ANSWER:
atomic64_inc(&rtpe_stats.ax.answers);
RTPE_STATS_INC(answers);
timeval_update_request_time(&rtpe_totalstats_interval.answer, &cmd_process_time);
break;
case NGC_DELETE:
atomic64_inc(&rtpe_stats.ax.deletes);
RTPE_STATS_INC(deletes);
timeval_update_request_time(&rtpe_totalstats_interval.delete, &cmd_process_time);
break;
default:


+ 6
- 6
t/test-stats.c View File

@ -367,11 +367,11 @@ int main(void) {
"]\n"
"}\n");
atomic64_inc(&rtpe_stats.ax.offers);
RTPE_STATS_INC(offers);
struct timeval diff = {2,500000};
timeval_update_request_time(&rtpe_totalstats_interval.offer, &diff);
atomic64_inc(&rtpe_stats.ax.offers);
RTPE_STATS_INC(offers);
diff = (struct timeval) {3,200000};
timeval_update_request_time(&rtpe_totalstats_interval.offer, &diff);
@ -669,7 +669,7 @@ int main(void) {
"]\n"
"}\n");
atomic64_inc(&rtpe_stats.ax.answers);
RTPE_STATS_INC(answers);
diff = (struct timeval) {3,200000};
timeval_update_request_time(&rtpe_totalstats_interval.answer, &diff);
@ -970,17 +970,17 @@ int main(void) {
// test cmd_ps_min/max/avg
call_timer(NULL);
atomic64_add(&rtpe_stats.ax.offers, 100);
RTPE_STATS_ADD(offers, 100);
rtpe_now.tv_sec += 2;
atomic64_add(&rtpe_stats.ax.offers, 20);
RTPE_STATS_ADD(offers, 20);
call_timer(NULL);
// timer run time interval increased
rtpe_now.tv_sec += 5;
atomic64_add(&rtpe_stats.ax.offers, 200);
RTPE_STATS_ADD(offers, 200);
call_timer(NULL);
graph_str = print_graphite_data(&rtpe_totalstats_lastinterval);


Loading…
Cancel
Save