Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYI: statistics/visualization script #10

Open
meowsbits opened this issue Dec 3, 2020 · 0 comments
Open

FYI: statistics/visualization script #10

meowsbits opened this issue Dec 3, 2020 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@meowsbits
Copy link
Contributor

meowsbits commented Dec 3, 2020

Here's a tiny script(s) that crunches the numbers on node record counts over time. Except for spark it's pretty out-of-the-box portable.

> for f in $(find . -type f -name '*stats.sh'); do echo;echo '>>>>>>'$f;echo; cat $f; done

>>>>>>./stats.sh

#!/usr/bin/env bash

# Does basic statistics and visualization for node record counts.
# Statistics are aggregated at the DAILY granularity, traversing as far back as the second argument value.
# 
# Use: ./script.sh <nodes.json> <days>
# 
# Where 'days' is the number of days back from now.

> count.txt

for i in $(seq 1 $2); do
  commit=$(git rev-list --max-count 1 --before="$(date --date '-'"$i"' days' --iso-8601=minutes)" etccore)
  n=0
  if [[ ! -z $commit ]]; then
    git checkout $commit -- $1
    n=$(cat $1 | grep record | wc -l)
  else
    echo skipping "$i (set to 0)"
  fi
  echo "$n" >> count.txt
done

sed '1!G;h;$!d' count.txt | spark

git checkout etccore -- $1

echo latest count:$(cat $1 | grep record | wc -l)

# https://stackoverflow.com/a/9790056
perl -e 'use List::Util qw(max min sum); @a=();while(<>){$sqsum+=$_*$_; push(@a,$_)}; $n=@a;$s=sum(@a);$a=$s/@a;$m=max(@a);$mm=min(@a);$std=sqrt($sqsum/$n-($s/$n)*($s/$n));$mid=int @a/2;@srtd=sort @a;if(@a%2){$med=$srtd[$mid];}else{$med=($srtd[$mid-1]+$srtd[$mid])/2;};print "records:$n\nsum:$s\navg:$a\nstd:$std\nmed:$med\nmax:$m\min:$mm";' < count.txt | grep -v sum

rm count.txt

>>>>>>./allstats.sh

#!/usr/bin/env bash

# Use: ./allstats.sh 100 > STATS.md

for f in $(find . -type f -name '*nodes.json' | sort); do
  echo "# $f"
  echo -e \`\`\`
  ./stats.sh "$f" $1
  echo -e \`\`\`
  echo 
done

./allstats.sh 100 > STATS.md && cat STATS.md

./all.classic.blockd.info/nodes.json

▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▃▃▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▄▄▅▇█
latest count:352
records:100
avg:245.72
std:26.7451229198896
med:246
max:372
min:200

./all.kotti.blockd.info/nodes.json

▁▁▁▁▁▃▃▃▃▃▅▅▅▅▅▅▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▆▆█▆▆
latest count:9
records:100
avg:8.86
std:1.32680066324977
med:7
max:12
min:7

./all.mordor.blockd.info/nodes.json

▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▂▂▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▄▄▄▄▄▄▄▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▆▆▆▇█
latest count:16
records:100
avg:9.08
std:2.71175220106853
med:4
max:16
min:4

./les.classic.blockd.info/nodes.json

▁▁▁▁▁▁▁▁▁▅▇▇▅▇█▄▁▁▁▁▁▁▂▂▂▂▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
latest count:2
records:100
avg:1.66
std:3.03387540943922
med:1
max:15
min:0

./les.kotti.blockd.info/nodes.json

▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅
latest count:1
records:100
avg:1
std:0
med:1
max:1
min:1

./les.mordor.blockd.info/nodes.json

▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████████████████████████████████████████████████████████████████████████████████████
latest count:1
records:100
avg:0.84
std:0.366606055596467
med:1
max:1
min:0
@meowsbits meowsbits added documentation Improvements or additions to documentation enhancement New feature or request wontfix This will not be worked on and removed wontfix This will not be worked on labels Dec 3, 2020
@meowsbits meowsbits changed the title statistics/visualization script FYI: statistics/visualization script Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant