]> git.saurik.com Git - redis.git/blame - utils/whatisdoing.sh
Allow Pub/Sub in contexts where other commands are blocked.
[redis.git] / utils / whatisdoing.sh
CommitLineData
249ad25f 1# This script is from http://poormansprofiler.org/
2
3#!/bin/bash
4nsamples=1
5sleeptime=0
6pid=$(pidof redis-server)
7
8for 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 | \
13awk '
14 BEGIN { s = ""; }
15 /Thread/ { print s; s = ""; }
16 /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } }
17 END { print s }' | \
18sort | uniq -c | sort -r -n -k 1,1