diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2021-01-26 11:39:48 -0800 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@tailscale.com> | 2021-01-26 11:40:24 -0800 |
commit | e6ec3852a93c95ac55662cc34a25b71a84c6e7b0 (patch) | |
tree | 3b3797e8f61533e352646b0dda73af41e5c80777 /device/device_test.go | |
parent | 23b2790aa06270485f3d951132609afaeb888c28 (diff) |
device: add benchmark for UAPI Device.IpcGetOperation
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/device_test.go')
-rw-r--r-- | device/device_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/device/device_test.go b/device/device_test.go index 62dee56..caae2b8 100644 --- a/device/device_test.go +++ b/device/device_test.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "net" "sync" "sync/atomic" @@ -340,3 +341,14 @@ func BenchmarkThroughput(b *testing.B) { b.ReportMetric(float64(elapsed)/float64(b.N), "ns/op") 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) + } +} |