tangetools/iothrottle/Makefile
2024-12-30 23:44:44 +01:00

29 lines
1.2 KiB
Makefile

all: iothrottle
true
iothrottle: iothrottle.hex iothrottle.sh
perl -pe 's/hex=.*/"hex=".`cat iothrottle.hex`/e' iothrottle.sh > iothrottle
chmod +x iothrottle
iothrottle.so: iothrottle.c
gcc -O2 -shared -fPIC -o iothrottle.so iothrottle.c -ldl
strip iothrottle.so
iothrottle.hex: iothrottle.so
hexdump -ve '1/1 "%.2x"' iothrottle.so > iothrottle.hex
LC_ALL=C awk '{for (i=1; i<=length($$0); i+=2) printf "%c", strtonum("0x" substr($$0, i, 2))}' iothrottle.hex > iothrottle.bin
md5sum iothrottle.so iothrottle.bin
test: iothrottle
./iothrottle --io 1M ssh localhost seq 1000000 | pv >/dev/null
./iothrottle --io 3M curl -q https://ftp.nluug.nl/ftp/pub/os/Linux/distr/archlinux/pool/packages/dtkwidget-5.7.2-1-x86_64.pkg.tar.zst >/dev/null
./iothrottle --io 1M wget -qO- https://ftp.nluug.nl/ftp/pub/os/Linux/distr/archlinux/pool/packages/dtkwidget-5.7.2-1-x86_64.pkg.tar.zst | pv >/dev/null
./iothrottle -o 20000K seq 10000000 | pv > big
./iothrottle cat big | pv > /dev/null
./iothrottle -i 20M cat big | pv > /dev/null
./iothrottle -o 20000K cat big | pv > /dev/null
rm big
clean:
rm -f iothrottle.so iothrottle.hex iothrottle.bin iothrottle iothrottle.1 iothrottle~