Package-Level Type Names (total 20, in which 10 are exported)
/* sort exporteds by: | */
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
Label corresponds to Profile.Label
keyXint64
// Integer value for this label
Exactly one of the two following values must be set
( Label) decoder() []decoder( Label) encode(b *buffer)
Label : message
Profile is an in-memory representation of profile.proto.
Comments[]stringDefaultSampleTypestringDropFramesstringDurationNanosint64Function[]*FunctionKeepFramesstringLocation[]*LocationMapping[]*MappingPeriodint64PeriodType*ValueTypeSample[]*SampleSampleType[]*ValueTypeTimeNanosint64commentX[]int64defaultSampleTypeXint64dropFramesXint64keepFramesXint64stringTable[]string
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.
(*Profile) addLegacyFrameInfo()
compatible determines if two profiles can be compared/merged.
returns nil if the profiles are compatible; otherwise an error with
details on the incompatibility.
(*Profile) decoder() []decoder(*Profile) encode(b *buffer)
postDecode takes the unexported fields populated by decode (with
suffix X) and populates the corresponding exported fields.
The unexported fields are cleared up to facilitate testing.
preEncode populates the unexported fields to be used by encode
(with suffix X) from the corresponding exported fields. The
exported fields are cleared up to facilitate testing.
(*Profile) remapFunctionIDs()
remapLocationIDs ensures there is a location for each address
referenced by a sample, and remaps the samples to point to the new
location ids.
remapMappingIDs matches location addresses with existing mappings
and updates them appropriately. This is O(N*M), if this ever shows
up as a bottleneck, evaluate sorting the mappings and doing a
binary search, which would make it O(N*log(M)).
setMain scans Mapping entries and guesses which entry is main
because legacy profiles don't obey the convention of putting main
first.
*Profile : expvar.Var
*Profile : fmt.Stringer
*Profile : message
*Profile : context.stringer
*Profile : github.com/aws/smithy-go/middleware.stringer
*Profile : runtime.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 combineHeaders(srcs []*Profile) (*Profile, error)
func cpuProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte)) (*Profile, error)
func parseContention(b []byte) (*Profile, error)
func parseCppContention(r *bytes.Buffer) (*Profile, error)
func parseCPU(b []byte) (*Profile, error)
func parseGoCount(b []byte) (*Profile, error)
func parseHeap(b []byte) (p *Profile, err error)
func parseLegacy(data []byte) (*Profile, error)
func parseThread(b []byte) (*Profile, error)
func parseUncompressed(data []byte) (*Profile, error)
func net/http/pprof.collectProfile(p *pprof.Profile) (*Profile, error)
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
func addTracebackSample(l []*Location, s []string, p *Profile)
func combineHeaders(srcs []*Profile) (*Profile, error)
func isProfileType(p *Profile, t []string) bool
func parseAdditionalSections(l string, b *bytes.Buffer, p *Profile) (err error)
func parseCPUSamples(b []byte, parse func(b []byte) (uint64, []byte), adjust bool, p *Profile) ([]byte, map[uint64]*Location, error)
func (*Profile).compatible(pb *Profile) error
Package-Level Functions (total 66, in which 3 are exported)
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.
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.
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.
cpuProfile returns a new Profile from C++ profilez data.
b is the profile bytes after the header, period is the profiling
period, and parse is a function to parse 8-byte chunks from the
profile in its native endianness.
equalValueType returns true if the two value types are semantically
equal. It ignores the internal fields used during encode/decode.
extractHexAddresses extracts hex numbers from a string and returns
them, together with their numeric value, in a slice.
focusedAndNotIgnored looks up a slice of ids against a map of
focused/ignored locations. The map only contains locations that are
explicitly focused or ignored. Returns whether there is at least
one focused location but no ignored locations.
focusedTag checks a sample against focus and ignore regexps.
Returns whether the focus/ignore regexps match any tags
parseAdditionalSections parses any additional sections in the
profile, ignoring any unrecognized sections.
parseContention parses a mutex or contention profile. There are 2 cases:
"--- contentionz " for legacy C++ profiles (and backwards compatibility)
"--- mutex:" or "--- contention:" for profiles generated by the Go runtime.
This code converts the text output from runtime into a *Profile. (In the future
the runtime might write a serialized Profile directly making this unnecessary.)
parseContentionSample parses a single row from a contention profile
into a new Sample.
parseCppContention parses the output from synchronization_profiling.cc
for backward compatibility, and the compatible (non-debug) block profile
output from the Go runtime.
parseCPU parses a profilez legacy profile and returns a newly
populated Profile.
The general format for profilez samples is a sequence of words in
binary format. The first words are a header with the following data:
1st word -- 0
2nd word -- 3
3rd word -- 0 if a c++ application, 1 if a java application.
4th word -- Sampling period (in microseconds).
5th word -- Padding.
parseCPUSamples parses a collection of profilez samples from a
profile.
profilez samples are a repeated sequence of stack frames of the
form:
1st word -- The number of times this stack was encountered.
2nd word -- The size of the stack (StackSize).
3rd word -- The first address on the stack.
...
StackSize + 2 -- The last address on the stack
The last stack trace is of the form:
1st word -- 0
2nd word -- 1
3rd word -- 0
Addresses from stack traces may point to the next instruction after
each call. Optionally adjust by -1 to land somewhere on the actual
call (except for the leaf, which is not a call).
parseGoCount parses a Go count profile (e.g., threadcreate or
goroutine) and returns a new Profile.
parseHeap parses a heapz legacy or a growthz profile and
returns a newly populated Profile.
parseHeapSample parses a single row from a heap profile into a new Sample.
parseHexAddresses parses hex numbers from a string and returns them
in a slice.
parseThread parses a Threadz profile and returns a new Profile.
parseThreadSample parses a symbolized or unsymbolized stack trace.
Returns the first line after the traceback, the sample (or nil if
it hits a 'same-as-previous' marker) and an error.
scaleHeapSample adjusts the data from a heapz Sample to
account for its probability of appearing in the collected
data. heapz profiles are a sampling of the memory allocations
requests in a program. We estimate the unsampled value by dividing
each collected sample by its probability of appearing in the
profile. heapz v2 profiles rely on a poisson process to determine
which samples to collect, based on the desired average collection
rate R. The probability of a sample of size S to appear in that
profile is 1-exp(-S/R).
Package-Level Variables (total 34, in which 1 are exported)
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.