Преглед на файлове

:robot: Add debug heap/goroutine collection script

Ettore Di Giacinto преди 3 години
родител
ревизия
12f293aaf3
променени са 1 файла, в които са добавени 16 реда и са изтрити 0 реда
  1. 16 0
      scripts/collect.sh

+ 16 - 0
scripts/collect.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+# Collect debug data.
+# To run with edgevpn, run with --debug and --api flags on.
+# Note: requires https://github.com/whyrusleeping/stackparse for parsing goroutine debug stacks
+
+mkdir collect
+((count=1))
+while true; do
+	(( count = count + 1))
+	curl http://localhost:8080/debug/pprof/heap > collect/heap$count
+	curl 'http://localhost:8080/debug/pprof/goroutine' > collect/goroutine$count
+	curl 'http://localhost:8080/debug/pprof/goroutine?debug=2' > collect/goroutine_debug_$count
+	stackparse --summary collect/goroutine_debug_$count > collect/goroutine_debug_${count}_summary
+	sleep 60
+done
+