From 39f926ada05367495bbe8a5aab639df5ba728850 Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 12 Apr 2024 02:08:51 -0400 Subject: [PATCH 1/2] runtime calculation of only specimin exeuction --- main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 6ff69be..2faa045 100644 --- a/main.py +++ b/main.py @@ -14,6 +14,9 @@ import glob import stat import argparse +import time +import math +import statistics issue_folder_dir = 'ISSUES' specimin_input = 'input' @@ -28,6 +31,7 @@ linux_system_identifier = "Linux" macos_system_identifier = "Darwin" preservation_status_file_name = "preservation_status.json" +run_time = {} def read_json_from_file(file_path): ''' @@ -440,8 +444,15 @@ def performEvaluation(issue_data, isJarMode = False) -> Result: result: Result = None specimin_command = build_specimin_command(repo_name, os.path.join(issue_folder_abs_dir, issue_id), issue_data[JsonKeys.ROOT_DIR.value], issue_data[JsonKeys.TARGETS.value], jar_path if os.path.exists(jar_path) else "", isJarMode) - + start_time = time.time() result = run_specimin(issue_id ,specimin_command, specimin_path) + end_time = time.time() + + duration = end_time - start_time + + global run_time + run_time[f"{issue_id}"] = duration + print(f"{result.name} - {result.status}") if result.status.lower() == "fail": @@ -774,6 +785,11 @@ def main(): with open(prev_status_file, "w") as json_file: json.dump(preservation_status, json_file, indent= 2) + global run_time + print(json.dumps(run_time)) + mean_runtime = statistics.mean(list(run_time.values())) + print(f"Avg runtime = {mean_runtime}") + print("\n\n\n\n") print(f"issue_name | status | Fail reason | preservation_status | preservation reason ") print("------------------------------------------------------------------------------------------") From 550fdfa7a7fddf86840c904c17e11b00e084a09e Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 12 Apr 2024 12:41:51 -0400 Subject: [PATCH 2/2] round runtime --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d579bb7..2e4c0b8 100644 --- a/main.py +++ b/main.py @@ -458,7 +458,7 @@ def performEvaluation(issue_data, isJarMode = False) -> Result: result = run_specimin(issue_id ,specimin_command, specimin_path) end_time = time.time() - duration = end_time - start_time + duration = round(end_time - start_time) global run_time run_time[f"{issue_id}"] = duration @@ -840,6 +840,7 @@ def main(): global run_time print(json.dumps(run_time)) mean_runtime = statistics.mean(list(run_time.values())) + mean_runtime = round(mean_runtime) print(f"Avg runtime = {mean_runtime}") print("\n\n\n\n")