-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate csv report when running example rpc client (#7)
- add configurable flags for host/port/recipient
- Loading branch information
Showing
5 changed files
with
182 additions
and
28 deletions.
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
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
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
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,42 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "Usage: $0 <filename>" | ||
exit 1 | ||
fi | ||
|
||
filename=$1 | ||
|
||
if [ ! -f "$filename" ]; then | ||
echo "File not found: $filename" | ||
exit 1 | ||
fi | ||
|
||
# Read data from the file into an array | ||
mapfile -t data < "$filename" | ||
|
||
# Function to calculate the average of an array | ||
calculate_average() { | ||
local sum=0 | ||
local count=${#data[@]} | ||
for value in "${data[@]}"; do | ||
sum=$((sum + value)) | ||
done | ||
echo "scale=2; $sum / $count" | bc | ||
} | ||
|
||
# Sort the array | ||
sorted_data=($(for i in "${data[@]}"; do echo $i; done | sort -n)) | ||
|
||
# Calculate min, max, median, and average | ||
min=${sorted_data[0]} | ||
max=${sorted_data[-1]} | ||
median=${sorted_data[${#sorted_data[@]}/2]} | ||
average=$(calculate_average) | ||
total=${#data[@]} | ||
# Print the results | ||
echo "Min: $min" | ||
echo "Max: $max" | ||
echo "Median: $median" | ||
echo "Average: $average" | ||
echo "Total: $total" |
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,20 +1,19 @@ | ||
#!/bin/bash | ||
|
||
if ! [[ "$0" =~ scripts/sendXRequests.sh ]]; then | ||
echo "must be run from repository root" | ||
exit 255 | ||
fi | ||
|
||
# Check if the number of arguments provided is correct | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <number_of_requests>" | ||
exit 1 | ||
fi | ||
|
||
# Store the argument in a variable | ||
times_to_run=$1 | ||
go_file_path="examples/rpc/client.go" | ||
|
||
# Loop to run the Go file X times in parallel | ||
for ((i=1; i<=$times_to_run; i++)) | ||
do | ||
echo "Sending $i request..." | ||
go run $go_file_path & | ||
done | ||
|
||
# Wait for all background processes to finish | ||
wait | ||
# Change the path to your Go file below | ||
go_file_path="examples/rpc/client.go" | ||
go run $go_file_path $times_to_run |