type Profile … type ValueType … type Sample … type Label … type Mapping … type Location … type Line … type Function … // Parse parses a profile and checks for its validity. The input must be an // encoded pprof protobuf, which may optionally be gzip-compressed. func Parse(r io.Reader) (*Profile, error) { … } var errMalformed … var ErrNoData … func parseUncompressed(data []byte) (*Profile, error) { … } // Write writes the profile as a gzip-compressed marshaled protobuf. func (p *Profile) Write(w io.Writer) error { … } // CheckValid tests whether the profile is valid. Checks include, but are // not limited to: // - len(Profile.Sample[n].value) == len(Profile.value_unit) // - Sample.id has a corresponding Profile.Location func (p *Profile) CheckValid() error { … } // Aggregate merges the locations in the profile into equivalence // classes preserving the request attributes. It also updates the // samples to point to the merged locations. func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address bool) error { … } // Print dumps a text representation of a profile. Intended mainly // for debugging purposes. func (p *Profile) String() string { … } // Merge adds profile p adjusted by ratio r into profile p. Profiles // must be compatible (same Type and SampleType). // TODO(rsilvera): consider normalizing the profiles based on the // total samples collected. func (p *Profile) Merge(pb *Profile, r float64) error { … } // Compatible determines if two profiles can be compared/merged. // returns nil if the profiles are compatible; otherwise an error with // details on the incompatibility. func (p *Profile) Compatible(pb *Profile) error { … } // HasFunctions determines if all locations in this profile have // symbolized function information. func (p *Profile) HasFunctions() bool { … } // HasFileLines determines if all locations in this profile have // symbolized file and line number information. func (p *Profile) HasFileLines() bool { … } func compatibleValueTypes(v1, v2 *ValueType) bool { … } // Copy makes a fully independent copy of a profile. func (p *Profile) Copy() *Profile { … } type Demangler … // Demangle attempts to demangle and optionally simplify any function // names referenced in the profile. It works on a best-effort basis: // it will silently preserve the original names in case of any errors. func (p *Profile) Demangle(d Demangler) error { … } // Empty reports whether the profile contains no samples. func (p *Profile) Empty() bool { … } // Scale multiplies all sample values in a profile by a constant. func (p *Profile) Scale(ratio float64) { … } // ScaleN multiplies each sample values in a sample by a different amount. func (p *Profile) ScaleN(ratios []float64) error { … }