Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ma91n/delaytaskwatcher
goroutine delay task checker
https://github.com/ma91n/delaytaskwatcher
Last synced: 6 days ago
JSON representation
goroutine delay task checker
- Host: GitHub
- URL: https://github.com/ma91n/delaytaskwatcher
- Owner: ma91n
- License: mit
- Created: 2021-04-10T03:00:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-11T13:43:19.000Z (over 3 years ago)
- Last Synced: 2024-06-19T15:00:33.355Z (5 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# delaytaskwatcher
goroutine delay task checker## Usage
Installation.
```bash
go get github.com/ma91n/delaytaskwatcher
```Use delaytaskwatcher like below with go func.
```go
package mainimport (
"github.com/ma91n/delaytaskwatcher"
)func main() {
go delaytaskwatcher.Watch()
heavyTask()
}
```Output is below.
```
>go run exmaple.go
2021/04/10 13:21:38 task process time error: 3s has passed
goroutine profile: total 2
1 @ 0xd2b01a 0xd56405 0xdd24f9 0xdd24e6 0xdd2432 0xd2abf6 0xd592a1
# 0xd56404 time.Sleep+0xe4 runtime/time.go:193
# 0xdd24f8 main.heavyTaskMain+0x98 github.com/ma91n/delaytaskwatcher/example/exmaple.go:24
# 0xdd24e5 main.heavyTask+0x85 github.com/ma91n/delaytaskwatcher/example/exmaple.go:19
# 0xdd2431 main.main+0x51 github.com/ma91n/delaytaskwatcher/example/exmaple.go:13
# 0xd2abf5 runtime.main+0x255 runtime/proc.go:2251 @ 0xd53725 0xdc6ab5 0xdc6867 0xdc3338 0xdd23a5 0xd592a1
# 0xd53724 runtime/pprof.runtime_goroutineProfileWithLabels+0x64 runtime/mprof.go:716
# 0xdc6ab4 runtime/pprof.writeRuntimeProfile+0xd4 runtime/pprof/pprof.go:724
# 0xdc6866 runtime/pprof.writeGoroutine+0xa6 runtime/pprof/pprof.go:684
# 0xdc3337 runtime/pprof.(*Profile).WriteTo+0x3f7 runtime/pprof/pprof.go:331
# 0xdd23a4 github.com/ma91n/delaytaskwatcher.Watch.func1+0x104 github.com/ma91n/delaytaskwatcher/watcher.go:26
```You can know bottleneck where in your code.
## Options
```go
go delaytaskwatcher.Watch(delaytaskwatcher.Options{
Limit: 10 *time.Second,
})
```