-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//go:build go1.16 && !go1.20 | ||
// +build go1.16,!go1.20 | ||
|
||
package pprof | ||
|
||
import "runtime" | ||
|
||
type MutexProfileScaler struct { | ||
f func(cnt int64, ns float64) (cnt int64, ns float64) | ||
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.16)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.16)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.17)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.17)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.18)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.18)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.18)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.18)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.19)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.19)
Check failure on line 9 in godeltaprof/internal/pprof/mutex_scale_go19.go GitHub Actions / go (1.19)
|
||
} | ||
|
||
func scaleMutexProfile(scaler MutexProfileScaler, cnt int64, ns float64) (int64, float64) { | ||
return scaler.f(cnt, ns) | ||
} | ||
|
||
var ScalerMutexProfile = MutexProfileScaler{func(cnt int64, ns float64) (int64, float64) { | ||
period := runtime.SetMutexProfileFraction(-1) | ||
return cnt * int64(period), ns * float64(period) | ||
}} | ||
|
||
var ScalerBlockProfile = MutexProfileScaler{func(cnt int64, ns float64) (int64, float64) { | ||
// Do nothing. | ||
// The current way of block profile sampling makes it | ||
// hard to compute the unsampled number. The legacy block | ||
// profile parse doesn't attempt to scale or unsample. | ||
return cnt, ns | ||
}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build go1.20 | ||
// +build go1.20 | ||
|
||
package pprof | ||
|
||
type MutexProfileScaler struct { | ||
} | ||
|
||
func scaleMutexProfile(_ MutexProfileScaler, cnt int64, ns float64) (int64, float64) { | ||
return cnt, ns | ||
} | ||
|
||
var ScalerMutexProfile = MutexProfileScaler{} | ||
|
||
var ScalerBlockProfile = MutexProfileScaler{} |