2
0

whatisdoing.sh 694 B

123456789101112131415161718192021222324
  1. # This script is from http://poormansprofiler.org/
  2. #
  3. # NOTE: Instead of using this script, you should use the Redis
  4. # Software Watchdog, which provides a similar functionality but in
  5. # a more reliable / easy to use way.
  6. #
  7. # Check https://redis.io/topics/latency for more information.
  8. #!/bin/bash
  9. nsamples=1
  10. sleeptime=0
  11. pid=$(ps auxww | grep '[r]edis-server' | awk '{print $2}')
  12. for x in $(seq 1 $nsamples)
  13. do
  14. gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid
  15. sleep $sleeptime
  16. done | \
  17. awk '
  18. BEGIN { s = ""; }
  19. /Thread/ { print s; s = ""; }
  20. /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } }
  21. END { print s }' | \
  22. sort | uniq -c | sort -r -n -k 1,1