-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from AltSumpreme/main
[FEAT] Benchmarking added
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
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,3 +1,4 @@ | ||
build/ | ||
|
||
debug/build/ | ||
issues.txt | ||
*.o |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Change Type:Minor | ||
|
||
# Summary of the changes | ||
|
||
-> Added a bash script run_benchmarks.sh that benchmarks the .c files in the project using the time | ||
command in Unix/Linux operating systems. The script measures the amount of time taken by each program to execute. |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
N=100 | ||
total_time=0 | ||
|
||
#Compile the project with optimisations | ||
find ./src -name "*.c" | xargs gcc -O2 -o litefm | ||
|
||
|
||
|
||
|
||
for i in $(seq 1 $N); do | ||
echo "Running iteration $i..." | ||
|
||
run_time=$( { time ./LiteFM; } 2>&1 | grep real | awk '{print $2}') | ||
min=$(echo $run_time | cut -d'm' -f 1) | ||
sec=$(echo $run_time | cut -d'm' -f 2 | sed 's/s//') | ||
|
||
#calculate total time | ||
total=$(echo "$min*60 + $sec"|bc) | ||
total_time=$(echo "$total_time+ $total"|bc) | ||
|
||
done | ||
|
||
|
||
|
||
avg_time=$(echo "scale=3; $total_time/$N"|bc) | ||
echo "Average execution time: $avg_time seconds" |