Update benchmark_disque.sh
This commit is contained in:
parent
b89ba14c72
commit
7bcdabea0a
1 changed files with 15 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ FILECOUNT=1000
|
|||
FILEMODE="fixed"
|
||||
LINES=1
|
||||
FLUSH_CACHE="no"
|
||||
RANDOM_WRITE="no"
|
||||
|
||||
# Fonction pour convertir "M:SS.xxx" en secondes float
|
||||
convert_time_to_sec() {
|
||||
|
|
@ -32,6 +33,7 @@ function show_help {
|
|||
echo " --mode=MODE Mode de génération : fixed ou random. Défaut: fixed"
|
||||
echo " --lines=N Nombre de lignes pour les fichiers en mode fixed. Défaut: 1"
|
||||
echo " --flush-cache Vide les caches Linux entre écriture et lecture (nécessite root)"
|
||||
echo " --random-write Utilise /dev/urandom pour écrire au lieu de /dev/zero"
|
||||
echo " --help Affiche ce message d'aide"
|
||||
echo ""
|
||||
echo "Exemples:"
|
||||
|
|
@ -64,6 +66,9 @@ for arg in "$@"; do
|
|||
--flush-cache)
|
||||
FLUSH_CACHE="yes"
|
||||
;;
|
||||
--random-write)
|
||||
RANDOM_WRITE="yes"
|
||||
;;
|
||||
--help)
|
||||
show_help
|
||||
;;
|
||||
|
|
@ -74,6 +79,13 @@ for arg in "$@"; do
|
|||
esac
|
||||
done
|
||||
|
||||
# Définir la source d'écriture
|
||||
if [[ "$RANDOM_WRITE" == "yes" ]]; then
|
||||
WRITE_SRC="/dev/urandom"
|
||||
else
|
||||
WRITE_SRC="/dev/zero"
|
||||
fi
|
||||
|
||||
# Répertoires
|
||||
BENCHDIR="./testbench"
|
||||
TESTFILE="$BENCHDIR/dd_testfile"
|
||||
|
|
@ -81,8 +93,8 @@ SMALLDIR="$BENCHDIR/smallfiles"
|
|||
|
||||
mkdir -p "$SMALLDIR"
|
||||
|
||||
echo "=== Test d'écriture séquentielle avec dd ($FILESIZE, sync forcée) ==="
|
||||
WRITE_TIME_SEC=$( (time dd if=/dev/zero of="$TESTFILE" bs="$FILESIZE" count=1 conv=fdatasync status=none) 2>&1 | grep real | awk '{print $2}' | sed 's/m/:/;s/s//')
|
||||
echo "=== Test d'écriture séquentielle avec dd ($FILESIZE, source: $(basename $WRITE_SRC), sync forcée) ==="
|
||||
WRITE_TIME_SEC=$( (time dd if="$WRITE_SRC" of="$TESTFILE" bs="$FILESIZE" count=1 conv=fdatasync status=none) 2>&1 | grep real | awk '{print $2}' | sed 's/m/:/;s/s//')
|
||||
WRITE_SEC=$(convert_time_to_sec "$WRITE_TIME_SEC")
|
||||
echo -n "Durée : $WRITE_TIME_SEC"
|
||||
echo " (~$(awk -v size="$FILESIZE" -v sec="$WRITE_SEC" 'BEGIN {
|
||||
|
|
@ -136,3 +148,4 @@ echo -e "\nNettoyage..."
|
|||
rm -rf "$BENCHDIR"
|
||||
|
||||
echo -e "\nBenchmark terminé."
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue