Skip to content

Commit

Permalink
Merge pull request #5 from AltSumpreme/main
Browse files Browse the repository at this point in the history
[FEAT] Benchmarking added
  • Loading branch information
nots1dd authored Oct 7, 2024
2 parents a78f2dd + 7c05e67 commit 4d7281b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/

debug/build/
issues.txt
*.o
6 changes: 6 additions & 0 deletions CHANGELOG/v2_9.md
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.
28 changes: 28 additions & 0 deletions benchmarks/run_benchmark.sh
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"

0 comments on commit 4d7281b

Please sign in to comment.