You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: proto_test.go
    path of file: ./repos/gccrs/libgo/go/runtime/pprof
    
    the code of the file until where you have to start completion: // Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package pprof

import (
	"bytes"
	"encoding/json"
	"fmt"
	"internal/abi"
	"internal/profile"
	"internal/testenv"
	"os"
	"os/exec"
	"reflect"
	"runtime"
	"strings"
	"testing"
	"unsafe"
)

// translateCPUProfile parses binary CPU profiling stack trace data
// generated by runtime.CPUProfile() into a profile struct.
// This is only used for testing. Real conversions stream the
// data into the profileBuilder as it becomes available.
//
// count is the number of records in data.
func translateCPUProfile(data []uint64, count int) (*profile.Profile, error) {
	var buf bytes.Buffer
	b := newProfileBuilder(&buf)
	tags := make([]unsafe.Pointer, count)
	if err := b.addCPUData(data, tags); err != nil {
		return nil, err
	}
	b.build()
	return profile.Parse(&buf)
}

// fmtJSON returns a pretty-printed JSON form for x.
// It works reas
    
func checkProfile(t *testing.T, p *profile.Profile, period int64, periodType *profile.ValueType, sampleType []*profile.ValueType, samples []*profile.Sample, defaultSampleType string) {
	t.Helper()

	if p.Period != period {
		t.Errorf("p.Period = %d, want %d", p.Period, period)
	}
	if !reflect.DeepEqual(p.PeriodType, periodType) {
		t.Errorf("p.PeriodType = %v\nwant = %v", fmtJSON(p.PeriodType), fmtJSON(periodType))
	}
	if !reflect.DeepEqual(p.SampleType, sampleType) {
		t.Errorf("p.SampleType = %v\nwant = %v", fmtJSON(p.SampleType), fmtJSON(sampleType))
	}
	if defaultSampleType != p.DefaultSampleType {
		t.Errorf("p.DefaultSampleType = %v\nwant = %v", p.DefaultSampleType, defaultSampleType)
	}
	// Clear line info since it is not in the expected samples.
	// If we used f1 and f2 above, then the samples will have line info.
	for _, s := range p.Sample {
		for _, l := range s.Location {
			l.Line = nil
		}
	}
	if fmtJSON(p.Sample) != fmtJSON(samples) { // ignore unexported fields
		if len(p.Sample) == len(samples) {
			for i := range p.Sample {
				if !reflect.DeepEqual(p.Sample[i], samples[i]) {
					t.Errorf("sample %d = %v\nwant = %v\n", i, fmtJSON(p.Sample[i]), fmtJSON(samples[i]))
				}
			}
			if t.Failed() {
				t.FailNow()
			}
		}
		t.Fatalf("p.Sample = %v\nwant = %v", fmtJSON(p.Sample), fmtJSON(samples))
	}
}