// suffix X) and populates the corresponding exported fields.
// The unexported fields are cleared up to facilitate testing.
func (p *Profile) postDecode() error {
+ if p.Empty() {
+ return nil
+ }
var err error
mappings := make(map[uint64]*Mapping)
p.commentX = nil
p.DefaultSampleType, err = getString(p.stringTable, &p.defaultSampleTypeX, err)
p.stringTable = nil
- return nil
+ return err
}
func (p *ValueType) decoder() []decoder {
}
// Expected PeriodType and SampleType.
- periodType := &profile.ValueType{Type: "cpu", Unit: "nanoseconds"}
- sampleType := []*profile.ValueType{
- {Type: "samples", Unit: "count"},
- {Type: "cpu", Unit: "nanoseconds"},
- }
+ sampleType := []*profile.ValueType{{}, {}}
- checkProfile(t, p, 2000*1000, periodType, sampleType, nil, "")
+ checkProfile(t, p, 2000*1000, nil, sampleType, nil, "")
}
func f1() { f1() }