-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfdbench.sh
executable file
·33 lines (24 loc) · 1.01 KB
/
fdbench.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -e
LINUX=~/code/linux/
threads=10
if [[ $# -gt 0 ]]; then
threads="$1"
fi
# DaisyNFS cannot handle directories with more than 1024 files, so delete excess files
# shellcheck disable=2034
find $LINUX -type d -printf '%p %i\n' | while read -r outername _outerinode; do
count=$(find "$outername" -type d -maxdepth 1 | wc -l)
remain=$((1024 - count))
find "$outername" -type f -maxdepth 1 -printf '%p %i\n' | sort -n | head -n -"$remain" | while read -r name inode; do
find "$outername" -inum "$inode" -delete
echo "delete $name"
done
done
# DaisyNFS cannot handle symbolic links, so delete them
find $LINUX -type l -printf "%p\n" -delete
cd /mnt/nfs
cp -r $LINUX .
cd linux
hyperfine --parameter-scan num_threads 1 "$threads" --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'fdfind -j{num_threads} "crypto" | wc -l'
hyperfine --parameter-scan num_threads 1 "$threads" --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'rg -j{num_threads} -c PM_PARAM'