Skip to content

Commit

Permalink
Merge pull request #45 from tahiat/runtime
Browse files Browse the repository at this point in the history
Runtime check in approximate mode
  • Loading branch information
kelloggm authored Apr 12, 2024
2 parents f33ad6f + 550fdfa commit f8a5e6a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import glob
import stat
import argparse
import time
import math
import statistics

issue_folder_dir = 'ISSUES'
specimin_input = 'input'
Expand All @@ -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):
'''
Expand Down Expand Up @@ -450,8 +454,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 = round(end_time - start_time)

global run_time
run_time[f"{issue_id}"] = duration

print(f"{result.name} - {result.status}")

if result.status.lower() == "fail":
Expand Down Expand Up @@ -826,6 +837,12 @@ 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()))
mean_runtime = round(mean_runtime)
print(f"Avg runtime = {mean_runtime}")

print("\n\n\n\n")
print(f"issue_name | status | Fail reason | preservation_status | preservation reason ")
print("------------------------------------------------------------------------------------------")
Expand Down

0 comments on commit f8a5e6a

Please sign in to comment.