i need to take threads dump in windows environment.
What exactly do you mean by “thread dump”?
Maybe this will help
https://golang.org/pkg/runtime/debug/
A thread dump is a snapshot of the state of all threads that are part of the process. The state of each thread is presented with a so called stack trace, which shows the contents of a thread’s stack.
Like this:
package main
import (
"os"
"runtime/pprof"
)
func main() {
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
}
The output:
$ go run main.go
goroutine profile: total 1
1 @ 0x10ad368 0x10ad170 0x10a9bd4 0x10b3ee5 0x102a407 0x1052dc1
# 0x10ad367 runtime/pprof.writeRuntimeProfile+0x97 /usr/local/go/src/runtime/pprof/pprof.go:707
# 0x10ad16f runtime/pprof.writeGoroutine+0x9f /usr/local/go/src/runtime/pprof/pprof.go:669
# 0x10a9bd3 runtime/pprof.(*Profile).WriteTo+0x3e3 /usr/local/go/src/runtime/pprof/pprof.go:328
# 0x10b3ee4 main.main+0x64 /Users/inanc/go/src/github.com/inancgumus/main.go:9
# 0x102a406 runtime.main+0x206 /usr/local/go/src/runtime/proc.go:201
1 Like
I mean, How can i see running goroutine.
like in java we can see threads dump for check it’s state.
using jstack.
any alternate to see goroutine states on windows and linux.
You can use a flag:
GODEBUG=schedtrace=1000 ./yourProgram
More verbose mode:
GODEBUG=scheddetail=1,schedtrace=100 ./yourProgram
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.