remove all atomic variables

remove_atomic_variables_for_self_to_localqueue
Xiaosu Lyu 3 years ago
parent a9dd1f9710
commit 9582ed445e

@ -29,7 +29,7 @@ static inline void
http_route_total_increment_request(struct http_route_total *rm)
{
#ifdef HTTP_ROUTE_TOTAL_COUNTERS
atomic_fetch_add(&rm->total_requests, 1);
//atomic_fetch_add(&rm->total_requests, 1);
#endif
}
@ -37,12 +37,12 @@ static inline void
http_route_total_increment(struct http_route_total *rm, int status_code)
{
#ifdef HTTP_ROUTE_TOTAL_COUNTERS
if (status_code >= 200 && status_code <= 299) {
/*if (status_code >= 200 && status_code <= 299) {
atomic_fetch_add(&rm->total_2XX, 1);
} else if (status_code >= 400 && status_code <= 499) {
atomic_fetch_add(&rm->total_4XX, 1);
} else if (status_code >= 500 && status_code <= 599) {
atomic_fetch_add(&rm->total_5XX, 1);
}
}*/
#endif
}

@ -196,7 +196,7 @@ http_session_set_response_header(struct http_session *session, int status_code)
{
assert(session != NULL);
assert(status_code >= 200 && status_code <= 599);
http_total_increment_response(status_code);
//http_total_increment_response(status_code);
/* We might not have actually matched a route */
if (likely(session->route != NULL)) { http_route_total_increment(&session->route->metrics, status_code); }

@ -60,7 +60,7 @@ static inline void
module_acquire(struct module *module)
{
assert(module->reference_count < UINT32_MAX);
atomic_fetch_add(&module->reference_count, 1);
//atomic_fetch_add(&module->reference_count, 1);
return;
}
@ -158,8 +158,8 @@ module_entrypoint(struct module *module)
static inline void
module_release(struct module *module)
{
assert(module->reference_count > 0);
atomic_fetch_sub(&module->reference_count, 1);
//assert(module->reference_count > 0);
//atomic_fetch_sub(&module->reference_count, 1);
return;
}

@ -55,6 +55,6 @@ static inline void
sandbox_process_scheduler_updates(struct sandbox *sandbox)
{
if (tenant_is_paid(sandbox->tenant)) {
atomic_fetch_sub(&sandbox->tenant->remaining_budget, sandbox->last_state_duration);
//atomic_fetch_sub(&sandbox->tenant->remaining_budget, sandbox->last_state_duration);
}
}

@ -48,7 +48,7 @@ static inline void
sandbox_state_totals_increment(sandbox_state_t state)
{
#ifdef SANDBOX_STATE_TOTALS
atomic_fetch_add(&sandbox_state_totals[state], 1);
//atomic_fetch_add(&sandbox_state_totals[state], 1);
#endif
}
@ -56,7 +56,7 @@ static inline void
sandbox_state_totals_decrement(sandbox_state_t state)
{
#ifdef SANDBOX_STATE_TOTALS
if (atomic_load(&sandbox_state_totals[state]) == 0) panic("Underflow of %s\n", sandbox_state_stringify(state));
atomic_fetch_sub(&sandbox_state_totals[state], 1);
//if (atomic_load(&sandbox_state_totals[state]) == 0) panic("Underflow of %s\n", sandbox_state_stringify(state));
//atomic_fetch_sub(&sandbox_state_totals[state], 1);
#endif
}

@ -15,5 +15,6 @@ sandbox_total_initialize()
static inline uint64_t
sandbox_total_postfix_increment()
{
return atomic_fetch_add(&sandbox_total, 1) + 1;
//return atomic_fetch_add(&sandbox_total, 1) + 1;
return 1;
}

@ -56,7 +56,7 @@ static inline void
software_interrupt_counts_deferred_sigalrm_replay_increment()
{
#ifdef LOG_SOFTWARE_INTERRUPT_COUNTS
atomic_fetch_add(&software_interrupt_counts_deferred_sigalrm_replay[worker_thread_idx], 1);
//atomic_fetch_add(&software_interrupt_counts_deferred_sigalrm_replay[worker_thread_idx], 1);
#endif
}
@ -64,7 +64,7 @@ static inline void
software_interrupt_counts_sigalrm_kernel_increment()
{
#ifdef LOG_SOFTWARE_INTERRUPT_COUNTS
atomic_fetch_add(&software_interrupt_counts_sigalrm_kernel[worker_thread_idx], 1);
//atomic_fetch_add(&software_interrupt_counts_sigalrm_kernel[worker_thread_idx], 1);
#endif
}
@ -72,7 +72,7 @@ static inline void
software_interrupt_counts_sigalrm_thread_increment()
{
#ifdef LOG_SOFTWARE_INTERRUPT_COUNTS
atomic_fetch_add(&software_interrupt_counts_sigalrm_thread[worker_thread_idx], 1);
//atomic_fetch_add(&software_interrupt_counts_sigalrm_thread[worker_thread_idx], 1);
#endif
}
@ -80,7 +80,7 @@ static inline void
software_interrupt_counts_sigfpe_increment()
{
#ifdef LOG_SOFTWARE_INTERRUPT_COUNTS
atomic_fetch_add(&software_interrupt_counts_sigfpe[worker_thread_idx], 1);
//atomic_fetch_add(&software_interrupt_counts_sigfpe[worker_thread_idx], 1);
#endif
}
@ -88,7 +88,7 @@ static inline void
software_interrupt_counts_sigsegv_increment()
{
#ifdef LOG_SOFTWARE_INTERRUPT_COUNTS
atomic_fetch_add(&software_interrupt_counts_sigsegv[worker_thread_idx], 1);
//atomic_fetch_add(&software_interrupt_counts_sigsegv[worker_thread_idx], 1);
#endif
}
@ -96,7 +96,7 @@ static inline void
software_interrupt_counts_sigusr_increment()
{
#ifdef LOG_SOFTWARE_INTERRUPT_COUNTS
atomic_fetch_add(&software_interrupt_counts_sigusr[worker_thread_idx], 1);
//atomic_fetch_add(&software_interrupt_counts_sigusr[worker_thread_idx], 1);
#endif
}

@ -40,7 +40,7 @@ admissions_control_add(uint64_t admissions_estimate)
{
#ifdef ADMISSIONS_CONTROL
assert(admissions_estimate > 0);
atomic_fetch_add(&admissions_control_admitted, admissions_estimate);
//atomic_fetch_add(&admissions_control_admitted, admissions_estimate);
#ifdef LOG_ADMISSIONS_CONTROL
debuglog("Runtime Admitted: %lu / %lu\n", admissions_control_admitted, admissions_control_capacity);

@ -19,6 +19,7 @@ extern struct http_session *g_session;
extern struct tenant *g_tenant;
extern int g_client_socket;
extern struct sockaddr *g_client_address;
extern thread_local uint32_t total_local_requests;
thread_local struct sandbox *worker_thread_current_sandbox = NULL;
@ -74,11 +75,12 @@ current_sandbox_exit()
struct tenant *tenant = g_tenant;
uint64_t request_arrival_timestamp = __getcycles();
http_total_increment_request();
//http_total_increment_request();
/* Allocate http session */
//struct http_session *session = http_session_alloc(g_client_socket, (const struct sockaddr *)&g_client_address, tenant, request_arrival_timestamp);
struct http_session *session = g_session;
//printf("received http data is %s\n", session->request_buffer.data);
//assert(session != NULL);
//http_session_copy(session, g_session);
assert(session->route != NULL);

@ -144,7 +144,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
/* Signals should not nest */
assert(handler_depth == 0);
atomic_fetch_add(&handler_depth, 1);
//atomic_fetch_add(&handler_depth, 1);
ucontext_t *interrupted_context = (ucontext_t *)interrupted_context_raw;
struct sandbox *current_sandbox = current_sandbox_get();
@ -178,7 +178,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
global_timeout_queue_process_promotions();
}
propagate_sigalrm(signal_info);
atomic_fetch_add(&deferred_sigalrm, 1);
//atomic_fetch_add(&deferred_sigalrm, 1);
}
break;
@ -203,7 +203,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
software_interrupt_counts_sigfpe_increment();
if (likely(current_sandbox && current_sandbox->state == SANDBOX_RUNNING_USER)) {
atomic_fetch_sub(&handler_depth, 1);
//atomic_fetch_sub(&handler_depth, 1);
current_sandbox_trap(WASM_TRAP_ILLEGAL_ARITHMETIC_OPERATION);
} else {
panic("Runtime SIGFPE\n");
@ -215,7 +215,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
software_interrupt_counts_sigsegv_increment();
if (likely(current_sandbox && current_sandbox->state == SANDBOX_RUNNING_USER)) {
atomic_fetch_sub(&handler_depth, 1);
//atomic_fetch_sub(&handler_depth, 1);
current_sandbox_trap(WASM_TRAP_OUT_OF_BOUNDS_LINEAR_MEMORY);
} else {
panic("Runtime SIGSEGV\n");
@ -230,9 +230,10 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
/* calculate the throughput */
time_t t_end = time(NULL);
double seconds = difftime(t_end, t_start);
double throughput = atomic_load(&sandbox_state_totals[SANDBOX_COMPLETE]) / seconds;
//double throughput = atomic_load(&sandbox_state_totals[SANDBOX_COMPLETE]) / seconds;
double throughput = total_local_requests / seconds;
uint32_t total_sandboxes_error = atomic_load(&sandbox_state_totals[SANDBOX_ERROR]);
printf("throughput is %f, error request is %u global total request %d worker %d total requests is %u worker total_held %"PRIu64" longest_held %"PRIu64" listener total_held %"PRIu64" longest_held %"PRIu64" total gr %u\n", throughput, total_sandboxes_error, atomic_load(&sandbox_state_totals[SANDBOX_COMPLETE]), worker_thread_idx, total_local_requests, total_held[worker_thread_idx], longest_held[worker_thread_idx], total_held[200], longest_held[200], total_global_requests);
printf("throughput is %f error request is %u global total request %d worker %d total requests is %u time %f worker total_held %"PRIu64" longest_held %"PRIu64" listener total_held %"PRIu64" longest_held %"PRIu64" total gr %u\n", throughput, total_sandboxes_error, atomic_load(&sandbox_state_totals[SANDBOX_COMPLETE]), worker_thread_idx, total_local_requests, seconds, total_held[worker_thread_idx], longest_held[worker_thread_idx], total_held[200], longest_held[200], total_global_requests);
fflush(stdout);
pthread_exit(0);
}
@ -252,7 +253,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
}
}
atomic_fetch_sub(&handler_depth, 1);
//atomic_fetch_sub(&handler_depth, 1);
return;
}

Loading…
Cancel
Save