]> git.saurik.com Git - redis.git/blob - utils/whatisdoing.sh
Generic iterator code for usage in ZUNIONSTORE/ZINTERSTORE
[redis.git] / utils / whatisdoing.sh
1 # This script is from http://poormansprofiler.org/
2
3 #!/bin/bash
4 nsamples=1
5 sleeptime=0
6 pid=$(pidof redis-server)
7
8 for x in $(seq 1 $nsamples)
9 do
10 gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid
11 sleep $sleeptime
12 done | \
13 awk '
14 BEGIN { s = ""; }
15 /Thread/ { print s; s = ""; }
16 /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } }
17 END { print s }' | \
18 sort | uniq -c | sort -r -n -k 1,1