sapling/eden/scm/fsprobe.sh
Andrey Chursin f3cba474a3 fsprobe: add simple shell script to generate and run fsprobe tests
Summary:
Since fsprobe itself requires a 'plan' to run, we need separate script to standartize list of plans we think are relevant
This scripts allows to generate fsprobe plans and run them

Reviewed By: DurhamG

Differential Revision: D30908892

fbshipit-source-id: eb722fe1f6d982e42b66614f08bc73345e04f9e6
2021-09-14 19:52:15 -07:00

50 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
set -e
REAL_PATH=$(realpath "$0")
DIR_NAME=$(dirname "$REAL_PATH")
FSPROBE=${DIR_NAME}/build/cargo-target/release/fsprobe
if [ ! -f "$FSPROBE" ]; then
echo "Cannot find release version of fsprobe at $FSPROBE"
echo "Make sure you build fsprobe first by running cargo build --release in eden/scm/exec/fsprobe"
exit 1
fi
COMMAND=$1
PLANS=~/.fsprobe/
cd "$(hg root)"
shift || :
case $COMMAND in
"generate")
echo "Plans are stored in $PLANS"
mkdir -p $PLANS
find . -name TARGETS | awk '$0="cat "$0' > "$PLANS/cat.targets"
echo "Generated read files plan with$(wc -l $PLANS/cat.targets) actions"
head -20000 "$PLANS/cat.targets" > "$PLANS/cat.targets.20k"
head -10000 "$PLANS/cat.targets" > "$PLANS/cat.targets.10k"
;;
"list")
ls "$PLANS" | cat
;;
"run")
PLAN=$1
shift || :
echo "Running $PLAN"
$FSPROBE "$PLANS/$PLAN" "$@"
;;
*)
echo "Usage: fsprobe.sh generate | list | run | help"
echo
echo "Note: you must run fsprobe.sh in the repository that you want to test"
echo "For example, if you have eden mount at ~/fbsource, you need to cd ~/fbsource and run fsprobe.sh from there to test speed of this directory"
exit 1
;;
esac