1. change the start_t time to be receiving the first request time not the system boot time. 2. make the start worker core's ID can be configurable in the json file

worker_generates_requests_to_global_queue
Xiaosu Lyu 3 years ago
parent 49f5ba3897
commit 0d46f8a068

@ -16,6 +16,8 @@
extern thread_local int thread_id;
extern void http_session_copy(struct http_session *dest, struct http_session *source);
/////////////////xiaosu for test//////////////////
extern bool first_request_comming;
time_t t_start;
struct http_session *g_session = NULL;
struct tenant *g_tenant = NULL;
int g_client_socket = -1;
@ -208,6 +210,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)) {

@ -35,8 +35,8 @@ uint32_t runtime_first_worker_processor = 1;
uint32_t runtime_processor_speed_MHz = 0;
uint32_t runtime_total_online_processors = 0;
uint32_t runtime_worker_threads_count = 0;
time_t t_start;
thread_local int thread_id = -1;
bool first_request_comming = false;
thread_local int thread_id = -1;
enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST;
@ -69,15 +69,20 @@ runtime_allocate_available_cores()
pretty_print_key_value("Core Count (Online)", "%u\n", runtime_total_online_processors);
/* If more than two cores are available, leave core 0 free to run OS tasks */
if (runtime_total_online_processors > 2) {
runtime_first_worker_processor = 2;
max_possible_workers = runtime_total_online_processors - 2;
} else if (runtime_total_online_processors == 2) {
runtime_first_worker_processor = 1;
max_possible_workers = runtime_total_online_processors - 1;
char* first_core_id = getenv("SLEDGE_FIRST_COREID");
if (first_core_id != NULL) {
runtime_first_worker_processor = atoi(first_core_id);
} else {
panic("Runtime requires at least two cores!");
/* If more than two cores are available, leave core 0 free to run OS tasks */
if (runtime_total_online_processors > 2) {
runtime_first_worker_processor = 2;
max_possible_workers = runtime_total_online_processors - 2;
} else if (runtime_total_online_processors == 2) {
runtime_first_worker_processor = 1;
max_possible_workers = runtime_total_online_processors - 1;
} else {
panic("Runtime requires at least two cores!");
}
}
@ -520,7 +525,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]);

Loading…
Cancel
Save