Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime check in approximate mode #45

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading