]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.17: mention block profile bias fix
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Thu, 3 Jun 2021 13:33:08 +0000 (15:33 +0200)
committerHeschi Kreinick <heschi@google.com>
Tue, 8 Jun 2021 20:19:02 +0000 (20:19 +0000)
Change-Id: I76fd872b2d74704396f0683ffa9cec40b7027247
Reviewed-on: https://go-review.googlesource.com/c/go/+/324471
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

doc/go1.17.html
src/runtime/pprof/pprof_test.go

index 42f3631b9233e3f06c951080f2579d5154b80c50..1701508ea9aa0b784f365c91166deff41cbd56ed 100644 (file)
@@ -725,6 +725,16 @@ Do not send CLs removing the interior tags from such phrases.
   </dd>
 </dl><!-- runtime/metrics -->
 
+
+<dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof">runtime/pprof</a></dt>
+  <dd>
+    <p><!-- CL 299991 -->
+      Block profiles are no longer biased to favor infrequent long events over
+      frequent short events.
+    </p>
+  </dd>
+</dl><!-- runtime/pprof -->
+
 <dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
   <dd>
     <p><!-- CL 170079 -->
index 7cbb4fc7ae4e41ea7fdac596254ee206ee0807a6..e139ee787d6b0742d7340d4347ea369c3e7af676 100644 (file)
@@ -106,6 +106,28 @@ func TestCPUProfileMultithreaded(t *testing.T) {
        })
 }
 
+func TestCPUProfileThreadBias(t *testing.T) {
+       cpuHogA := func(dur time.Duration) {
+               cpuHogger(cpuHog1, &salt2, dur)
+       }
+
+       defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2))
+       prof := testCPUProfile(t, stackContains, []string{"runtime/pprof.cpuHog1", "runtime/pprof.cpuHog2"}, avoidFunctions(), func(dur time.Duration) {
+               //c := make(chan int)
+               //go func() {
+               //cpuHogger(cpuHog1, &salt1, dur)
+               //c <- 1
+               //}()
+               cpuHogA(dur)
+               //<-c
+       })
+       fmt.Printf("%#v\n", prof)
+}
+
+func cpuHogA(dur time.Duration) {
+       cpuHogger(cpuHog1, &salt2, dur)
+}
+
 // containsInlinedCall reports whether the function body for the function f is
 // known to contain an inlined function call within the first maxBytes bytes.
 func containsInlinedCall(f interface{}, maxBytes int) bool {