From 304729edbbf08620760647696a121deceef69bc3 Mon Sep 17 00:00:00 2001 From: koekeishiya Date: Thu, 20 Feb 2020 12:25:46 +0100 Subject: [PATCH] .. --- src/event_loop.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/event_loop.c b/src/event_loop.c index d2ae32af..48965eb5 100644 --- a/src/event_loop.c +++ b/src/event_loop.c @@ -3,7 +3,7 @@ #ifdef STATS struct cycle_counter { - uint64_t total_cycle_count; + uint64_t cycle_count; uint64_t hit_count; }; @@ -12,22 +12,21 @@ static struct cycle_counter event_counters[EVENT_TYPE_COUNT]; #define cycle_counter_report(name, hit_count, total_cycles, elapsed_cycles) \ fprintf(stdout, "%30s: hits %'25lld | cur %'25lld | avg %'25lld\n",\ - name, hit_count, elapsed_cycles, total_cycles / hit_count); + name, hit_count, elapsed_cycles, total_cycles / hit_count) static inline void cycle_counter_tick(const char *name, struct cycle_counter *counter, uint64_t elapsed_cycles) { - counter->total_cycle_count += elapsed_cycles; + counter->cycle_count += elapsed_cycles; ++counter->hit_count; - cycle_counter_report(name, counter->hit_count, counter->total_cycle_count, elapsed_cycles) + cycle_counter_report(name, counter->hit_count, counter->cycle_count, elapsed_cycles); } static inline void cycle_counter_tick_atomic(const char *name, struct cycle_counter *counter, uint64_t elapsed_cycles) { - uint64_t total_cycle_count = __sync_add_and_fetch(&counter->total_cycle_count, elapsed_cycles); + uint64_t cycle_count = __sync_add_and_fetch(&counter->cycle_count, elapsed_cycles); uint64_t hit_count = __sync_add_and_fetch(&counter->hit_count, 1); - cycle_counter_report(name, hit_count, total_cycle_count, elapsed_cycles) + cycle_counter_report(name, hit_count, cycle_count, elapsed_cycles); } - #endif static bool queue_init(struct queue *queue)