diff --git a/runtime/tests/debug.sh b/runtime/tests/debug.sh index 178ab1e..b4db9f9 100755 --- a/runtime/tests/debug.sh +++ b/runtime/tests/debug.sh @@ -9,11 +9,10 @@ declare project_path="$( pwd )" echo $project_path -cd ../../bin +cd $project_path/runtime/bin export LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" gdb --eval-command="handle SIGUSR1 nostop" \ --eval-command="set pagination off" \ - --eval-command="set substitute-path /sledge/runtime $project_path" \ + --eval-command="set substitute-path /sledge/runtime $project_path/runtime" \ --eval-command="run ../tests/my_fibonacci.json" \ ./sledgert -cd ../../tests diff --git a/runtime/tests/parse_get_avg.py b/runtime/tests/parse_get_avg.py new file mode 100644 index 0000000..0a2cdee --- /dev/null +++ b/runtime/tests/parse_get_avg.py @@ -0,0 +1,69 @@ +import os +import sys +import numpy as np +from collections import defaultdict +#import matplotlib.pyplot as plt +#cmd1='grep "outbound|80||%s" istio-log/%s | grep "8012::capacity::"|awk -F "::" \'{print $2 " " $4}\'' % (function, files[i]) +def def_value(): + return 0 + +def parse_file(file_dir): + running_time_dict = defaultdict(def_value) + queuing_times_dict = defaultdict(def_value) + total_times_dict = defaultdict(def_value) + runnable_times_dict = defaultdict(def_value) + blocked_times_dict = defaultdict(def_value) + initializing_times_dict = defaultdict(def_value) + execution_times_dict = defaultdict(def_value) + + running_times = [] + queuing_times = [] + total_times = [] + runnable_times = [] + blocked_times = [] + initializing_times = [] + execution_times = [] + fo = open(file_dir, "r+") + next(fo) + for line in fo: + t = line.split(",") + id = t[0] + running_time_dict[id] += int(t[8]) + queuing_times_dict[id] += int(t[5]) + total_times_dict[id] += int(t[4]) + runnable_times_dict[id] += int(t[7]) + blocked_times_dict[id] += int(t[9]) + initializing_times_dict[id] += int(t[6]) + #execution_times_dict[id] += int(t[11]) + for key,value in running_time_dict.items(): + running_times.append(value) + for key,value in queuing_times_dict.items(): + queuing_times.append(value) + for key,value in runnable_times_dict.items(): + runnable_times.append(value) + for key,value in blocked_times_dict.items(): + blocked_times.append(value) + for key,value in initializing_times_dict.items(): + initializing_times.append(value) + for key,value in total_times_dict.items(): + total_times.append(value) + #for key,value in execution_times_dict.items(): + # execution_times.append(value) + #return np.median(running_times), np.median(queuing_times), np.median(runnable_times), np.median(blocked_times), np.median(initializing_times) + print("total_time, running_time, queuing_time, runnable_time, blocked_time, initializing_time") + print(np.median(total_times), np.median(running_times), np.median(queuing_times), np.median(runnable_times), np.median(blocked_times), np.median(initializing_times)) + print(np.mean(total_times), np.mean(running_times), np.mean(queuing_times), np.mean(runnable_times), np.mean(blocked_times), np.mean(initializing_times)) + + #print(initializing_times) +if __name__ == "__main__": + import json + argv = sys.argv[1:] + if len(argv) < 1: + print("usage ", sys.argv[0], " file dir") + sys.exit() + + #m_running_t, m_queuing_t, m_runnable_t, m_blocked_t, m_initializing_t = parse_file(argv[0]) + parse_file(argv[0]) + + #print(m_running_t, m_queuing_t, m_runnable_t, m_blocked_t, m_initializing_t) + diff --git a/runtime/tests/parse_get_detail.py b/runtime/tests/parse_get_detail.py new file mode 100644 index 0000000..4b8cffd --- /dev/null +++ b/runtime/tests/parse_get_detail.py @@ -0,0 +1,66 @@ +import os +import sys +import numpy as np +from collections import defaultdict +#import matplotlib.pyplot as plt +#cmd1='grep "outbound|80||%s" istio-log/%s | grep "8012::capacity::"|awk -F "::" \'{print $2 " " $4}\'' % (function, files[i]) +def def_value(): + return 0 + +def parse_file(file_dir): + running_time_dict = defaultdict(list) + queuing_times_dict = defaultdict(list) + total_times_dict = defaultdict(list) + runnable_times_dict = defaultdict(list) + blocked_times_dict = defaultdict(list) + initializing_times_dict = defaultdict(list) + #execution_times_dict = defaultdict(list) + pure_times_dict = defaultdict(list) + real_total_times_dict = defaultdict(list) + + ids = [] + running_times = [] + queuing_times = [] + total_times = [] + runnable_times = [] + blocked_times = [] + initializing_times = [] + #execution_times = [] + real_total_times = [] + fo = open(file_dir, "r+") + next(fo) + for line in fo: + t = line.split(",") + id = t[0] + ids.append(id) + running_time_dict[id].append(int(t[8])) + queuing_times_dict[id].append(int(t[5])) + total_times_dict[id].append(int(t[4])) + runnable_times_dict[id].append(int(t[7])) + blocked_times_dict[id].append(int(t[9])) + initializing_times_dict[id].append(int(t[6])) + #execution_times_dict[id].append(int(t[11])) + real_total_times_dict[id].append(int(t[11])) + print(running_time_dict[0]) + print("request-id,sandbox-id,completion,blocked,running,queuing,init\n") + list_len = len(running_time_dict[0]) + ids = list(set(ids)) + for i in ids: + len_i = len(total_times_dict[i]) + for j in range(len_i): + print(i,j,total_times_dict[i][j],blocked_times_dict[i][j],running_time_dict[i][j],queuing_times_dict[i][j],initializing_times_dict[i][j]) + #return np.median(running_times), np.median(queuing_times), np.median(runnable_times), np.median(blocked_times), np.median(initializing_times) + + #print(initializing_times) +if __name__ == "__main__": + import json + argv = sys.argv[1:] + if len(argv) < 1: + print("usage ", sys.argv[0], " file dir") + sys.exit() + + #m_running_t, m_queuing_t, m_runnable_t, m_blocked_t, m_initializing_t = parse_file(argv[0]) + parse_file(argv[0]) + + #print(m_running_t, m_queuing_t, m_runnable_t, m_blocked_t, m_initializing_t) + diff --git a/runtime/tests/set_cpu.sh b/runtime/tests/set_cpu.sh new file mode 100755 index 0000000..07a5188 --- /dev/null +++ b/runtime/tests/set_cpu.sh @@ -0,0 +1 @@ +sudo cpupower frequency-set -g performance diff --git a/runtime/tests/start.sh b/runtime/tests/start.sh index f693073..90854ed 100755 --- a/runtime/tests/start.sh +++ b/runtime/tests/start.sh @@ -1,5 +1,5 @@ function usage { - echo "$0 [perf output file, chain_function_perf.log or single_function_perf.log]" + echo "$0 [perf output file, chain_function_perf.log or single_function_perf.log or opt_function_perf.log]" exit 1 } @@ -12,14 +12,17 @@ output=$1 declare project_path="$( - cd "$(dirname "$1")/../.." + cd "$(dirname "$0")/../.." pwd )" echo $project_path -export SLEDGE_SANDBOX_PERF_LOG=$project_path/runtime/tests/$output -cd ../bin +path=`pwd` +export SLEDGE_DISABLE_PREEMPTION=true +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_fibonacci.json -#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_big_fibonacci.json -LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/my_fibonacci.json +LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_big_fibonacci.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/my_fibonacci.json #LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_sodresize.json #LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/my_sodresize.json