1. Change compliler optimization level. 2. remove unaccurate execution time calculation

main
xiaosuGW 3 years ago
parent 5dbbf31ba5
commit 24502d316b

@ -10,10 +10,10 @@ PAGE_SIZE := $(shell getconf PAGESIZE)
# Compiler Settings # Compiler Settings
CC=clang CC=clang
#CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE
# CC_OPTIONS for Debugging # CC_OPTIONS for Debugging
CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE #CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE
# CFI Sanitizer # CFI Sanitizer
# CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE -flto -fvisibility=default -fsanitize=cfi # CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE -flto -fvisibility=default -fsanitize=cfi

@ -166,8 +166,6 @@ sandbox_print_perf(struct sandbox *sandbox)
if (runtime_sandbox_perf_log == NULL) return; if (runtime_sandbox_perf_log == NULL) return;
uint32_t total_time_us = sandbox->total_time / runtime_processor_speed_MHz; uint32_t total_time_us = sandbox->total_time / runtime_processor_speed_MHz;
uint32_t execution_time_ms = (sandbox->completion_timestamp - sandbox->start_execution_timestamp)
/ runtime_processor_speed_MHz;
uint32_t queued_us = (sandbox->allocation_timestamp - sandbox->enqueue_timestamp) uint32_t queued_us = (sandbox->allocation_timestamp - sandbox->enqueue_timestamp)
/ runtime_processor_speed_MHz; / runtime_processor_speed_MHz;
uint32_t initializing_us = sandbox->initializing_duration / runtime_processor_speed_MHz; uint32_t initializing_us = sandbox->initializing_duration / runtime_processor_speed_MHz;
@ -181,9 +179,8 @@ sandbox_print_perf(struct sandbox *sandbox)
* becomes more intelligent, then peak linear memory size needs to be tracked * becomes more intelligent, then peak linear memory size needs to be tracked
* seperately from current linear memory size. * seperately from current linear memory size.
*/ */
fprintf(runtime_sandbox_perf_log, "%lu,%s():%d,%s,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u\n", sandbox->id, fprintf(runtime_sandbox_perf_log, "%lu,%s():%d,%s,%u,%u,%u,%u,%u,%u,%u,%u,%u\n", sandbox->id,
sandbox->module->name, sandbox->module->port, sandbox_state_stringify(sandbox->state), sandbox->module->name, sandbox->module->port, sandbox_state_stringify(sandbox->state),
sandbox->module->relative_deadline_us, total_time_us, queued_us, initializing_us, runnable_us, sandbox->module->relative_deadline_us, total_time_us, queued_us, initializing_us, runnable_us,
running_us, blocked_us, returned_us, execution_time_ms, sandbox->linear_memory_size); running_us, blocked_us, returned_us, sandbox->linear_memory_size);
fflush(runtime_sandbox_perf_log);
} }

@ -51,7 +51,6 @@ struct sandbox {
uint64_t request_arrival_timestamp; /* Timestamp when request is received */ uint64_t request_arrival_timestamp; /* Timestamp when request is received */
uint64_t enqueue_timestamp; /* Timestamp when sandbox request is enqueued */ uint64_t enqueue_timestamp; /* Timestamp when sandbox request is enqueued */
uint64_t start_execution_timestamp; /* Timestamp when sandbox starts execution */
uint64_t allocation_timestamp; /* Timestamp when sandbox is allocated */ uint64_t allocation_timestamp; /* Timestamp when sandbox is allocated */
uint64_t response_timestamp; /* Timestamp when response is sent */ uint64_t response_timestamp; /* Timestamp when response is sent */
uint64_t completion_timestamp; /* Timestamp when sandbox runs to completion */ uint64_t completion_timestamp; /* Timestamp when sandbox runs to completion */

@ -61,11 +61,9 @@ current_sandbox_disable_preemption(struct sandbox *sandbox)
void void
current_sandbox_start(void) current_sandbox_start(void)
{ {
uint64_t start_execution_timestamp = __getcycles();
struct sandbox *sandbox = current_sandbox_get(); struct sandbox *sandbox = current_sandbox_get();
assert(sandbox != NULL); assert(sandbox != NULL);
assert(sandbox->state == SANDBOX_RUNNING); assert(sandbox->state == SANDBOX_RUNNING);
sandbox->start_execution_timestamp = start_execution_timestamp;
char *error_message = ""; char *error_message = "";

@ -225,7 +225,7 @@ runtime_configure()
runtime_sandbox_perf_log = fopen(runtime_sandbox_perf_log_path, "w"); runtime_sandbox_perf_log = fopen(runtime_sandbox_perf_log_path, "w");
if (runtime_sandbox_perf_log == NULL) { perror("sandbox perf log"); } if (runtime_sandbox_perf_log == NULL) { perror("sandbox perf log"); }
fprintf(runtime_sandbox_perf_log, "id,function,state,deadline,actual,queued,initializing,runnable," fprintf(runtime_sandbox_perf_log, "id,function,state,deadline,actual,queued,initializing,runnable,"
"running,blocked,returned,execution,memory\n"); "running,blocked,returned,memory\n");
fflush(runtime_sandbox_perf_log); fflush(runtime_sandbox_perf_log);
} else { } else {
printf("\tSandbox Performance Log: Disabled\n"); printf("\tSandbox Performance Log: Disabled\n");

@ -3,8 +3,8 @@ ARCH := $(shell uname -m)
CC=clang # Source -> Native CC=clang # Source -> Native
WASMCC=wasm32-unknown-unknown-wasm-clang # Source -> WebAssembly WASMCC=wasm32-unknown-unknown-wasm-clang # Source -> WebAssembly
# OPTFLAGS=-O3 -flto OPTFLAGS=-O3 -flto
OPTFLAGS=-O0 -flto -g # OPTFLAGS=-O0 -flto -g
MEMC_64=64bit_nix.c MEMC_64=64bit_nix.c
# MEMC_NO=no_protection.c # MEMC_NO=no_protection.c
# MEMC_GEN=generic.c # MEMC_GEN=generic.c

Loading…
Cancel
Save