Hello.
Is there a way to determine current parallelism inside a BenchmarkXX
function?
The problem.
I need to run some tests using P connections with P parallelism.
Using `-cpu=1,2,4,etc` flag I can set the P. But can't get it inside
my benchmark funciton.
Using `b.SetParallelism(P)` I can only set `P*GOMAXPROCS`. Seems, I need
`-cpu=1` and then `b.SetParallelism(P)` to achieve the target.
Is there another way? The `-cpu=1,2,4` looks good. But I can't prepare
before tests, because I don't know the P.
My benchmark (in short)
```go
func Benchamark(b *testing.B) {
// 1. create P connections
var conns = create(P)
b.ResetTimer()
b.SetParallelism(P)
b.RunParallel(/* use the conns */)
}
```
Regards.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/981b31f7-1f4c-4814-96cb-9ac50dd2f0een%40googlegroups.com.