'Increasing total samples during CPU profiling with pprof in golang

I am profiling my go application by exposing the /debug/pprof endpoints and obtaining profiles using those endpoints. However, when I run the /debug/pprof/profile for CPU snapshots I see that my total sample is a small portion of overall duration. Duration: 30s, Total samples = 340ms ( 1.13%)

How do I increase total samples?

Doing a search led me to SetCPUProfileRate, But I'm not sure how to use that with command line pprof tool. Another follow up : why is the sampling percentage so low?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source