From 941449dfc1dbc8aa2bc82d0336305244b2527dfb Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko Date: Mon, 19 Nov 2018 18:32:05 +0300 Subject: [PATCH] odyssey: add clients_processed stat info per worker --- sources/worker.c | 8 ++++++-- sources/worker.h | 1 + sources/worker_pool.h | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sources/worker.c b/sources/worker.c index 6f0fe98d..ecdda927 100644 --- a/sources/worker.c +++ b/sources/worker.c @@ -50,6 +50,8 @@ od_worker(void *arg) break; } client->coroutine_id = coroutine_id; + + worker->clients_processed++; break; } case OD_MSTAT: @@ -68,14 +70,15 @@ od_worker(void *arg) &msg_cache_size); od_log(&instance->logger, "stats", NULL, NULL, "worker[%d]: msg (%" PRIu64 " allocated, %" PRIu64 " cached, %" PRIu64 " freed, %" PRIu64 " cache_size), " - "coroutines (%" PRIu64 " active, %"PRIu64 " cached)", + "coroutines (%" PRIu64 " active, %"PRIu64 " cached), clients_processed: %" PRIu64, worker->id, msg_allocated, msg_cache_count, msg_cache_gc_count, msg_cache_size, count_coroutine, - count_coroutine_cache); + count_coroutine_cache, + worker->clients_processed); break; } default: @@ -95,6 +98,7 @@ od_worker_init(od_worker_t *worker, od_global_t *global, int id) worker->machine = -1; worker->id = id; worker->global = global; + worker->clients_processed = 0; } int diff --git a/sources/worker.h b/sources/worker.h index abe48cb1..037f4531 100644 --- a/sources/worker.h +++ b/sources/worker.h @@ -14,6 +14,7 @@ struct od_worker int64_t machine; int id; machine_channel_t *task_channel; + uint64_t clients_processed; od_global_t *global; }; diff --git a/sources/worker_pool.h b/sources/worker_pool.h index f1a54aa5..9a12112a 100644 --- a/sources/worker_pool.h +++ b/sources/worker_pool.h @@ -53,6 +53,9 @@ od_worker_pool_feed(od_worker_pool_t *pool, machine_msg_t *msg) } pool->round_robin++; + printf(">>>> %d\n", next); + fflush(stdout); + od_worker_t *worker; worker = &pool->pool[next]; machine_channel_write(worker->task_channel, msg);