• Than McIntosh's avatar
    runtime/pprof: harden CPU profile test against smart backend · 83a1a2ba
    Than McIntosh authored
    A couple of the CPU profiling testpoints make calls to helper
    functions (cpuHog1, for example) where the computed value is always
    thrown away by the caller without being used. A smart compiler back
    end (in this case LLVM) can detect this fact and delete the contents
    of the called function, which can cause tests to fail. Harden the test
    slighly by passing in a value read from a global and insuring that the
    caller stores the value back to a global; this prevents any optimizer
    mischief.
    
    Change-Id: Icbd6e3e32ff299c68a6397dc1404a52b21eaeaab
    Reviewed-on: https://go-review.googlesource.com/76230
    Run-TryBot: Than McIntosh <thanm@google.com>
    Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
    83a1a2ba
pprof_test.go 21.8 KB