File tree 1 file changed +10
-10
lines changed
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -231,19 +231,19 @@ func TestWritePartition(t *testing.T) {
231
231
func BenchmarkPartitionWriter_WriteProfileSymbols (b * testing.B ) {
232
232
b .ReportAllocs ()
233
233
234
+ p , err := pprof .OpenFile ("testdata/profile.pb.gz" )
235
+ require .NoError (b , err )
236
+ p .Normalize ()
237
+ cfg := DefaultConfig ().WithDirectory (b .TempDir ())
238
+
239
+ db := NewSymDB (cfg )
240
+
234
241
for i := 0 ; i < b .N ; i ++ {
235
- // If opening the profile or creating the config, db, or
236
- // partition writer outside the loop it always results in a
237
- // panic.
238
242
b .StopTimer ()
239
- p , err := pprof .OpenFile ("testdata/profile.pb.gz" )
240
- require .NoError (b , err )
241
- p .Normalize ()
242
- cfg := DefaultConfig ().WithDirectory (b .TempDir ())
243
- db := NewSymDB (cfg )
244
- pw := db .PartitionWriter (0 )
243
+ newP := p .CloneVT ()
244
+ pw := db .PartitionWriter (uint64 (i ))
245
245
b .StartTimer ()
246
246
247
- pw .WriteProfileSymbols (p . Profile )
247
+ pw .WriteProfileSymbols (newP )
248
248
}
249
249
}
You can’t perform that action at this time.
0 commit comments