mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
f3cba474a3
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
50 lines
1.4 KiB
Bash
Executable File
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
|