odyssey: add clients_processed stat info per worker

This commit is contained in:
Dmitry Simonenko 2018-11-19 18:32:05 +03:00
parent c61c1e81f7
commit 941449dfc1
3 changed files with 10 additions and 2 deletions

View File

@ -50,6 +50,8 @@ od_worker(void *arg)
break; break;
} }
client->coroutine_id = coroutine_id; client->coroutine_id = coroutine_id;
worker->clients_processed++;
break; break;
} }
case OD_MSTAT: case OD_MSTAT:
@ -68,14 +70,15 @@ od_worker(void *arg)
&msg_cache_size); &msg_cache_size);
od_log(&instance->logger, "stats", NULL, NULL, od_log(&instance->logger, "stats", NULL, NULL,
"worker[%d]: msg (%" PRIu64 " allocated, %" PRIu64 " cached, %" PRIu64 " freed, %" PRIu64 " cache_size), " "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, worker->id,
msg_allocated, msg_allocated,
msg_cache_count, msg_cache_count,
msg_cache_gc_count, msg_cache_gc_count,
msg_cache_size, msg_cache_size,
count_coroutine, count_coroutine,
count_coroutine_cache); count_coroutine_cache,
worker->clients_processed);
break; break;
} }
default: default:
@ -95,6 +98,7 @@ od_worker_init(od_worker_t *worker, od_global_t *global, int id)
worker->machine = -1; worker->machine = -1;
worker->id = id; worker->id = id;
worker->global = global; worker->global = global;
worker->clients_processed = 0;
} }
int int

View File

@ -14,6 +14,7 @@ struct od_worker
int64_t machine; int64_t machine;
int id; int id;
machine_channel_t *task_channel; machine_channel_t *task_channel;
uint64_t clients_processed;
od_global_t *global; od_global_t *global;
}; };

View File

@ -53,6 +53,9 @@ od_worker_pool_feed(od_worker_pool_t *pool, machine_msg_t *msg)
} }
pool->round_robin++; pool->round_robin++;
printf(">>>> %d\n", next);
fflush(stdout);
od_worker_t *worker; od_worker_t *worker;
worker = &pool->pool[next]; worker = &pool->pool[next];
machine_channel_write(worker->task_channel, msg); machine_channel_write(worker->task_channel, msg);