Skip to content

Instantly share code, notes, and snippets.

@jasonkeene
Created May 15, 2017 04:44
Show Gist options
  • Save jasonkeene/c8cad152a727b629b9596a9863446cca to your computer and use it in GitHub Desktop.
Save jasonkeene/c8cad152a727b629b9596a9863446cca to your computer and use it in GitHub Desktop.
Query a metron process for the read/write head delta.
b github.com/cloudfoundry/diodes.(*OneToOne).TryNext
c
p d.readIndex
p d.writeIndex
q
n
#!/bin/bash
if [ "$1" = "" ]; then
echo i need how many iterations
exit 1
fi
pid=$(ps aux | grep metron | grep -E '.json$' | awk '{print $2}')
if [ "$(echo "$pid" | wc -l)" != "1" ]; then
echo bad pid
exit 1
fi
for i in $(seq "$1"); do
echo attempting dump "$i"
cat ./diode_heads.dlv |
./dlv attach "$pid" /var/vcap/packages/metron_agent/metron |
tail -n 3 |
head -n 2 |
awk '{print $2}' |
python -c 'import sys; r = int(sys.stdin.readline().strip()); w = int(sys.stdin.readline().strip()); print w-r'
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment