git subrepo pull (merge) --force deps/libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / zstd-1.5.5 / contrib / linux-kernel / squashfs-benchmark.sh
CommitLineData
648db22b 1# !/bin/sh
2set -e
3
4# Benchmarks run on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
5# The VM is running on a Macbook Pro with a 3.1 GHz Intel Core i7 processor and
6# 16 GB of RAM and an SSD.
7
8# $BENCHMARK_DIR is generated with the following commands, from the Ubuntu image
9# ubuntu-16.10-desktop-amd64.iso.
10# > mkdir mnt
11# > sudo mount -o loop ubuntu-16.10-desktop-amd64.iso mnt
12# > cp mnt/casper/filesystem.squashfs .
13# > sudo unsquashfs filesystem.squashfs
14
15# $HOME is on a ext4 filesystem
16BENCHMARK_DIR="$HOME/squashfs-root/"
17BENCHMARK_FS="$HOME/filesystem.squashfs"
18
19# Normalize the environment
20sudo rm -f $BENCHMARK_FS 2> /dev/null > /dev/null || true
21sudo umount /mnt/squashfs 2> /dev/null > /dev/null || true
22
23# Run the benchmark
24echo "Compression"
25echo "sudo mksquashfs $BENCHMARK_DIR $BENCHMARK_FS $@"
26time sudo mksquashfs $BENCHMARK_DIR $BENCHMARK_FS $@ 2> /dev/null > /dev/null
27
28echo "Approximate compression ratio"
29printf "%d / %d\n" \
30 $(sudo du -sx --block-size=1 $BENCHMARK_DIR | cut -f1) \
31 $(sudo du -sx --block-size=1 $BENCHMARK_FS | cut -f1);
32
33# Mount the filesystem
34sudo mount -t squashfs $BENCHMARK_FS /mnt/squashfs
35
36echo "Decompression"
37time sudo tar -c /mnt/squashfs 2> /dev/null | wc -c > /dev/null
38
39sudo umount /mnt/squashfs