fix time bug

sledge_graph
hwwang 4 weeks ago
parent a696655ad5
commit 87ba8af8a0

@ -59,8 +59,8 @@ CFLAGS += -DLOG_TO_FILE
# CFLAGS += -DLOG_PREEMPTION # CFLAGS += -DLOG_PREEMPTION
# CFLAGS += -DLOG_MODULE_LOADING # CFLAGS += -DLOG_MODULE_LOADING
# CFLAGS += -DOPT_AVOID_GLOBAL_QUEUE # CFLAGS += -DOPT_AVOID_GLOBAL_QUEUE
#CFLAGS += -DLOG_RUNTIME_FILE_LOG CFLAGS += -DLOG_RUNTIME_FILE_LOG
CFLAGS += -DLOG_RUNTIME_MEM_LOG #CFLAGS += -DLOG_RUNTIME_MEM_LOG
# This dumps per module *.csv files containing the cycle a sandbox has been in RUNNING when each # This dumps per module *.csv files containing the cycle a sandbox has been in RUNNING when each
# page is allocated. This helps understand the relationship to memory allocation and execution time. # page is allocated. This helps understand the relationship to memory allocation and execution time.

@ -104,7 +104,6 @@ listener_thread_main(void *dummy)
*/ */
assert(descriptor_count > 0); assert(descriptor_count > 0);
uint64_t request_arrival_timestamp = __getcycles();
for (int i = 0; i < descriptor_count; i++) { for (int i = 0; i < descriptor_count; i++) {
/* Check Event to determine if epoll returned an error */ /* Check Event to determine if epoll returned an error */
if ((epoll_events[i].events & EPOLLERR) == EPOLLERR) { if ((epoll_events[i].events & EPOLLERR) == EPOLLERR) {
@ -222,6 +221,8 @@ listener_thread_main(void *dummy)
/* Adding system start timestamp to avoid negative remaining slack in the following update. They are all cycles */ /* Adding system start timestamp to avoid negative remaining slack in the following update. They are all cycles */
uint64_t remaining_slack = system_start_timestamp + module->relative_deadline - estimated_execution_time; uint64_t remaining_slack = system_start_timestamp + module->relative_deadline - estimated_execution_time;
uint64_t request_arrival_timestamp = __getcycles();
/* Allocate a Sandbox Request */ /* Allocate a Sandbox Request */
struct sandbox_request *sandbox_request = struct sandbox_request *sandbox_request =
sandbox_request_allocate(module, true, 0, module->name, client_socket, sandbox_request_allocate(module, true, 0, module->name, client_socket,

@ -412,7 +412,7 @@ module_new_from_json(char *file_name)
uint32_t expected_execution_us = 0; uint32_t expected_execution_us = 0;
int admissions_percentile = 50; int admissions_percentile = 50;
bool is_active = false; bool is_active = false;
bool is_tail_module = false; // bool is_tail_module = false;
int32_t request_count = 0; int32_t request_count = 0;
int32_t response_count = 0; int32_t response_count = 0;
int j = 1; int j = 1;
@ -489,15 +489,15 @@ module_new_from_json(char *file_name)
} else { } else {
panic("Expected active key to be a JSON boolean, was %s\n", val); panic("Expected active key to be a JSON boolean, was %s\n", val);
} }
} else if (strcmp(key, "tail-module") == 0) { // } else if (strcmp(key, "tail-module") == 0) {
assert(tokens[i + j + 1].type == JSMN_PRIMITIVE); // assert(tokens[i + j + 1].type == JSMN_PRIMITIVE);
if (val[0] == 't') { // if (val[0] == 't') {
is_tail_module = true; // is_tail_module = true;
} else if (val[0] == 'f') { // } else if (val[0] == 'f') {
is_tail_module = false; // is_tail_module = false;
} else { // } else {
panic("Expected tail_module key to be a JSON boolean, was %s\n", val); // panic("Expected tail_module key to be a JSON boolean, was %s\n", val);
} // }
} else if (strcmp(key, "relative-deadline-us") == 0) { } else if (strcmp(key, "relative-deadline-us") == 0) {
int64_t buffer = strtoll(val, NULL, 10); int64_t buffer = strtoll(val, NULL, 10);
if (buffer < 0 || buffer > (int64_t)RUNTIME_RELATIVE_DEADLINE_US_MAX) if (buffer < 0 || buffer > (int64_t)RUNTIME_RELATIVE_DEADLINE_US_MAX)
@ -604,7 +604,6 @@ module_new_from_json(char *file_name)
if(next_module_count == 0) if(next_module_count == 0)
{ {
module->next_module_names = NULL; module->next_module_names = NULL;
}else }else
{ {
module->next_module_names = malloc(next_module_count * sizeof(char*)); module->next_module_names = malloc(next_module_count * sizeof(char*));

@ -2,7 +2,7 @@ include Makefile.inc
#TESTS=fibonacci fibonacci2 fibonacci3 big_fibonacci C-Image-Manip empty work work1k work10k work100k work1m forever filesys sockserver sockclient empty #TESTS=fibonacci fibonacci2 fibonacci3 big_fibonacci C-Image-Manip empty work work1k work10k work100k work1m forever filesys sockserver sockclient empty
TESTS=fibonacci big_fibonacci C-Image-Manip empty work work1k work10k work100k work1m forever filesys sockserver sockclient empty TESTS=fibonacci big_fibonacci C-Image-Manip empty work work1k work10k work100k work1m forever filesys sockserver sockclient empty
TESTS2=fibonacciadd mem work3 picinpic TESTS2=fibonacciadd mem work3 picinpic noop
TESTSRT=$(TESTS:%=%_rt) TESTSRT=$(TESTS:%=%_rt)
TESTSRT2=$(TESTS2:%=%_rt) TESTSRT2=$(TESTS2:%=%_rt)

@ -0,0 +1,26 @@
import sys
def process_file(input_file, noop_functions):
data = {noop: [] for noop in noop_functions}
with open(input_file, "r") as infile:
for line in infile:
for noop in noop_functions:
if noop in line:
value = line.split(",")[6]
data[noop].append(value)
for noop, values in data.items():
with open(f"{noop}.txt", "w") as outfile:
outfile.write("\n".join(values))
if __name__ == "__main__":
noop_functions = ["noop1", "noop2", "noop3", "noop4", "noop5"]
argv = sys.argv[1:]
if len(argv) < 1:
print("usage:", sys.argv[0], "file_dir percentage")
sys.exit()
input_file = argv[0]
process_file(input_file, noop_functions)

@ -0,0 +1,11 @@
#include <stdio.h>
void noop() {
}
int main() {
noop();
return 0;
}

@ -0,0 +1,22 @@
import os
def calculate_average(filename):
with open(filename, "r") as file:
values = file.readlines()
values = [int(value.strip()) for value in values]
average = sum(values) / len(values) if values else 0
return average
def main():
noop_functions = ["noop1", "noop2", "noop3", "noop4", "noop5"]
for noop in noop_functions:
filename = f"{noop}.txt"
if os.path.exists(filename):
average = calculate_average(filename)
print(f"Average for {filename}: {average}")
else:
print(f"{filename} does not exist.")
if __name__ == "__main__":
main()

@ -0,0 +1,32 @@
#!/bin/bash
function usage {
echo "$0 [perf output file, chain_function_perf.log or single_function_perf.log or opt_function_perf.log]"
exit 1
}
if [ $# != 1 ] ; then
usage
exit 1;
fi
output=$1
declare project_path="$(
cd "$(dirname "$0")/../.."
pwd
)"
echo $project_path
path=`pwd`
#export SLEDGE_DISABLE_PREEMPTION=true
export SLEDGE_CPU_SPEED=2500
export SLEDGE_SCHEDULER=FIFO
export SLEDGE_SIGALRM_HANDLER=BROADCAST
#export SLEDGE_SIGALRM_HANDLER=TRIAGED
#export SLEDGE_NWORKERS=16
#export SLEDGE_SCHEDULER=EDF
export SLEDGE_SANDBOX_PERF_LOG=$path/$output
echo $SLEDGE_SANDBOX_PERF_LOG
cd $project_path/runtime/bin
LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_noop1.json

@ -0,0 +1,17 @@
{
"active": true,
"name": "noop1",
"path": "noop_wasm.so",
"port": 10000,
"relative-deadline-us": 0,
"argsize": 0,
"priority": 1,
"pre_module_count": 0,
"next_modules": [],
"http-req-headers": [],
"http-req-content-type": "text/plain",
"http-req-size": 0,
"http-resp-headers": [],
"http-resp-size": 0,
"http-resp-content-type": "text/plain",
}
Loading…
Cancel
Save