github.com/grafana/pyroscope@v1.18.0/pkg/og/structs/flamebearer/convert/convert_bench_test.go (about)

     1  package convert
     2  
     3  import (
     4  	"io"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func BenchmarkPprofToProfile(b *testing.B) {
    12  	f, err := os.Open("./testdata/cpu-unknown.pb.gz")
    13  	require.NoError(b, err)
    14  	defer f.Close()
    15  	data, err := io.ReadAll(f)
    16  	require.NoError(b, err)
    17  
    18  	b.ResetTimer()
    19  	for i := 0; i < b.N; i++ {
    20  		PprofToProfile(data, "test", Limits{MaxNodes: 16384})
    21  	}
    22  	b.StopTimer()
    23  }