(b *testing.B)
| 777 | } |
| 778 | |
| 779 | func BenchmarkAllocations(b *testing.B) { |
| 780 | kms.Unittest = true |
| 781 | utils.RemoveAll(testStorePath + "*") |
| 782 | //kms.ResetBucket() |
| 783 | |
| 784 | x, _ := InitConsistent(testStorePath, new(KMSStorage), false) |
| 785 | defer utils.RemoveAll(testStorePath + "*") |
| 786 | x.Add(NewNodeFromString("stays")) |
| 787 | b.ResetTimer() |
| 788 | allocSize := allocBytes(func() { |
| 789 | for i := 0; i < b.N; i++ { |
| 790 | x.Add(NewNodeFromString("Foo")) |
| 791 | x.Remove(NodeID("Foo")) |
| 792 | } |
| 793 | }) |
| 794 | b.Logf("%d: Allocated %d bytes (%.2fx)", b.N, allocSize, float64(allocSize)/float64(b.N)) |
| 795 | } |
| 796 | |
| 797 | func BenchmarkMalloc(b *testing.B) { |
| 798 | kms.Unittest = true |
nothing calls this directly
no test coverage detected