change the start_t time to be receiving the first request time not the system boot time

listener_thread_distributes_requests_worker_queue_with_RR
Xiaosu Lyu 3 years ago
parent 72feda73d8
commit c12a1f6dcd

@ -15,6 +15,8 @@
#include "sandbox_set_as_runnable.h" #include "sandbox_set_as_runnable.h"
extern thread_local int thread_id; extern thread_local int thread_id;
extern bool first_request_comming;
time_t t_start;
struct priority_queue* worker_queues[1024]; struct priority_queue* worker_queues[1024];
extern uint32_t runtime_worker_threads_count; extern uint32_t runtime_worker_threads_count;
int rr_index = 0; int rr_index = 0;
@ -195,6 +197,11 @@ on_client_request_arrival(int client_socket, const struct sockaddr *client_addre
static void static void
on_client_request_receiving(struct http_session *session) on_client_request_receiving(struct http_session *session)
{ {
if (first_request_comming == false){
t_start = time(NULL);
first_request_comming = true;
}
/* Read HTTP request */ /* Read HTTP request */
int rc = http_session_receive_request(session, (void_star_cb)listener_thread_register_http_session); int rc = http_session_receive_request(session, (void_star_cb)listener_thread_register_http_session);
if (likely(rc == 0)) { if (likely(rc == 0)) {

@ -41,10 +41,11 @@ enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_B
bool runtime_preemption_enabled = true; bool runtime_preemption_enabled = true;
uint32_t runtime_quantum_us = 5000; /* 5ms */ uint32_t runtime_quantum_us = 5000; /* 5ms */
uint64_t runtime_boot_timestamp; uint64_t runtime_boot_timestamp;
time_t t_start;
pid_t runtime_pid = 0; pid_t runtime_pid = 0;
thread_local int thread_id = -1; thread_local int thread_id = -1;
bool first_request_comming = false;
/** /**
* Returns instructions on use of CLI if used incorrectly * Returns instructions on use of CLI if used incorrectly
* @param cmd - The command the user entered * @param cmd - The command the user entered
@ -496,7 +497,6 @@ main(int argc, char **argv)
} }
runtime_boot_timestamp = __getcycles(); runtime_boot_timestamp = __getcycles();
t_start = time(NULL);
for (int tenant_idx = 0; tenant_idx < tenant_config_vec_len; tenant_idx++) { for (int tenant_idx = 0; tenant_idx < tenant_config_vec_len; tenant_idx++) {
tenant_config_deinit(&tenant_config_vec[tenant_idx]); tenant_config_deinit(&tenant_config_vec[tenant_idx]);

Loading…
Cancel
Save