performance_tests.sh et readm.md mis en forme

This commit is contained in:
eleonore12345 2024-06-28 15:45:45 +02:00
parent d7f3080212
commit c3fd368253
3 changed files with 144 additions and 9 deletions

BIN
notes.odt

Binary file not shown.

View File

@ -1,14 +1,88 @@
#!/bin/bash #!/bin/bash
. driglibash-args
. driglibash-base
#prerequisite: creation_repo.sh has been run #prerequisite: creation_repo.sh has been run
#remove the local copy #remove the local copy
rm -rf performance_testing
section TEST0 Help()
echo "TEST 0 : case of classic cloning." {
git clone --progress $1 2> cloning_text echo "
NAME
performance_tests.sh
SYNOPSIS
performance_tests.sh [-h] [-a] [-n number] [SSH LINK to en empty remote git repository] OPTIONS
-a excutes all the tests.
-n [number] executes test [number]
-h prints the help.
DESCRIPTION
This script is in writing. It allows you to measure memory and bandwidth usage for different method of cloning on the remote repository given.
TEST0: classic cloning
TEST1: --single-branch "
}
test0(){
section TEST0
echo "TEST 0 : case of classic cloning."
git clone --progress $1 2> cloning_text
mem0=$(du ./performance_testing | tail -n1 | tr -cd [:digit:])
bw0=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a classic cloning : $mem0"
echo "bandwidth usage : $bw0"
run rm -rf performance_testing
}
test1(){
section TEST1
echo "TEST 1 : case of --single-branch cloning."
git clone --progress --single-branch $1 2> cloning_text
mem1=$(du ./performance_testing | tail -n1 | tr -cd [:digit:])
bw1=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a --single-branch cloning : $mem1"
echo "bandwidth usage : $bw1"
run
rm -rf performance_testing
}
while getopts ":hn:a" option; do
case $option in
h) # display Help
Help
exit;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
n)
TEST_NUM=$OPTARG;;
a)
ALL_TESTS=true;;
esac
done
shift "$(($OPTIND -1))" #so that the cloning link is in $1 no matter how many options were used
if [ -z "$1" ]; then
echo "Error: No repository link provided"
Help
die
else
REPO_LINK=$1
fi
if [ "$ALL_TESTS" = true ]; then
test0 $REPO_LINK
test1 $REPO_LINK
elif [ -n "$TEST_NUM" ]; then
case $TEST_NUM in
0)
test0 $REPO_LINK;;
1)
test1 $REPO_LINK;;
*)
echo "Error: Invalid test number"
die;;
esac
else
Help
fi
mem0=$(du ./performance_testing | tail -n1 | tr -cd [:digit:])
bw0=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a classic cloning : $mem0"
echo "bandwidth usage : $bw0"

61
readme.md Normal file
View File

@ -0,0 +1,61 @@
## Testing of differeng cloning methods
Our objective is to find the least-consuming method in terms of memory and bandwidth resources.
We are interested in cloning one specific state of the repository. We are not interested in its history or the possibility to change it from the server where it has been cloned. The first step is done by the script creation_repo.sh which creates an adequate repository to test on. The testing in itself is done by performance_tests.sh.
## Creation of the test repository
The script creation_repo.sh creates a performance_testing repository.
NAME
creation_repo.sh
SYNOPSIS
creation_repo.sh [SSH LINK to en empty remote git repository]
DESCRIPTION
This script is in writing.
It creates a git repository in the current directory, linked to a remote passed as argument. Everything is up-to-date between the remote and the local versions. The data stored is generated randomly in binary.
OPTIONS
-h prints the help.
Here is a history of the commits:
### branch main
commit f665df376fa57880b5edfb85b156c7703601980e (tag: start)
sample0 1M created
commit a17812c13a69986c1103e0d06ff0a0b59a3a4a63
sample1 1M created
commit bd9d8e9421c3253abba47b9def480f1b2d595568
sample3 1M created
commit 0e599f3b47bf3200dc6e2734df0c6e655c0d8dde
sample4 5M created
commit effb3cab262e6e1e8242e524e1862b6f77d7ad38
sample4 5M deleted
### branch secondary
commit 643cdbbda81f4c4f26513b9d6ecca3d436e97040
sample0 1M created
commit b4bac1f2a2c1b4ab325751748b9496cccc65b082
sample1 1M created
commit e69695f08e79c160045b3319297597a9d8c9b513
sample2 500K created
Which gives us the latest state:
### branch main
sample0 1M
sample1 1M
sample3 1M
### branch secondary
sample0 1M
sample1 1M
sample2 500K
## Testing
The script performance_tests.sh measures memory and bandwidth usage of different git cloning scenarii.
NAME
performance_tests.sh
SYNOPSIS
performance_tests.sh [SSH LINK to en empty remote git repository] [number]
OPTIONS
-a excutes all the tests.
-n [number] executes test [number]
-h prints the help.
DESCRIPTION
This script is in writing. It allows you to measure memory and bandwidth usage for different method of cloning on the remote repository given.
TEST0: classic cloning
TEST1: --single-branch