title: How to get Go's "block" profiler to work?
body: <p>I am trying to enable Go's "block" profiler by adding the following code to my main function:</p>
  
  <pre><code>f, err := os.Create(profFile)
  if err != nil {
      // Error handling
  }
  
  runtime.SetBlockProfileRate(1)
  p := pprof.Lookup("block")
  defer func() {
      err := p.WriteTo(f, 0)
      if err != nil {
          Logger.Error("Error writing block profile: %v", err)
      }
  }()
  </code></pre>
  
  <p>I do see the profile file created after my application is run and I am trying to interpret the results by running the command:</p>
  
  <pre><code>$ go tool pprof --text &lt;PROFILE_FILE&gt; 
  29.95mins of 29.95mins total (  100%)
        flat  flat%   sum%        cum   cum%
   29.95mins   100%   100%  29.95mins   100%  
  </code></pre>
  
  <p>I don't see any data on the block times. Is the code to generate block profile data correct? Or perhaps I need to use different options to "go tool"? Any help is appreciated.</p>
  
  <p>Thanks,
  Raghu</p>