Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Background profiling is an experimental patch that was floated as a way to get granular CPU usage information in golang/go#23458. I decided to dust off the Golang patch that implements this (https://go-review.googlesource.com/c/go/+/102755) and see for myself what you actually get. The output is something like this: ``` bgprof_test.go:51: ts: 12h37m15.540022251s labels: map[foo:bar] fn: hash/crc32.ieeeCLMUL bgprof_test.go:51: ts: 12h37m15.54801909s labels: map[foo:bar] fn: hash/crc32.ieeeCLMUL bgprof_test.go:51: ts: 12h37m15.560015269s labels: map[foo:bar] fn: hash/crc32.ieeeCLMUL bgprof_test.go:51: ts: 12h37m15.568026639s labels: map[foo:bar] fn: hash/crc32.ieeeCLMUL bgprof_test.go:51: ts: 12h37m15.580029608s labels: map[foo:bar] fn: hash/crc32.ieeeCLMUL ... ``` If we used profiler labels to identify queries (similar to what's shown in cockroachdb#60508) I guess I can see how you can somehow build a profile from this stream and then use the tag breakdown of the profile to reason about CPU allocated to each query. It seems wildly experimental and also unergonomical, though. It seems like we'd get maybe roughly the same, without as much bending over backwards and wildly experimental bleeding edge, by relying on periodic foreground sampling at a lower frequency (`runtime.SetCPUProfileRate`) than the default 100hz. To run this PR (which you shouldn't need to do for anything, but still) you'd clone `cockroachdb/go`, check out the [bgprof] branch, run `./make.bash` in `src` and change your PATH so that `$(which go)` is `bin/go`. Release note: None
- Loading branch information