update scripts

main
lyuxiaosu 3 years ago
parent 6cbfb1f587
commit 2868812512

@ -97,6 +97,9 @@ def count_miss_or_meet_deadline_requests(file_dir, percentage):
t = line.split(",")
id = t[1]
func_idx = t[2][-9]
if t[2][-10] == "1":
#func_idx = t[2][-10:-9]
func_idx = t[2][-10] + t[2][-9]
joined_key = id + "_" + func_idx
running_time_dict[joined_key] += int(t[9])
queuing_times_dict[joined_key] += int(t[6])
@ -186,7 +189,6 @@ def count_miss_or_meet_deadline_requests(file_dir, percentage):
real_time_workload_times_dist[key] = [x - min_time for x in value]
for key,value in running_times.items():
#print("function:", key, func_name_with_id[key], 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]

@ -28,7 +28,7 @@ def file_name(file_dir, key_str):
return file_table
def get_values(key, value, miss_deadline_rate, total_latency, preemption_count):
def get_values(key, value, miss_deadline_rate, total_latency, preemption_count, total_miss_deadline_rate):
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
@ -36,26 +36,34 @@ def get_values(key, value, miss_deadline_rate, total_latency, preemption_count):
#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)
finds_size=len(finds)
for j in range(finds_size):
func_name=finds[j][0]
miss_rate=finds[j][1]
key1=key+"_"+func_name
percentage=file_name.split('_')[-1].split('.')[0]
print(key1, percentage, miss_rate)
print("miss rate:", 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)
for j in range(len(finds)):
func_name=finds[j].split(" ")[0]
latency=finds[j].split(" ")[1]
key1=key+"_"+func_name
print("total latency:", 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][percentage]=schedule_count
print("finds preemption count is ", schedule_count)
preemption_count[key][percentage]=schedule_count
#print("finds preemption count is ", schedule_count)
rule4=r'miss deadline percentage: (.*)'
finds=re.findall(rule4, rt)
total_miss_rate=finds[0].strip()
total_miss_deadline_rate[key][percentage]=total_miss_rate
if __name__ == "__main__":
@ -63,6 +71,7 @@ if __name__ == "__main__":
miss_deadline_rate = defaultdict(defaultdict)
total_latency = defaultdict(defaultdict)
preemption_count = defaultdict(defaultdict)
total_miss_deadline_rate = defaultdict(defaultdict)
argv = sys.argv[1:]
if len(argv) < 1:
@ -75,16 +84,16 @@ if __name__ == "__main__":
i = 0
for key, value in files_tables.items():
get_values(key, value, miss_deadline_rate, total_latency, preemption_count)
get_values(key, value, miss_deadline_rate, total_latency, preemption_count, total_miss_deadline_rate)
for key, value in miss_deadline_rate.items():
print(key, value)
print("miss deadline rate:", key, value)
for key, value in total_latency.items():
print(key, value)
print("total latency:", key, value)
for key, value in preemption_count.items():
print(key, value)
print("preemption:", key, value)
js = json.dumps(miss_deadline_rate)
f= open("miss_deadline_rate.txt", 'w')
@ -103,3 +112,8 @@ if __name__ == "__main__":
f3.write(js3)
f3.close()
js4 = json.dumps(total_miss_deadline_rate)
f4= open("total_miss_deadline_rate.txt", 'w')
f4.write(js4)
f4.close()

Loading…
Cancel
Save