$38 GRAYBYTE WORDPRESS FILE MANAGER $71

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/golang/src/cmd/vendor/github.com/google/pprof/internal/driver/

HOME
Current File : /usr/lib/golang/src/cmd/vendor/github.com/google/pprof/internal/driver//tagroot.go
package driver

import (
	"strings"

	"github.com/google/pprof/internal/measurement"
	"github.com/google/pprof/profile"
)

// addLabelNodes adds pseudo stack frames "label:value" to each Sample with
// labels matching the supplied keys.
//
// rootKeys adds frames at the root of the callgraph (first key becomes new root).
// leafKeys adds frames at the leaf of the callgraph (last key becomes new leaf).
//
// Returns whether there were matches found for the label keys.
func addLabelNodes(p *profile.Profile, rootKeys, leafKeys []string, outputUnit string) (rootm, leafm bool) {
	// Find where to insert the new locations and functions at the end of
	// their ID spaces.
	var maxLocID uint64
	var maxFunctionID uint64
	for _, loc := range p.Location {
		if loc.ID > maxLocID {
			maxLocID = loc.ID
		}
	}
	for _, f := range p.Function {
		if f.ID > maxFunctionID {
			maxFunctionID = f.ID
		}
	}
	nextLocID := maxLocID + 1
	nextFuncID := maxFunctionID + 1

	// Intern the new locations and functions we are generating.
	type locKey struct {
		functionName, fileName string
	}
	locs := map[locKey]*profile.Location{}

	internLoc := func(locKey locKey) *profile.Location {
		loc, found := locs[locKey]
		if found {
			return loc
		}

		function := &profile.Function{
			ID:       nextFuncID,
			Name:     locKey.functionName,
			Filename: locKey.fileName,
		}
		nextFuncID++
		p.Function = append(p.Function, function)

		loc = &profile.Location{
			ID: nextLocID,
			Line: []profile.Line{
				{
					Function: function,
				},
			},
		}
		nextLocID++
		p.Location = append(p.Location, loc)
		locs[locKey] = loc
		return loc
	}

	makeLabelLocs := func(s *profile.Sample, keys []string) ([]*profile.Location, bool) {
		var locs []*profile.Location
		var match bool
		for i := range keys {
			// Loop backwards, ensuring the first tag is closest to the root,
			// and the last tag is closest to the leaves.
			k := keys[len(keys)-1-i]
			values := formatLabelValues(s, k, outputUnit)
			if len(values) > 0 {
				match = true
			}
			locKey := locKey{
				functionName: strings.Join(values, ","),
				fileName:     k,
			}
			loc := internLoc(locKey)
			locs = append(locs, loc)
		}
		return locs, match
	}

	for _, s := range p.Sample {
		rootsToAdd, sampleMatchedRoot := makeLabelLocs(s, rootKeys)
		if sampleMatchedRoot {
			rootm = true
		}
		leavesToAdd, sampleMatchedLeaf := makeLabelLocs(s, leafKeys)
		if sampleMatchedLeaf {
			leafm = true
		}

		if len(leavesToAdd)+len(rootsToAdd) == 0 {
			continue
		}

		var newLocs []*profile.Location
		newLocs = append(newLocs, leavesToAdd...)
		newLocs = append(newLocs, s.Location...)
		newLocs = append(newLocs, rootsToAdd...)
		s.Location = newLocs
	}
	return
}

// formatLabelValues returns all the string and numeric labels in Sample, with
// the numeric labels formatted according to outputUnit.
func formatLabelValues(s *profile.Sample, k string, outputUnit string) []string {
	var values []string
	values = append(values, s.Label[k]...)
	numLabels := s.NumLabel[k]
	numUnits := s.NumUnit[k]
	if len(numLabels) != len(numUnits) && len(numUnits) != 0 {
		return values
	}
	for i, numLabel := range numLabels {
		var value string
		if len(numUnits) != 0 {
			value = measurement.ScaledLabel(numLabel, numUnits[i], outputUnit)
		} else {
			value = measurement.ScaledLabel(numLabel, "", "")
		}
		values = append(values, value)
	}
	return values
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Dec 2025 6.06 PM
root / root
0755
html
--
16 Dec 2025 9.30 PM
root / root
0755
cli.go
12.082 KB
4 Dec 2025 6.06 PM
root / root
0644
commands.go
18.454 KB
4 Dec 2025 6.06 PM
root / root
0644
config.go
10.486 KB
4 Dec 2025 6.06 PM
root / root
0644
driver.go
10.823 KB
4 Dec 2025 6.06 PM
root / root
0644
driver_focus.go
6.422 KB
4 Dec 2025 6.06 PM
root / root
0644
fetch.go
18.957 KB
4 Dec 2025 6.06 PM
root / root
0644
flags.go
1.907 KB
4 Dec 2025 6.06 PM
root / root
0644
interactive.go
10.641 KB
4 Dec 2025 6.06 PM
root / root
0644
options.go
2.264 KB
4 Dec 2025 6.06 PM
root / root
0644
settings.go
4.167 KB
4 Dec 2025 6.06 PM
root / root
0644
stacks.go
1.669 KB
4 Dec 2025 6.06 PM
root / root
0644
svg.go
2.204 KB
4 Dec 2025 6.06 PM
root / root
0644
tagroot.go
3.321 KB
4 Dec 2025 6.06 PM
root / root
0644
tempfile.go
1.72 KB
4 Dec 2025 6.06 PM
root / root
0644
webhtml.go
2.553 KB
4 Dec 2025 6.06 PM
root / root
0644
webui.go
14.069 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF