package profile

Import Path
	internal/profile (on golang.org and go.dev)

Dependency Relation
	imports 13 packages, and imported by one package

Involved Source Files
	    encode.go
	    filter.go
	    legacy_profile.go
	    merge.go
	d-> profile.go
	    proto.go
	    prune.go

Exported Type Names

type Demangler (func) Demangler maps symbol names to a human-readable form. This may include C++ demangling and additional simplification. Names that are not demangled may be missing from the resulting map. func (*Profile).Demangle(d Demangler) error
type Function (struct) Function corresponds to Profile.Function Filename string ID uint64 Name string StartLine int64 SystemName string
type Label (struct) Label corresponds to Profile.Label
type Line (struct) Line corresponds to Profile.Line Function *Function Line int64
type Location (struct) Location corresponds to Profile.Location Address uint64 ID uint64 IsFolded bool Line []Line Mapping *Mapping
type Mapping (struct) Mapping corresponds to Profile.Mapping BuildID string File string HasFilenames bool HasFunctions bool HasInlineFrames bool HasLineNumbers bool ID uint64 Limit uint64 Offset uint64 Start uint64
type Profile (struct) Profile is an in-memory representation of profile.proto. Comments []string DefaultSampleType string DropFrames string DurationNanos int64 Function []*Function KeepFrames string Location []*Location Mapping []*Mapping Period int64 PeriodType *ValueType Sample []*Sample SampleType []*ValueType TimeNanos int64 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. 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 Compatible determines if two profiles can be compared/merged. returns nil if the profiles are compatible; otherwise an error with details on the incompatibility. Copy makes a fully independent copy of a profile. 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. Empty reports whether the profile contains no samples. FilterSamplesByName filters the samples in a profile and only keeps samples where at least one frame matches focus but none match ignore. Returns true is the corresponding regexp matched at least one sample. FilterSamplesByTag removes all samples from the profile, except those that match focus and do not match the ignore regular expression. HasFileLines determines if all locations in this profile have symbolized file and line number information. HasFunctions determines if all locations in this profile have symbolized function information. 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. Normalize normalizes the source profile by multiplying each value in profile by the ratio of the sum of the base profile's values of that sample type to the sum of the source profile's value of that sample type. ParseMemoryMap parses a memory map in the format of /proc/self/maps, and overrides the mappings in the current profile. It renumbers the samples and locations in the profile correspondingly. Prune removes all nodes beneath a node matching dropRx, and not matching keepRx. If the root node of a Sample matches, the sample will have an empty stack. RemoveUninteresting prunes and elides profiles using built-in tables of uninteresting function names. Scale multiplies all sample values in a profile by a constant. ScaleN multiplies each sample values in a sample by a different amount. Print dumps a text representation of a profile. Intended mainly for debugging purposes. Write writes the profile as a gzip-compressed marshaled protobuf. *T : expvar.Var *T : fmt.Stringer func Merge(srcs []*Profile) (*Profile, error) func Parse(r io.Reader) (*Profile, error) func ParseTracebacks(b []byte) (*Profile, error) func (*Profile).Copy() *Profile func Merge(srcs []*Profile) (*Profile, error) func (*Profile).Compatible(pb *Profile) error func (*Profile).Merge(pb *Profile, r float64) error func (*Profile).Normalize(pb *Profile) error
type Sample (struct) Sample corresponds to Profile.Sample Label map[string][]string Location []*Location NumLabel map[string][]int64 NumUnit map[string][]string Value []int64
type TagMatch (func) TagMatch selects tags for filtering func (*Profile).FilterSamplesByTag(focus, ignore TagMatch) (fm, im bool)
type ValueType (struct) ValueType corresponds to Profile.ValueType // cpu, wall, inuse_space, etc // seconds, nanoseconds, bytes, etc
Exported Values
var LegacyHeapAllocated bool LegacyHeapAllocated instructs the heapz parsers to use the allocated memory stats instead of the default in-use memory. Note that tcmalloc doesn't provide all allocated memory, only in-use stats.
func Merge(srcs []*Profile) (*Profile, error) Merge merges all the profiles in profs into a single Profile. Returns a new profile independent of the input profiles. The merged profile is compacted to eliminate unused samples, locations, functions and mappings. Profiles must have identical profile sample and period types or the merge will fail. profile.Period of the resulting profile will be the maximum of all profiles, and profile.TimeNanos will be the earliest nonzero one.
func Parse(r io.Reader) (*Profile, error) Parse parses a profile and checks for its validity. The input may be a gzip-compressed encoded protobuf or one of many legacy profile formats which may be unsupported in the future.
func ParseTracebacks(b []byte) (*Profile, error) ParseTracebacks parses a set of tracebacks and returns a newly populated profile. It will accept any text file and generate a Profile out of it with any hex addresses it can identify, including a process map if it can recognize one. Each sample will include a tag "source" with the addresses recognized in string format.