From 24502d316beb774a517d0b969e55229c935f0e55 Mon Sep 17 00:00:00 2001 From: xiaosuGW Date: Fri, 23 Jul 2021 15:32:10 -0500 Subject: [PATCH] 1. Change compliler optimization level. 2. remove unaccurate execution time calculation --- runtime/Makefile | 4 ++-- runtime/include/sandbox_functions.h | 7 ++----- runtime/include/sandbox_types.h | 1 - runtime/src/current_sandbox.c | 2 -- runtime/src/main.c | 2 +- runtime/tests/Makefile.inc | 4 ++-- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/runtime/Makefile b/runtime/Makefile index ef5ce64..af244da 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -10,10 +10,10 @@ PAGE_SIZE := $(shell getconf PAGESIZE) # Compiler Settings 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 = -O0 -g -pthread -D_GNU_SOURCE +#CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE # CFI Sanitizer # CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE -flto -fvisibility=default -fsanitize=cfi diff --git a/runtime/include/sandbox_functions.h b/runtime/include/sandbox_functions.h index ebe32c8..2d39d8a 100644 --- a/runtime/include/sandbox_functions.h +++ b/runtime/include/sandbox_functions.h @@ -166,8 +166,6 @@ sandbox_print_perf(struct sandbox *sandbox) if (runtime_sandbox_perf_log == NULL) return; 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) / 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 * 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->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); - fflush(runtime_sandbox_perf_log); + running_us, blocked_us, returned_us, sandbox->linear_memory_size); } diff --git a/runtime/include/sandbox_types.h b/runtime/include/sandbox_types.h index 343d814..9cf510a 100644 --- a/runtime/include/sandbox_types.h +++ b/runtime/include/sandbox_types.h @@ -51,7 +51,6 @@ struct sandbox { uint64_t request_arrival_timestamp; /* Timestamp when request is received */ 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 response_timestamp; /* Timestamp when response is sent */ uint64_t completion_timestamp; /* Timestamp when sandbox runs to completion */ diff --git a/runtime/src/current_sandbox.c b/runtime/src/current_sandbox.c index 864de71..bc2acb2 100644 --- a/runtime/src/current_sandbox.c +++ b/runtime/src/current_sandbox.c @@ -61,11 +61,9 @@ current_sandbox_disable_preemption(struct sandbox *sandbox) void current_sandbox_start(void) { - uint64_t start_execution_timestamp = __getcycles(); struct sandbox *sandbox = current_sandbox_get(); assert(sandbox != NULL); assert(sandbox->state == SANDBOX_RUNNING); - sandbox->start_execution_timestamp = start_execution_timestamp; char *error_message = ""; diff --git a/runtime/src/main.c b/runtime/src/main.c index e527699..0729edf 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -225,7 +225,7 @@ runtime_configure() runtime_sandbox_perf_log = fopen(runtime_sandbox_perf_log_path, "w"); if (runtime_sandbox_perf_log == NULL) { perror("sandbox perf log"); } 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); } else { printf("\tSandbox Performance Log: Disabled\n"); diff --git a/runtime/tests/Makefile.inc b/runtime/tests/Makefile.inc index 079e7b2..c2a879f 100644 --- a/runtime/tests/Makefile.inc +++ b/runtime/tests/Makefile.inc @@ -3,8 +3,8 @@ ARCH := $(shell uname -m) CC=clang # Source -> Native WASMCC=wasm32-unknown-unknown-wasm-clang # Source -> WebAssembly -# OPTFLAGS=-O3 -flto -OPTFLAGS=-O0 -flto -g +OPTFLAGS=-O3 -flto +# OPTFLAGS=-O0 -flto -g MEMC_64=64bit_nix.c # MEMC_NO=no_protection.c # MEMC_GEN=generic.c