-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
24 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,40 @@ | ||
#!/usr/bin/python3 | ||
|
||
import csv | ||
import os | ||
import sys | ||
|
||
ATTEMPTS = 5 | ||
|
||
benchmarkId = sys.argv[1] | ||
sourceFilepath = f'../results/benchmarks/{benchmarkId}/benchmark_results.csv' | ||
destinationFile = open(f'../results/benchmarks/{benchmarkId}_averaged.csv', "w") | ||
|
||
# Read in csv file | ||
with open(sourceFilepath, newline="") as csvfile: | ||
reader = csv.reader(csvfile, delimiter=",", quotechar="\"") | ||
avgRuntime = 0.0 | ||
for line in reader: | ||
# Read in the csv rows | ||
threads = line[0] | ||
partitions = line[1] | ||
attempt = int(line[2]) | ||
runtime = float(line[3]) | ||
# Add to the average runtime add write it to the file when the 5th attempt is reached | ||
avgRuntime += runtime | ||
if attempt == ATTEMPTS: | ||
avgRuntime /= ATTEMPTS | ||
destinationFile.write(f'{threads},{partitions},{avgRuntime}\n') | ||
avgRuntime = 0 | ||
|
||
destinationFile.close() | ||
def generate_averages(benchmark_id): | ||
source_filepath = f'../results/benchmarks/{benchmark_id}/benchmark_results.csv' | ||
destination_file = open(f'../results/benchmarks/{benchmark_id}_averaged.csv', "w") | ||
with open(source_filepath, newline="") as csvfile: | ||
reader = csv.reader(csvfile, delimiter=",", quotechar="\"") | ||
avg_runtime = 0.0 | ||
for line in reader: | ||
# Read in the csv rows | ||
threads = line[0] | ||
partitions = line[1] | ||
attempt = int(line[2]) | ||
runtime = float(line[3]) | ||
# Add to the average runtime add write it to the file when the 5th attempt is reached | ||
avg_runtime += runtime | ||
if attempt == ATTEMPTS: | ||
avg_runtime /= ATTEMPTS | ||
destination_file.write(f'{threads},{partitions},{avg_runtime}\n') | ||
avg_runtime = 0 | ||
destination_file.close() | ||
|
||
|
||
def main() -> int: | ||
for benchmark_id in os.listdir("../results/benchmarks"): | ||
if os.path.isdir(f'../results/benchmarks/{benchmark_id}'): | ||
generate_averages(benchmark_id) | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters