mirror of
https://github.com/minio/minio.git
synced 2025-02-28 13:59:15 -05:00
goroutines parser: Add --less flag to filter goroutines (#17339)
This commit is contained in:
parent
1436858347
commit
f9e07d6143
@ -33,14 +33,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
re *regexp.Regexp
|
re *regexp.Regexp
|
||||||
goTime, margin time.Duration
|
goTime, less, margin time.Duration
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
re = regexp.MustCompile(`^goroutine [0-9]+ \[[^,]+(, ([0-9]+) minutes)?\]:$`)
|
re = regexp.MustCompile(`^goroutine [0-9]+ \[[^,]+(, ([0-9]+) minutes)?\]:$`)
|
||||||
|
|
||||||
flag.DurationVar(&goTime, "time", 0, "goroutine block age")
|
flag.DurationVar(&less, "less", 0, "goroutine waiting less than the specified time")
|
||||||
|
flag.DurationVar(&goTime, "time", 0, "goroutine waiting for exactly the specified time")
|
||||||
flag.DurationVar(&margin, "margin", 0, "margin time")
|
flag.DurationVar(&margin, "margin", 0, "margin time")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +131,9 @@ func main() {
|
|||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
|
|
||||||
for t, stacks := range r {
|
for t, stacks := range r {
|
||||||
|
if less != 0 && t >= less {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if goTime == 0 || math.Abs(float64(t)-float64(goTime)) <= float64(margin) {
|
if goTime == 0 || math.Abs(float64(t)-float64(goTime)) <= float64(margin) {
|
||||||
for _, stack := range stacks {
|
for _, stack := range stacks {
|
||||||
fmt.Println(stack)
|
fmt.Println(stack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user