diff --git a/runtime/src/listener_thread.c b/runtime/src/listener_thread.c index fb61a572..cecfbff5 100644 --- a/runtime/src/listener_thread.c +++ b/runtime/src/listener_thread.c @@ -15,6 +15,8 @@ #include "sandbox_set_as_runnable.h" extern thread_local int thread_id; +extern bool first_request_comming; +time_t t_start; struct priority_queue* worker_queues[1024]; extern uint32_t runtime_worker_threads_count; int rr_index = 0; @@ -195,6 +197,11 @@ on_client_request_arrival(int client_socket, const struct sockaddr *client_addre static void on_client_request_receiving(struct http_session *session) { + if (first_request_comming == false){ + t_start = time(NULL); + first_request_comming = true; + } + /* Read HTTP request */ int rc = http_session_receive_request(session, (void_star_cb)listener_thread_register_http_session); if (likely(rc == 0)) { diff --git a/runtime/src/main.c b/runtime/src/main.c index a59df652..5bd60637 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -41,10 +41,11 @@ enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_B bool runtime_preemption_enabled = true; uint32_t runtime_quantum_us = 5000; /* 5ms */ uint64_t runtime_boot_timestamp; -time_t t_start; pid_t runtime_pid = 0; thread_local int thread_id = -1; +bool first_request_comming = false; + /** * Returns instructions on use of CLI if used incorrectly * @param cmd - The command the user entered @@ -496,7 +497,6 @@ main(int argc, char **argv) } runtime_boot_timestamp = __getcycles(); - t_start = time(NULL); for (int tenant_idx = 0; tenant_idx < tenant_config_vec_len; tenant_idx++) { tenant_config_deinit(&tenant_config_vec[tenant_idx]);