|
32 | 32 | #include <netinet/tcp.h> |
33 | 33 | #include <openssl/ssl.h> |
34 | 34 | #include <sys/socket.h> |
35 | | -#include <sys/syscall.h> |
36 | 35 | #include <sys/types.h> |
37 | 36 |
|
38 | 37 | #include "error.h" |
39 | 38 | #include "event_loop.h" |
40 | 39 | #include "global_data.h" |
41 | 40 | #include "thread.h" |
42 | | -#include "utility.h" |
43 | 41 |
|
44 | | -#define CONN_NUM_SAMPLE_PERIOD 2500 |
45 | 42 | #define DEFAULT_TCP_FASTOPEN_QUEUE_LEN 4096 |
46 | 43 |
|
47 | 44 | static void accept_connection(h2o_socket_t *listener, const char *err); |
@@ -80,7 +77,6 @@ static void accept_connection(h2o_socket_t *listener, const char *err) |
80 | 77 | if (!sock) |
81 | 78 | break; |
82 | 79 |
|
83 | | - ctx->event_loop.accepted_conn_num++; |
84 | 80 | ctx->event_loop.conn_num++; |
85 | 81 | sock->on_close.cb = on_close_connection; |
86 | 82 | sock->on_close.data = &ctx->event_loop.conn_num; |
@@ -299,36 +295,11 @@ static void start_accept_polling(bool is_main_thread, |
299 | 295 |
|
300 | 296 | void event_loop(struct thread_context_t *ctx) |
301 | 297 | { |
302 | | - uint64_t last_sample = 0; |
303 | | - |
304 | 298 | while (!ctx->shutdown || ctx->event_loop.conn_num) { |
305 | 299 | h2o_evloop_run(ctx->event_loop.h2o_ctx.loop, INT32_MAX); |
306 | 300 | process_messages(&ctx->global_thread_data->h2o_receiver, |
307 | 301 | &ctx->event_loop.local_messages); |
308 | | - |
309 | | - const uint64_t now = h2o_now(ctx->event_loop.h2o_ctx.loop); |
310 | | - |
311 | | - if (now - last_sample > CONN_NUM_SAMPLE_PERIOD || last_sample > now) { |
312 | | - const size_t i = ctx->event_loop.conn_num_sample_idx; |
313 | | - |
314 | | - ctx->event_loop.conn_num_sample[i] = ctx->event_loop.conn_num; |
315 | | - ctx->event_loop.conn_num_sample_idx = |
316 | | - (i + 1) % ARRAY_SIZE(ctx->event_loop.conn_num_sample); |
317 | | - last_sample = now; |
318 | | - } |
319 | 302 | } |
320 | | - |
321 | | - flockfile(stdout); |
322 | | - printf("Thread %ld statistics:\nAccepted connections: %zu\nConnection number samples: %zu", |
323 | | - syscall(SYS_gettid), |
324 | | - ctx->event_loop.accepted_conn_num, |
325 | | - *ctx->event_loop.conn_num_sample); |
326 | | - |
327 | | - for (size_t i = 1; i < ARRAY_SIZE(ctx->event_loop.conn_num_sample); i++) |
328 | | - printf(",%zu", ctx->event_loop.conn_num_sample[i]); |
329 | | - |
330 | | - putc_unlocked('\n', stdout); |
331 | | - funlockfile(stdout); |
332 | 303 | } |
333 | 304 |
|
334 | 305 | void free_event_loop(event_loop_t *event_loop, h2o_multithread_receiver_t *h2o_receiver) |
|
0 commit comments