Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 908 Bytes

README.md

File metadata and controls

32 lines (27 loc) · 908 Bytes

Go Report Card GoDoc

A repository provides access to goroutine's ID, state and otehr information by parsing message invoking runtime.Stack

Install

go get -u github.com/liangyaopei/goroutineinfo

Example

func TestGetInfoSingle(t *testing.T) {
	stacks := goroutineinfo.GetInfo(false)
	for _, stack := range stacks {
		t.Logf("id:[%d],state:[%s]", stack.ID(), stack.State())
	}
}

Benchmark

func BenchmarkGetInfoSingle(b *testing.B) {
	_ = goroutineinfo.GetInfo(false)
}

testing

go test ./... -bench=BenchmarkGetInfoSingle -benchmem -run=^$ -count=10

time cost is 0.000034 ns/op average.