device: add benchmark for UAPI Device.IpcGetOperation
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
23b2790aa0
commit
e6ec3852a9
|
@ -10,6 +10,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
@ -340,3 +341,14 @@ func BenchmarkThroughput(b *testing.B) {
|
||||||
b.ReportMetric(float64(elapsed)/float64(b.N), "ns/op")
|
b.ReportMetric(float64(elapsed)/float64(b.N), "ns/op")
|
||||||
b.ReportMetric(1-float64(b.N)/float64(sent), "packet-loss")
|
b.ReportMetric(1-float64(b.N)/float64(sent), "packet-loss")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkUAPIGet(b *testing.B) {
|
||||||
|
pair := genTestPair(b)
|
||||||
|
pair.Send(b, Ping, nil)
|
||||||
|
pair.Send(b, Pong, nil)
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.ResetTimer()
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
pair[0].dev.IpcGetOperation(ioutil.Discard)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue