-
Notifications
You must be signed in to change notification settings - Fork 5
/
proofdistrib
executable file
·108 lines (91 loc) · 2.3 KB
/
proofdistrib
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
## Description: Show (or graph) eligible plot distribution per Proof Check, by occurrence.
# Manually set this if you want to display plot count
COUNT=false
CHIAPATH="$HOME/chia-blockchain-1.2.11"
if [[ $COUNT == true ]] && [[ ! -z $CHIAPATH ]]; then
source $CHIAPATH/activate
PLOTCOUNT=$(chia farm summary | grep 'plots of size' | grep -o '[^$(printf '\t') ].*')
fi
LOGPATH="$HOME/.chia/mainnet/log/harvester-debug.log*"
if [[ ! $(ls -A $LOGPATH) ]]; then
echo "No files found at $LOGPATH"
echo "Update line 3 of $0 and try again"
exit 1
fi
## Functions
usage() {
echo "Usage: $0 [OPTION]" 1>&2
exit 1
}
plottery() {
cat $LOGPATH | \
grep -o 'Found.*proofs' | \
sort | \
uniq -c | \
awk -F" " '{print "", $3"\t", "┃ ", $1}'
# grep -o 'Found.*proofs' "$LOGPATH" | \
# sort | \
# uniq -c
# awk -F" " '{print " ", $5"\t", "┃ ", $13}'
#cat ~/.chia/mainnet/log/farmer-debug.log* | grep -o 'Found.*proofs' | sort | uniq -c
# stdbuf -o0 grep -s 'eligible' \
# <(stdbuf -o0 cat $LOGPATH) | \
# awk -F" " '{print " ", $5"\t", "┃ ", $13}'
}
showdistrib() {
cat <<-'EOF'
P: Proofs Found
O: Occurrence
P: O:
━━━━╋━━━━
EOF
#sort | uniq -c | awk -F" " '{print " ", $3"\t", "┃ ", $1}' | column -t
plottery | column -t | \
# sort | uniq -c | awk -F" " '{print " ", $3"\t", "┃ ", $1}' | column -t
# awk '{print $1}' | \
# tail +4 | \
# sort -n | \
# uniq -c | \
# sort -n | \
awk '{print " "$1"•", $2, $3}' | \
column -s'•' -t
if [[ $COUNT == true ]]; then
echo -e "\nWith: $PLOTCOUNT"
fi
}
wingraph() {
if ! [ -x "$(command -v uplot)" ]; then
echo 'Error: uplot is not installed, or installed gem is not added to PATH' >&2
echo 'Get it at: https://github.com/red-data-tools/YouPlot' >&2
echo 'Get it with: gem install youplot' >&2
exit 1
fi
echo ""
plottery
# uplot c -r \
# -t "(E)ligible plots per Proof Check, by (O)ccurrence" \
# -x "O" \
# -y "E " \
# -b barplot
if [[ $COUNT == true ]]; then
echo -e "\nWith: $PLOTCOUNT"
fi
}
## End Functions
OPTSTR='g'
while getopts "$OPTSTR" opt; do
case "$opt" in
g)
GRAPH=true
;;
*)
usage
;;
esac
done
if [[ $GRAPH == true ]]; then
wingraph
else
showdistrib
fi