forked from opentensor/subtensor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.sh
executable file
·46 lines (40 loc) · 1.1 KB
/
benchmark.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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
DEFAULT_BIN_PATH='./target/production/node-subtensor'
BIN_PATH=$DEFAULT_BIN_PATH
TMP_SPEC='temp.json'
OUTPUT_FILE='benchmarking.txt'
# Getting arguments from user
while [[ $# -gt 0 ]]; do
case $1 in
-p | --bin-path)
BIN_PATH="$2"
shift
shift
;;
-* | --*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1")
shift
;;
esac
done
# Ensure binary exists before node-subtensor executions
if [ ! -f $BIN_PATH ]; then
if [[ "$DEFAULT_BIN_PATH" == "$BIN_PATH" ]]; then
cargo build --profile production --features runtime-benchmarks
else
echo "Binary '$BIN_PATH' does not exist. You can use -p or --bin-path to specify a different location."
exit 1
fi
fi
# Build Temporary Spec
$BIN_PATH build-spec --disable-default-bootnode --raw --chain local >$TMP_SPEC
# Run benchmark
$BIN_PATH benchmark pallet \
--chain=$TMP_SPEC \
--pallet pallet-subtensor --extrinsic 'schedule_coldkey_swap' \
--output $OUTPUT_FILE
rm $TMP_SPEC