https://github.com/goki/prof
basic golang Go targeted profiling of specific functions / situations
https://github.com/goki/prof
Last synced: 8 months ago
JSON representation
basic golang Go targeted profiling of specific functions / situations
- Host: GitHub
- URL: https://github.com/goki/prof
- Owner: goki
- License: mit
- Created: 2018-04-20T00:03:28.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T01:20:09.000Z (over 2 years ago)
- Last Synced: 2025-06-30T07:03:35.750Z (12 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prof
Provides very basic but effective profiling of targeted functions or code sections, which can often be more informative than generic cpu profiling.
Here's how you use it:
```Go
// somewhere near start of program (e.g., using flag package)
profFlag := flag.Bool("prof", false, "turn on targeted profiling")
...
flag.Parse()
prof.Profiling = *profFlag
...
// surrounding the code of interest:
pr := prof.Start("name of function")
... code
pr.End()
...
// at end or whenever you've got enough data:
prof.Report(time.Millisecond) // or time.Second or whatever
```