update and upload scripts

main
xiaosuGW 3 years ago
parent 1ac9e5a881
commit f14cabe436

@ -125,7 +125,8 @@ def count_miss_or_meet_deadline_requests(file_dir, percentage):
"cifar10_3": "5k",
"cifar10_4": "40k",
"resize": "resize",
"fibonacci": "fibonacci"
"fibonacci": "fibonacci",
"resize3": "resize3"
}
func_name_with_id = {
"1": "105k",
@ -170,8 +171,7 @@ def count_miss_or_meet_deadline_requests(file_dir, percentage):
for key,value in running_times.items():
#print("function:", key, func_name_with_id[key], key)
print("function:", key)
print(np.median(total_times[key]), np.median(running_times[key]), np.median(queuing_times[key]), np.median(runnable_times[key]), np.median(blocked_times[key]), np.median(initializing_times[key]))
print("function times:", func_name_with_id[key], np.median(total_times[key]), np.median(running_times[key]), np.median(queuing_times[key]), np.median(runnable_times[key]), np.median(blocked_times[key]), np.median(initializing_times[key]))
for key, value in delays_dict.items():
new_value = [i/1000 for i in value]
p99 = np.percentile(new_value, 99)

@ -0,0 +1,104 @@
import re
import os
import sys
from collections import defaultdict
#get all file names which contain key_str
def file_name(file_dir, key_str):
file_table = defaultdict(list)
for root, dirs, files in os.walk(file_dir):
if root != os.getcwd():
continue
for file_i in files:
if file_i.find(key_str) >= 0:
segs = file_i.split('_')
if len(segs) < 2:
continue
print(file_i)
key = segs[0]+"_" + segs[1]
percentage=segs[-1].split(".")[0]
print("percentage is ______________", percentage)
file_table[key].append(file_i)
for key,value in file_table.items():
s_value = sorted(value, key = lambda x: int(x.split('_')[-1].split(".")[0]))
file_table[key] = s_value
#print("key is:", key, " value is:", value)
#for key,value in file_table.items():
# print("key is:", key, " value is:", value)
return file_table
def get_values(key, value, miss_deadline_rate, total_latency, preemption_count):
for i in range(len(value)):
file_name = value[i]
cmd='python3 ~/sledge-serverless-framework/runtime/tests/meet_deadline_percentage.py %s 50' % file_name
rt=os.popen(cmd).read().strip()
#print(rt)
rule=r'(.*?) miss deadline rate:(.*?) miss count is'
finds=re.findall(rule, rt)
func_name=finds[0][0]
miss_rate=finds[0][1]
#print(func_name, miss_rate)
key1=key+"_"+func_name
percentage=file_name.split('_')[-1].split('.')[0]
print(key1, percentage, miss_rate)
miss_deadline_rate[key1][percentage]=round(float(miss_rate), 2)
rule2=r'function times: (.*)'
finds=re.findall(rule2, rt)
func_name=finds[0].split(" ")[0]
latency=finds[0].split(" ")[1]
print(func_name, latency)
total_latency[key1][percentage]=latency
rule3=r'scheduling counter: (.*)'
finds=re.findall(rule3, rt)
schedule_count=finds[0].strip()
preemption_count[key1]=schedule_count
print("finds preemption count is ", schedule_count)
if __name__ == "__main__":
import json
miss_deadline_rate = defaultdict(defaultdict)
total_latency = defaultdict(defaultdict)
preemption_count = defaultdict(defaultdict)
argv = sys.argv[1:]
if len(argv) < 1:
print("usage ", sys.argv[0], " function key word, 5k or 305k")
sys.exit()
files_tables = file_name(os.getcwd(), argv[0])
n = len(files_tables)
d = {}
i = 0
for key, value in files_tables.items():
get_values(key, value, miss_deadline_rate, total_latency, preemption_count)
for key, value in miss_deadline_rate.items():
print(key, value)
for key, value in total_latency.items():
print(key, value)
for key, value in preemption_count.items():
print(key, value)
js = json.dumps(miss_deadline_rate)
f= open("miss_deadline_rate.txt", 'w')
f.write(js)
f.close()
js2 = json.dumps(total_latency)
f2= open("total_latency.txt", 'w')
f2.write(js2)
f2.close()
js3 = json.dumps(preemption_count)
f3= open("preemption.txt", 'w')
f3.write(js3)
f3.close()
Loading…
Cancel
Save