id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
164,900
hashicorp/golang-lru
simplelru/lru.go
NewLRU
func NewLRU(size int, onEvict EvictCallback) (*LRU, error) { if size <= 0 { return nil, errors.New("Must provide a positive size") } c := &LRU{ size: size, evictList: list.New(), items: make(map[interface{}]*list.Element), onEvict: onEvict, } return c, nil }
go
func NewLRU(size int, onEvict EvictCallback) (*LRU, error) { if size <= 0 { return nil, errors.New("Must provide a positive size") } c := &LRU{ size: size, evictList: list.New(), items: make(map[interface{}]*list.Element), onEvict: onEvict, } return c, nil }
[ "func", "NewLRU", "(", "size", "int", ",", "onEvict", "EvictCallback", ")", "(", "*", "LRU", ",", "error", ")", "{", "if", "size", "<=", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "c", ":=", "&"...
// NewLRU constructs an LRU of the given size
[ "NewLRU", "constructs", "an", "LRU", "of", "the", "given", "size" ]
7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c
https://github.com/hashicorp/golang-lru/blob/7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c/simplelru/lru.go#L26-L37
164,901
hashicorp/golang-lru
simplelru/lru.go
Remove
func (c *LRU) Remove(key interface{}) (present bool) { if ent, ok := c.items[key]; ok { c.removeElement(ent) return true } return false }
go
func (c *LRU) Remove(key interface{}) (present bool) { if ent, ok := c.items[key]; ok { c.removeElement(ent) return true } return false }
[ "func", "(", "c", "*", "LRU", ")", "Remove", "(", "key", "interface", "{", "}", ")", "(", "present", "bool", ")", "{", "if", "ent", ",", "ok", ":=", "c", ".", "items", "[", "key", "]", ";", "ok", "{", "c", ".", "removeElement", "(", "ent", ")...
// Remove removes the provided key from the cache, returning if the // key was contained.
[ "Remove", "removes", "the", "provided", "key", "from", "the", "cache", "returning", "if", "the", "key", "was", "contained", "." ]
7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c
https://github.com/hashicorp/golang-lru/blob/7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c/simplelru/lru.go#L100-L106
164,902
hashicorp/golang-lru
simplelru/lru.go
removeOldest
func (c *LRU) removeOldest() { ent := c.evictList.Back() if ent != nil { c.removeElement(ent) } }
go
func (c *LRU) removeOldest() { ent := c.evictList.Back() if ent != nil { c.removeElement(ent) } }
[ "func", "(", "c", "*", "LRU", ")", "removeOldest", "(", ")", "{", "ent", ":=", "c", ".", "evictList", ".", "Back", "(", ")", "\n", "if", "ent", "!=", "nil", "{", "c", ".", "removeElement", "(", "ent", ")", "\n", "}", "\n", "}" ]
// removeOldest removes the oldest item from the cache.
[ "removeOldest", "removes", "the", "oldest", "item", "from", "the", "cache", "." ]
7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c
https://github.com/hashicorp/golang-lru/blob/7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c/simplelru/lru.go#L146-L151
164,903
hashicorp/golang-lru
lru.go
NewWithEvict
func NewWithEvict(size int, onEvicted func(key interface{}, value interface{})) (*Cache, error) { lru, err := simplelru.NewLRU(size, simplelru.EvictCallback(onEvicted)) if err != nil { return nil, err } c := &Cache{ lru: lru, } return c, nil }
go
func NewWithEvict(size int, onEvicted func(key interface{}, value interface{})) (*Cache, error) { lru, err := simplelru.NewLRU(size, simplelru.EvictCallback(onEvicted)) if err != nil { return nil, err } c := &Cache{ lru: lru, } return c, nil }
[ "func", "NewWithEvict", "(", "size", "int", ",", "onEvicted", "func", "(", "key", "interface", "{", "}", ",", "value", "interface", "{", "}", ")", ")", "(", "*", "Cache", ",", "error", ")", "{", "lru", ",", "err", ":=", "simplelru", ".", "NewLRU", ...
// NewWithEvict constructs a fixed size cache with the given eviction // callback.
[ "NewWithEvict", "constructs", "a", "fixed", "size", "cache", "with", "the", "given", "eviction", "callback", "." ]
7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c
https://github.com/hashicorp/golang-lru/blob/7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c/lru.go#L22-L31
164,904
hashicorp/golang-lru
lru.go
ContainsOrAdd
func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) { c.lock.Lock() defer c.lock.Unlock() if c.lru.Contains(key) { return true, false } evicted = c.lru.Add(key, value) return false, evicted }
go
func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) { c.lock.Lock() defer c.lock.Unlock() if c.lru.Contains(key) { return true, false } evicted = c.lru.Add(key, value) return false, evicted }
[ "func", "(", "c", "*", "Cache", ")", "ContainsOrAdd", "(", "key", ",", "value", "interface", "{", "}", ")", "(", "ok", ",", "evicted", "bool", ")", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(...
// ContainsOrAdd checks if a key is in the cache without updating the // recent-ness or deleting it for being stale, and if not, adds the value. // Returns whether found and whether an eviction occurred.
[ "ContainsOrAdd", "checks", "if", "a", "key", "is", "in", "the", "cache", "without", "updating", "the", "recent", "-", "ness", "or", "deleting", "it", "for", "being", "stale", "and", "if", "not", "adds", "the", "value", ".", "Returns", "whether", "found", ...
7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c
https://github.com/hashicorp/golang-lru/blob/7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c/lru.go#L77-L86
164,905
hashicorp/golang-lru
lru.go
Keys
func (c *Cache) Keys() []interface{} { c.lock.RLock() keys := c.lru.Keys() c.lock.RUnlock() return keys }
go
func (c *Cache) Keys() []interface{} { c.lock.RLock() keys := c.lru.Keys() c.lock.RUnlock() return keys }
[ "func", "(", "c", "*", "Cache", ")", "Keys", "(", ")", "[", "]", "interface", "{", "}", "{", "c", ".", "lock", ".", "RLock", "(", ")", "\n", "keys", ":=", "c", ".", "lru", ".", "Keys", "(", ")", "\n", "c", ".", "lock", ".", "RUnlock", "(", ...
// Keys returns a slice of the keys in the cache, from oldest to newest.
[ "Keys", "returns", "a", "slice", "of", "the", "keys", "in", "the", "cache", "from", "oldest", "to", "newest", "." ]
7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c
https://github.com/hashicorp/golang-lru/blob/7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c/lru.go#L103-L108
164,906
google/pprof
internal/driver/webui.go
makeReport
func (ui *webInterface) makeReport(w http.ResponseWriter, req *http.Request, cmd []string, vars ...string) (*report.Report, []string) { v := varsFromURL(req.URL) for i := 0; i+1 < len(vars); i += 2 { v[vars[i]].value = vars[i+1] } catcher := &errorCatcher{UI: ui.options.UI} options := *ui.options options.UI = ...
go
func (ui *webInterface) makeReport(w http.ResponseWriter, req *http.Request, cmd []string, vars ...string) (*report.Report, []string) { v := varsFromURL(req.URL) for i := 0; i+1 < len(vars); i += 2 { v[vars[i]].value = vars[i+1] } catcher := &errorCatcher{UI: ui.options.UI} options := *ui.options options.UI = ...
[ "func", "(", "ui", "*", "webInterface", ")", "makeReport", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "cmd", "[", "]", "string", ",", "vars", "...", "string", ")", "(", "*", "report", ".", "Report", ",", ...
// makeReport generates a report for the specified command.
[ "makeReport", "generates", "a", "report", "for", "the", "specified", "command", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/webui.go#L255-L271
164,907
google/pprof
internal/driver/webui.go
render
func (ui *webInterface) render(w http.ResponseWriter, tmpl string, rpt *report.Report, errList, legend []string, data webArgs) { file := getFromLegend(legend, "File: ", "unknown") profile := getFromLegend(legend, "Type: ", "unknown") data.Title = file + " " + profile data.Errors = errList data.Total = rpt.Total()...
go
func (ui *webInterface) render(w http.ResponseWriter, tmpl string, rpt *report.Report, errList, legend []string, data webArgs) { file := getFromLegend(legend, "File: ", "unknown") profile := getFromLegend(legend, "Type: ", "unknown") data.Title = file + " " + profile data.Errors = errList data.Total = rpt.Total()...
[ "func", "(", "ui", "*", "webInterface", ")", "render", "(", "w", "http", ".", "ResponseWriter", ",", "tmpl", "string", ",", "rpt", "*", "report", ".", "Report", ",", "errList", ",", "legend", "[", "]", "string", ",", "data", "webArgs", ")", "{", "fil...
// render generates html using the named template based on the contents of data.
[ "render", "generates", "html", "using", "the", "named", "template", "based", "on", "the", "contents", "of", "data", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/webui.go#L274-L292
164,908
google/pprof
internal/driver/webui.go
dot
func (ui *webInterface) dot(w http.ResponseWriter, req *http.Request) { rpt, errList := ui.makeReport(w, req, []string{"svg"}) if rpt == nil { return // error already reported } // Generate dot graph. g, config := report.GetDOT(rpt) legend := config.Labels config.Labels = nil dot := &bytes.Buffer{} graph.Co...
go
func (ui *webInterface) dot(w http.ResponseWriter, req *http.Request) { rpt, errList := ui.makeReport(w, req, []string{"svg"}) if rpt == nil { return // error already reported } // Generate dot graph. g, config := report.GetDOT(rpt) legend := config.Labels config.Labels = nil dot := &bytes.Buffer{} graph.Co...
[ "func", "(", "ui", "*", "webInterface", ")", "dot", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "rpt", ",", "errList", ":=", "ui", ".", "makeReport", "(", "w", ",", "req", ",", "[", "]", "string", "...
// dot generates a web page containing an svg diagram.
[ "dot", "generates", "a", "web", "page", "containing", "an", "svg", "diagram", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/webui.go#L295-L327
164,909
google/pprof
internal/driver/webui.go
disasm
func (ui *webInterface) disasm(w http.ResponseWriter, req *http.Request) { args := []string{"disasm", req.URL.Query().Get("f")} rpt, errList := ui.makeReport(w, req, args) if rpt == nil { return // error already reported } out := &bytes.Buffer{} if err := report.PrintAssembly(out, rpt, ui.options.Obj, maxEntri...
go
func (ui *webInterface) disasm(w http.ResponseWriter, req *http.Request) { args := []string{"disasm", req.URL.Query().Get("f")} rpt, errList := ui.makeReport(w, req, args) if rpt == nil { return // error already reported } out := &bytes.Buffer{} if err := report.PrintAssembly(out, rpt, ui.options.Obj, maxEntri...
[ "func", "(", "ui", "*", "webInterface", ")", "disasm", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "req", ".", "URL", ".", "Query", "(", ")", ...
// disasm generates a web page containing disassembly.
[ "disasm", "generates", "a", "web", "page", "containing", "disassembly", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/webui.go#L365-L384
164,910
google/pprof
internal/driver/webui.go
source
func (ui *webInterface) source(w http.ResponseWriter, req *http.Request) { args := []string{"weblist", req.URL.Query().Get("f")} rpt, errList := ui.makeReport(w, req, args) if rpt == nil { return // error already reported } // Generate source listing. var body bytes.Buffer if err := report.PrintWebList(&body,...
go
func (ui *webInterface) source(w http.ResponseWriter, req *http.Request) { args := []string{"weblist", req.URL.Query().Get("f")} rpt, errList := ui.makeReport(w, req, args) if rpt == nil { return // error already reported } // Generate source listing. var body bytes.Buffer if err := report.PrintWebList(&body,...
[ "func", "(", "ui", "*", "webInterface", ")", "source", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "req", ".", "URL", ".", "Query", "(", ")", ...
// source generates a web page containing source code annotated with profile // data.
[ "source", "generates", "a", "web", "page", "containing", "source", "code", "annotated", "with", "profile", "data", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/webui.go#L388-L407
164,911
google/pprof
internal/driver/webui.go
getFromLegend
func getFromLegend(legend []string, param, def string) string { for _, s := range legend { if strings.HasPrefix(s, param) { return s[len(param):] } } return def }
go
func getFromLegend(legend []string, param, def string) string { for _, s := range legend { if strings.HasPrefix(s, param) { return s[len(param):] } } return def }
[ "func", "getFromLegend", "(", "legend", "[", "]", "string", ",", "param", ",", "def", "string", ")", "string", "{", "for", "_", ",", "s", ":=", "range", "legend", "{", "if", "strings", ".", "HasPrefix", "(", "s", ",", "param", ")", "{", "return", "...
// getFromLegend returns the suffix of an entry in legend that starts // with param. It returns def if no such entry is found.
[ "getFromLegend", "returns", "the", "suffix", "of", "an", "entry", "in", "legend", "that", "starts", "with", "param", ".", "It", "returns", "def", "if", "no", "such", "entry", "is", "found", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/webui.go#L432-L439
164,912
google/pprof
pprof.go
Print
func (r *readlineUI) Print(args ...interface{}) { text := fmt.Sprint(args...) if !strings.HasSuffix(text, "\n") { text += "\n" } fmt.Fprint(r.rl.Stderr(), text) }
go
func (r *readlineUI) Print(args ...interface{}) { text := fmt.Sprint(args...) if !strings.HasSuffix(text, "\n") { text += "\n" } fmt.Fprint(r.rl.Stderr(), text) }
[ "func", "(", "r", "*", "readlineUI", ")", "Print", "(", "args", "...", "interface", "{", "}", ")", "{", "text", ":=", "fmt", ".", "Sprint", "(", "args", "...", ")", "\n", "if", "!", "strings", ".", "HasSuffix", "(", "text", ",", "\"", "\\n", "\""...
// Print shows a message to the user. // It is printed over stderr as stdout is reserved for regular output.
[ "Print", "shows", "a", "message", "to", "the", "user", ".", "It", "is", "printed", "over", "stderr", "as", "stdout", "is", "reserved", "for", "regular", "output", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/pprof.go#L65-L71
164,913
google/pprof
pprof.go
PrintErr
func (r *readlineUI) PrintErr(args ...interface{}) { text := fmt.Sprint(args...) if !strings.HasSuffix(text, "\n") { text += "\n" } if readline.IsTerminal(int(syscall.Stderr)) { text = colorize(text) } fmt.Fprint(r.rl.Stderr(), text) }
go
func (r *readlineUI) PrintErr(args ...interface{}) { text := fmt.Sprint(args...) if !strings.HasSuffix(text, "\n") { text += "\n" } if readline.IsTerminal(int(syscall.Stderr)) { text = colorize(text) } fmt.Fprint(r.rl.Stderr(), text) }
[ "func", "(", "r", "*", "readlineUI", ")", "PrintErr", "(", "args", "...", "interface", "{", "}", ")", "{", "text", ":=", "fmt", ".", "Sprint", "(", "args", "...", ")", "\n", "if", "!", "strings", ".", "HasSuffix", "(", "text", ",", "\"", "\\n", "...
// PrintErr shows a message to the user, colored in red for emphasis. // It is printed over stderr as stdout is reserved for regular output.
[ "PrintErr", "shows", "a", "message", "to", "the", "user", "colored", "in", "red", "for", "emphasis", ".", "It", "is", "printed", "over", "stderr", "as", "stdout", "is", "reserved", "for", "regular", "output", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/pprof.go#L75-L84
164,914
google/pprof
pprof.go
colorize
func colorize(msg string) string { var red = 31 var colorEscape = fmt.Sprintf("\033[0;%dm", red) var colorResetEscape = "\033[0m" return colorEscape + msg + colorResetEscape }
go
func colorize(msg string) string { var red = 31 var colorEscape = fmt.Sprintf("\033[0;%dm", red) var colorResetEscape = "\033[0m" return colorEscape + msg + colorResetEscape }
[ "func", "colorize", "(", "msg", "string", ")", "string", "{", "var", "red", "=", "31", "\n", "var", "colorEscape", "=", "fmt", ".", "Sprintf", "(", "\"", "\\033", "\"", ",", "red", ")", "\n", "var", "colorResetEscape", "=", "\"", "\\033", "\"", "\n",...
// colorize the msg using ANSI color escapes.
[ "colorize", "the", "msg", "using", "ANSI", "color", "escapes", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/pprof.go#L87-L92
164,915
google/pprof
internal/graph/dotgraph.go
ComposeDot
func ComposeDot(w io.Writer, g *Graph, a *DotAttributes, c *DotConfig) { builder := &builder{w, a, c} // Begin constructing DOT by adding a title and legend. builder.start() defer builder.finish() builder.addLegend() if len(g.Nodes) == 0 { return } // Preprocess graph to get id map and find max flat. node...
go
func ComposeDot(w io.Writer, g *Graph, a *DotAttributes, c *DotConfig) { builder := &builder{w, a, c} // Begin constructing DOT by adding a title and legend. builder.start() defer builder.finish() builder.addLegend() if len(g.Nodes) == 0 { return } // Preprocess graph to get id map and find max flat. node...
[ "func", "ComposeDot", "(", "w", "io", ".", "Writer", ",", "g", "*", "Graph", ",", "a", "*", "DotAttributes", ",", "c", "*", "DotConfig", ")", "{", "builder", ":=", "&", "builder", "{", "w", ",", "a", ",", "c", "}", "\n\n", "// Begin constructing DOT ...
// ComposeDot creates and writes a in the DOT format to the writer, using // the configurations given.
[ "ComposeDot", "creates", "and", "writes", "a", "in", "the", "DOT", "format", "to", "the", "writer", "using", "the", "configurations", "given", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L57-L98
164,916
google/pprof
internal/graph/dotgraph.go
start
func (b *builder) start() { graphname := "unnamed" if b.config.Title != "" { graphname = b.config.Title } fmt.Fprintln(b, `digraph "`+graphname+`" {`) fmt.Fprintln(b, `node [style=filled fillcolor="#f8f8f8"]`) }
go
func (b *builder) start() { graphname := "unnamed" if b.config.Title != "" { graphname = b.config.Title } fmt.Fprintln(b, `digraph "`+graphname+`" {`) fmt.Fprintln(b, `node [style=filled fillcolor="#f8f8f8"]`) }
[ "func", "(", "b", "*", "builder", ")", "start", "(", ")", "{", "graphname", ":=", "\"", "\"", "\n", "if", "b", ".", "config", ".", "Title", "!=", "\"", "\"", "{", "graphname", "=", "b", ".", "config", ".", "Title", "\n", "}", "\n", "fmt", ".", ...
// start generates a title and initial node in DOT format.
[ "start", "generates", "a", "title", "and", "initial", "node", "in", "DOT", "format", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L108-L115
164,917
google/pprof
internal/graph/dotgraph.go
addLegend
func (b *builder) addLegend() { labels := b.config.Labels if len(labels) == 0 { return } title := labels[0] fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16`, title) fmt.Fprintf(b, ` label="%s\l"`, strings.Join(labels, `\l`)) if b.config.LegendURL != "" { fmt.Fprintf(b, ` URL="%s" target="_bl...
go
func (b *builder) addLegend() { labels := b.config.Labels if len(labels) == 0 { return } title := labels[0] fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16`, title) fmt.Fprintf(b, ` label="%s\l"`, strings.Join(labels, `\l`)) if b.config.LegendURL != "" { fmt.Fprintf(b, ` URL="%s" target="_bl...
[ "func", "(", "b", "*", "builder", ")", "addLegend", "(", ")", "{", "labels", ":=", "b", ".", "config", ".", "Labels", "\n", "if", "len", "(", "labels", ")", "==", "0", "{", "return", "\n", "}", "\n", "title", ":=", "labels", "[", "0", "]", "\n"...
// addLegend generates a legend in DOT format.
[ "addLegend", "generates", "a", "legend", "in", "DOT", "format", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L123-L138
164,918
google/pprof
internal/graph/dotgraph.go
addNode
func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) { flat, cum := node.FlatValue(), node.CumValue() attrs := b.attributes.Nodes[node] // Populate label for node. var label string if attrs != nil && attrs.Formatter != nil { label = attrs.Formatter(&node.Info) } else { label = multilinePrintabl...
go
func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) { flat, cum := node.FlatValue(), node.CumValue() attrs := b.attributes.Nodes[node] // Populate label for node. var label string if attrs != nil && attrs.Formatter != nil { label = attrs.Formatter(&node.Info) } else { label = multilinePrintabl...
[ "func", "(", "b", "*", "builder", ")", "addNode", "(", "node", "*", "Node", ",", "nodeID", "int", ",", "maxFlat", "float64", ")", "{", "flat", ",", "cum", ":=", "node", ".", "FlatValue", "(", ")", ",", "node", ".", "CumValue", "(", ")", "\n", "at...
// addNode generates a graph node in DOT format.
[ "addNode", "generates", "a", "graph", "node", "in", "DOT", "format", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L141-L213
164,919
google/pprof
internal/graph/dotgraph.go
addNodelets
func (b *builder) addNodelets(node *Node, nodeID int) bool { var nodelets string // Populate two Tag slices, one for LabelTags and one for NumericTags. var ts []*Tag lnts := make(map[string][]*Tag) for _, t := range node.LabelTags { ts = append(ts, t) } for l, tm := range node.NumericTags { for _, t := rang...
go
func (b *builder) addNodelets(node *Node, nodeID int) bool { var nodelets string // Populate two Tag slices, one for LabelTags and one for NumericTags. var ts []*Tag lnts := make(map[string][]*Tag) for _, t := range node.LabelTags { ts = append(ts, t) } for l, tm := range node.NumericTags { for _, t := rang...
[ "func", "(", "b", "*", "builder", ")", "addNodelets", "(", "node", "*", "Node", ",", "nodeID", "int", ")", "bool", "{", "var", "nodelets", "string", "\n\n", "// Populate two Tag slices, one for LabelTags and one for NumericTags.", "var", "ts", "[", "]", "*", "Ta...
// addNodelets generates the DOT boxes for the node tags if they exist.
[ "addNodelets", "generates", "the", "DOT", "boxes", "for", "the", "node", "tags", "if", "they", "exist", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L216-L263
164,920
google/pprof
internal/graph/dotgraph.go
addEdge
func (b *builder) addEdge(edge *Edge, from, to int, hasNodelets bool) { var inline string if edge.Inline { inline = `\n (inline)` } w := b.config.FormatValue(edge.WeightValue()) attr := fmt.Sprintf(`label=" %s%s"`, w, inline) if b.config.Total != 0 { // Note: edge.weight > b.config.Total is possible for profi...
go
func (b *builder) addEdge(edge *Edge, from, to int, hasNodelets bool) { var inline string if edge.Inline { inline = `\n (inline)` } w := b.config.FormatValue(edge.WeightValue()) attr := fmt.Sprintf(`label=" %s%s"`, w, inline) if b.config.Total != 0 { // Note: edge.weight > b.config.Total is possible for profi...
[ "func", "(", "b", "*", "builder", ")", "addEdge", "(", "edge", "*", "Edge", ",", "from", ",", "to", "int", ",", "hasNodelets", "bool", ")", "{", "var", "inline", "string", "\n", "if", "edge", ".", "Inline", "{", "inline", "=", "`\\n (inline)`", "\n",...
// addEdge generates a graph edge in DOT format.
[ "addEdge", "generates", "a", "graph", "edge", "in", "DOT", "format", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L285-L321
164,921
google/pprof
internal/graph/dotgraph.go
collapsedTags
func (b *builder) collapsedTags(ts []*Tag, count int, flatTags bool) []*Tag { ts = SortTags(ts, flatTags) if len(ts) <= count { return ts } tagGroups := make([][]*Tag, count) for i, t := range (ts)[:count] { tagGroups[i] = []*Tag{t} } for _, t := range (ts)[count:] { g, d := 0, tagDistance(t, tagGroups[0]...
go
func (b *builder) collapsedTags(ts []*Tag, count int, flatTags bool) []*Tag { ts = SortTags(ts, flatTags) if len(ts) <= count { return ts } tagGroups := make([][]*Tag, count) for i, t := range (ts)[:count] { tagGroups[i] = []*Tag{t} } for _, t := range (ts)[count:] { g, d := 0, tagDistance(t, tagGroups[0]...
[ "func", "(", "b", "*", "builder", ")", "collapsedTags", "(", "ts", "[", "]", "*", "Tag", ",", "count", "int", ",", "flatTags", "bool", ")", "[", "]", "*", "Tag", "{", "ts", "=", "SortTags", "(", "ts", ",", "flatTags", ")", "\n", "if", "len", "(...
// collapsedTags trims and sorts a slice of tags.
[ "collapsedTags", "trims", "and", "sorts", "a", "slice", "of", "tags", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/dotgraph.go#L395-L425
164,922
google/pprof
internal/report/report.go
newTrimmedGraph
func (rpt *Report) newTrimmedGraph() (g *graph.Graph, origCount, droppedNodes, droppedEdges int) { o := rpt.options // Build a graph and refine it. On each refinement step we must rebuild the graph from the samples, // as the graph itself doesn't contain enough information to preserve full precision. visualMode :=...
go
func (rpt *Report) newTrimmedGraph() (g *graph.Graph, origCount, droppedNodes, droppedEdges int) { o := rpt.options // Build a graph and refine it. On each refinement step we must rebuild the graph from the samples, // as the graph itself doesn't contain enough information to preserve full precision. visualMode :=...
[ "func", "(", "rpt", "*", "Report", ")", "newTrimmedGraph", "(", ")", "(", "g", "*", "graph", ".", "Graph", ",", "origCount", ",", "droppedNodes", ",", "droppedEdges", "int", ")", "{", "o", ":=", "rpt", ".", "options", "\n\n", "// Build a graph and refine i...
// newTrimmedGraph creates a graph for this report, trimmed according // to the report options.
[ "newTrimmedGraph", "creates", "a", "graph", "for", "this", "report", "trimmed", "according", "to", "the", "report", "options", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L122-L183
164,923
google/pprof
internal/report/report.go
newGraph
func (rpt *Report) newGraph(nodes graph.NodeSet) *graph.Graph { o := rpt.options // Clean up file paths using heuristics. prof := rpt.prof for _, f := range prof.Function { f.Filename = trimPath(f.Filename, o.TrimPath, o.SourcePath) } // Removes all numeric tags except for the bytes tag prior // to making gra...
go
func (rpt *Report) newGraph(nodes graph.NodeSet) *graph.Graph { o := rpt.options // Clean up file paths using heuristics. prof := rpt.prof for _, f := range prof.Function { f.Filename = trimPath(f.Filename, o.TrimPath, o.SourcePath) } // Removes all numeric tags except for the bytes tag prior // to making gra...
[ "func", "(", "rpt", "*", "Report", ")", "newGraph", "(", "nodes", "graph", ".", "NodeSet", ")", "*", "graph", ".", "Graph", "{", "o", ":=", "rpt", ".", "options", "\n\n", "// Clean up file paths using heuristics.", "prof", ":=", "rpt", ".", "prof", "\n", ...
// newGraph creates a new graph for this report. If nodes is non-nil, // only nodes whose info matches are included. Otherwise, all nodes // are included, without trimming.
[ "newGraph", "creates", "a", "new", "graph", "for", "this", "report", ".", "If", "nodes", "is", "non", "-", "nil", "only", "nodes", "whose", "info", "matches", "are", "included", ".", "Otherwise", "all", "nodes", "are", "included", "without", "trimming", "....
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L236-L292
164,924
google/pprof
internal/report/report.go
findOrAdd
func (fm functionMap) findOrAdd(ni graph.NodeInfo) (*profile.Function, bool) { fName := fmt.Sprintf("%q%q%q%d", ni.Name, ni.OrigName, ni.File, ni.StartLine) if f := fm[fName]; f != nil { return f, false } f := &profile.Function{ ID: uint64(len(fm) + 1), Name: ni.Name, SystemName: ni.OrigName...
go
func (fm functionMap) findOrAdd(ni graph.NodeInfo) (*profile.Function, bool) { fName := fmt.Sprintf("%q%q%q%d", ni.Name, ni.OrigName, ni.File, ni.StartLine) if f := fm[fName]; f != nil { return f, false } f := &profile.Function{ ID: uint64(len(fm) + 1), Name: ni.Name, SystemName: ni.OrigName...
[ "func", "(", "fm", "functionMap", ")", "findOrAdd", "(", "ni", "graph", ".", "NodeInfo", ")", "(", "*", "profile", ".", "Function", ",", "bool", ")", "{", "fName", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ni", ".", "Name", ",", "ni", "...
// findOrAdd takes a node representing a function, adds the function // represented by the node to the map if the function is not already present, // and returns the function the node represents. This also returns a boolean, // which is true if the function was added and false otherwise.
[ "findOrAdd", "takes", "a", "node", "representing", "a", "function", "adds", "the", "function", "represented", "by", "the", "node", "to", "the", "map", "if", "the", "function", "is", "not", "already", "present", "and", "returns", "the", "function", "the", "no...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L347-L363
164,925
google/pprof
internal/report/report.go
PrintAssembly
func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) error { o := rpt.options prof := rpt.prof g := rpt.newGraph(nil) // If the regexp source can be parsed as an address, also match // functions that land on that address. var address *uint64 if hex, err := strconv.ParseUint(o.Symbol.S...
go
func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) error { o := rpt.options prof := rpt.prof g := rpt.newGraph(nil) // If the regexp source can be parsed as an address, also match // functions that land on that address. var address *uint64 if hex, err := strconv.ParseUint(o.Symbol.S...
[ "func", "PrintAssembly", "(", "w", "io", ".", "Writer", ",", "rpt", "*", "Report", ",", "obj", "plugin", ".", "ObjTool", ",", "maxFuncs", "int", ")", "error", "{", "o", ":=", "rpt", ".", "options", "\n", "prof", ":=", "rpt", ".", "prof", "\n\n", "g...
// PrintAssembly prints annotated disassembly of rpt to w.
[ "PrintAssembly", "prints", "annotated", "disassembly", "of", "rpt", "to", "w", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L371-L483
164,926
google/pprof
internal/report/report.go
valueOrDot
func valueOrDot(value int64, rpt *Report) string { if value == 0 { return "." } return rpt.formatValue(value) }
go
func valueOrDot(value int64, rpt *Report) string { if value == 0 { return "." } return rpt.formatValue(value) }
[ "func", "valueOrDot", "(", "value", "int64", ",", "rpt", "*", "Report", ")", "string", "{", "if", "value", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "rpt", ".", "formatValue", "(", "value", ")", "\n", "}" ]
// valueOrDot formats a value according to a report, intercepting zero // values.
[ "valueOrDot", "formats", "a", "value", "according", "to", "a", "report", "intercepting", "zero", "values", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L653-L658
164,927
google/pprof
internal/report/report.go
printComments
func printComments(w io.Writer, rpt *Report) error { p := rpt.prof for _, c := range p.Comments { fmt.Fprintln(w, c) } return nil }
go
func printComments(w io.Writer, rpt *Report) error { p := rpt.prof for _, c := range p.Comments { fmt.Fprintln(w, c) } return nil }
[ "func", "printComments", "(", "w", "io", ".", "Writer", ",", "rpt", "*", "Report", ")", "error", "{", "p", ":=", "rpt", ".", "prof", "\n\n", "for", "_", ",", "c", ":=", "range", "p", ".", "Comments", "{", "fmt", ".", "Fprintln", "(", "w", ",", ...
// printComments prints all freeform comments in the profile.
[ "printComments", "prints", "all", "freeform", "comments", "in", "the", "profile", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L727-L734
164,928
google/pprof
internal/report/report.go
TextItems
func TextItems(rpt *Report) ([]TextItem, []string) { g, origCount, droppedNodes, _ := rpt.newTrimmedGraph() rpt.selectOutputUnit(g) labels := reportLabels(rpt, g, origCount, droppedNodes, 0, false) var items []TextItem var flatSum int64 for _, n := range g.Nodes { name, flat, cum := n.Info.PrintableName(), n.F...
go
func TextItems(rpt *Report) ([]TextItem, []string) { g, origCount, droppedNodes, _ := rpt.newTrimmedGraph() rpt.selectOutputUnit(g) labels := reportLabels(rpt, g, origCount, droppedNodes, 0, false) var items []TextItem var flatSum int64 for _, n := range g.Nodes { name, flat, cum := n.Info.PrintableName(), n.F...
[ "func", "TextItems", "(", "rpt", "*", "Report", ")", "(", "[", "]", "TextItem", ",", "[", "]", "string", ")", "{", "g", ",", "origCount", ",", "droppedNodes", ",", "_", ":=", "rpt", ".", "newTrimmedGraph", "(", ")", "\n", "rpt", ".", "selectOutputUni...
// TextItems returns a list of text items from the report and a list // of labels that describe the report.
[ "TextItems", "returns", "a", "list", "of", "text", "items", "from", "the", "report", "and", "a", "list", "of", "labels", "that", "describe", "the", "report", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L746-L785
164,929
google/pprof
internal/report/report.go
printTraces
func printTraces(w io.Writer, rpt *Report) error { fmt.Fprintln(w, strings.Join(ProfileLabels(rpt), "\n")) prof := rpt.prof o := rpt.options const separator = "-----------+-------------------------------------------------------" _, locations := graph.CreateNodes(prof, &graph.Options{}) for _, sample := range p...
go
func printTraces(w io.Writer, rpt *Report) error { fmt.Fprintln(w, strings.Join(ProfileLabels(rpt), "\n")) prof := rpt.prof o := rpt.options const separator = "-----------+-------------------------------------------------------" _, locations := graph.CreateNodes(prof, &graph.Options{}) for _, sample := range p...
[ "func", "printTraces", "(", "w", "io", ".", "Writer", ",", "rpt", "*", "Report", ")", "error", "{", "fmt", ".", "Fprintln", "(", "w", ",", "strings", ".", "Join", "(", "ProfileLabels", "(", "rpt", ")", ",", "\"", "\\n", "\"", ")", ")", "\n\n", "p...
// printTraces prints all traces from a profile.
[ "printTraces", "prints", "all", "traces", "from", "a", "profile", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L810-L869
164,930
google/pprof
internal/report/report.go
GetDOT
func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig) { g, origCount, droppedNodes, droppedEdges := rpt.newTrimmedGraph() rpt.selectOutputUnit(g) labels := reportLabels(rpt, g, origCount, droppedNodes, droppedEdges, true) c := &graph.DotConfig{ Title: rpt.options.Title, Labels: labels, FormatV...
go
func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig) { g, origCount, droppedNodes, droppedEdges := rpt.newTrimmedGraph() rpt.selectOutputUnit(g) labels := reportLabels(rpt, g, origCount, droppedNodes, droppedEdges, true) c := &graph.DotConfig{ Title: rpt.options.Title, Labels: labels, FormatV...
[ "func", "GetDOT", "(", "rpt", "*", "Report", ")", "(", "*", "graph", ".", "Graph", ",", "*", "graph", ".", "DotConfig", ")", "{", "g", ",", "origCount", ",", "droppedNodes", ",", "droppedEdges", ":=", "rpt", ".", "newTrimmedGraph", "(", ")", "\n", "r...
// GetDOT returns a graph suitable for dot processing along with some // configuration information.
[ "GetDOT", "returns", "a", "graph", "suitable", "for", "dot", "processing", "along", "with", "some", "configuration", "information", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L1074-L1086
164,931
google/pprof
internal/report/report.go
ProfileLabels
func ProfileLabels(rpt *Report) []string { label := []string{} prof := rpt.prof o := rpt.options if len(prof.Mapping) > 0 { if prof.Mapping[0].File != "" { label = append(label, "File: "+filepath.Base(prof.Mapping[0].File)) } if prof.Mapping[0].BuildID != "" { label = append(label, "Build ID: "+prof.Map...
go
func ProfileLabels(rpt *Report) []string { label := []string{} prof := rpt.prof o := rpt.options if len(prof.Mapping) > 0 { if prof.Mapping[0].File != "" { label = append(label, "File: "+filepath.Base(prof.Mapping[0].File)) } if prof.Mapping[0].BuildID != "" { label = append(label, "Build ID: "+prof.Map...
[ "func", "ProfileLabels", "(", "rpt", "*", "Report", ")", "[", "]", "string", "{", "label", ":=", "[", "]", "string", "{", "}", "\n", "prof", ":=", "rpt", ".", "prof", "\n", "o", ":=", "rpt", ".", "options", "\n", "if", "len", "(", "prof", ".", ...
// ProfileLabels returns printable labels for a profile.
[ "ProfileLabels", "returns", "printable", "labels", "for", "a", "profile", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L1096-L1131
164,932
google/pprof
internal/report/report.go
reportLabels
func reportLabels(rpt *Report, g *graph.Graph, origCount, droppedNodes, droppedEdges int, fullHeaders bool) []string { nodeFraction := rpt.options.NodeFraction edgeFraction := rpt.options.EdgeFraction nodeCount := len(g.Nodes) var label []string if len(rpt.options.ProfileLabels) > 0 { label = append(label, rpt....
go
func reportLabels(rpt *Report, g *graph.Graph, origCount, droppedNodes, droppedEdges int, fullHeaders bool) []string { nodeFraction := rpt.options.NodeFraction edgeFraction := rpt.options.EdgeFraction nodeCount := len(g.Nodes) var label []string if len(rpt.options.ProfileLabels) > 0 { label = append(label, rpt....
[ "func", "reportLabels", "(", "rpt", "*", "Report", ",", "g", "*", "graph", ".", "Graph", ",", "origCount", ",", "droppedNodes", ",", "droppedEdges", "int", ",", "fullHeaders", "bool", ")", "[", "]", "string", "{", "nodeFraction", ":=", "rpt", ".", "optio...
// reportLabels returns printable labels for a report. Includes // profileLabels.
[ "reportLabels", "returns", "printable", "labels", "for", "a", "report", ".", "Includes", "profileLabels", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L1135-L1174
164,933
google/pprof
internal/report/report.go
NewDefault
func NewDefault(prof *profile.Profile, options Options) *Report { index := len(prof.SampleType) - 1 o := &options if o.Title == "" && len(prof.Mapping) > 0 && prof.Mapping[0].File != "" { o.Title = filepath.Base(prof.Mapping[0].File) } o.SampleType = prof.SampleType[index].Type o.SampleUnit = strings.ToLower(pr...
go
func NewDefault(prof *profile.Profile, options Options) *Report { index := len(prof.SampleType) - 1 o := &options if o.Title == "" && len(prof.Mapping) > 0 && prof.Mapping[0].File != "" { o.Title = filepath.Base(prof.Mapping[0].File) } o.SampleType = prof.SampleType[index].Type o.SampleUnit = strings.ToLower(pr...
[ "func", "NewDefault", "(", "prof", "*", "profile", ".", "Profile", ",", "options", "Options", ")", "*", "Report", "{", "index", ":=", "len", "(", "prof", ".", "SampleType", ")", "-", "1", "\n", "o", ":=", "&", "options", "\n", "if", "o", ".", "Titl...
// NewDefault builds a new report indexing the last sample value // available.
[ "NewDefault", "builds", "a", "new", "report", "indexing", "the", "last", "sample", "value", "available", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L1211-L1223
164,934
google/pprof
internal/report/report.go
computeTotal
func computeTotal(prof *profile.Profile, value, meanDiv func(v []int64) int64) int64 { var div, total, diffDiv, diffTotal int64 for _, sample := range prof.Sample { var d, v int64 v = value(sample.Value) if meanDiv != nil { d = meanDiv(sample.Value) } if v < 0 { v = -v } total += v div += d if...
go
func computeTotal(prof *profile.Profile, value, meanDiv func(v []int64) int64) int64 { var div, total, diffDiv, diffTotal int64 for _, sample := range prof.Sample { var d, v int64 v = value(sample.Value) if meanDiv != nil { d = meanDiv(sample.Value) } if v < 0 { v = -v } total += v div += d if...
[ "func", "computeTotal", "(", "prof", "*", "profile", ".", "Profile", ",", "value", ",", "meanDiv", "func", "(", "v", "[", "]", "int64", ")", "int64", ")", "int64", "{", "var", "div", ",", "total", ",", "diffDiv", ",", "diffTotal", "int64", "\n", "for...
// computeTotal computes the sum of the absolute value of all sample values. // If any samples have label indicating they belong to the diff base, then the // total will only include samples with that label.
[ "computeTotal", "computes", "the", "sum", "of", "the", "absolute", "value", "of", "all", "sample", "values", ".", "If", "any", "samples", "have", "label", "indicating", "they", "belong", "to", "the", "diff", "base", "then", "the", "total", "will", "only", ...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/report/report.go#L1228-L1254
164,935
google/pprof
profile/index.go
SampleIndexByName
func (p *Profile) SampleIndexByName(sampleIndex string) (int, error) { if sampleIndex == "" { if dst := p.DefaultSampleType; dst != "" { for i, t := range sampleTypes(p) { if t == dst { return i, nil } } } // By default select the last sample value return len(p.SampleType) - 1, nil } if i,...
go
func (p *Profile) SampleIndexByName(sampleIndex string) (int, error) { if sampleIndex == "" { if dst := p.DefaultSampleType; dst != "" { for i, t := range sampleTypes(p) { if t == dst { return i, nil } } } // By default select the last sample value return len(p.SampleType) - 1, nil } if i,...
[ "func", "(", "p", "*", "Profile", ")", "SampleIndexByName", "(", "sampleIndex", "string", ")", "(", "int", ",", "error", ")", "{", "if", "sampleIndex", "==", "\"", "\"", "{", "if", "dst", ":=", "p", ".", "DefaultSampleType", ";", "dst", "!=", "\"", "...
// SampleIndexByName returns the appropriate index for a value of sample index. // If numeric, it returns the number, otherwise it looks up the text in the // profile sample types.
[ "SampleIndexByName", "returns", "the", "appropriate", "index", "for", "a", "value", "of", "sample", "index", ".", "If", "numeric", "it", "returns", "the", "number", "otherwise", "it", "looks", "up", "the", "text", "in", "the", "profile", "sample", "types", "...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/index.go#L26-L56
164,936
google/pprof
internal/driver/flamegraph.go
flamegraph
func (ui *webInterface) flamegraph(w http.ResponseWriter, req *http.Request) { // Force the call tree so that the graph is a tree. // Also do not trim the tree so that the flame graph contains all functions. rpt, errList := ui.makeReport(w, req, []string{"svg"}, "call_tree", "true", "trim", "false") if rpt == nil {...
go
func (ui *webInterface) flamegraph(w http.ResponseWriter, req *http.Request) { // Force the call tree so that the graph is a tree. // Also do not trim the tree so that the flame graph contains all functions. rpt, errList := ui.makeReport(w, req, []string{"svg"}, "call_tree", "true", "trim", "false") if rpt == nil {...
[ "func", "(", "ui", "*", "webInterface", ")", "flamegraph", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "// Force the call tree so that the graph is a tree.", "// Also do not trim the tree so that the flame graph contains all f...
// flamegraph generates a web page containing a flamegraph.
[ "flamegraph", "generates", "a", "web", "page", "containing", "a", "flamegraph", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flamegraph.go#L38-L103
164,937
google/pprof
profile/merge.go
Compact
func (p *Profile) Compact() *Profile { p, _ = Merge([]*Profile{p}) return p }
go
func (p *Profile) Compact() *Profile { p, _ = Merge([]*Profile{p}) return p }
[ "func", "(", "p", "*", "Profile", ")", "Compact", "(", ")", "*", "Profile", "{", "p", ",", "_", "=", "Merge", "(", "[", "]", "*", "Profile", "{", "p", "}", ")", "\n", "return", "p", "\n", "}" ]
// Compact performs garbage collection on a profile to remove any // unreferenced fields. This is useful to reduce the size of a profile // after samples or locations have been removed.
[ "Compact", "performs", "garbage", "collection", "on", "a", "profile", "to", "remove", "any", "unreferenced", "fields", ".", "This", "is", "useful", "to", "reduce", "the", "size", "of", "a", "profile", "after", "samples", "or", "locations", "have", "been", "r...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L27-L30
164,938
google/pprof
profile/merge.go
Merge
func Merge(srcs []*Profile) (*Profile, error) { if len(srcs) == 0 { return nil, fmt.Errorf("no profiles to merge") } p, err := combineHeaders(srcs) if err != nil { return nil, err } pm := &profileMerger{ p: p, samples: make(map[sampleKey]*Sample, len(srcs[0].Sample)), locations: make(map[loca...
go
func Merge(srcs []*Profile) (*Profile, error) { if len(srcs) == 0 { return nil, fmt.Errorf("no profiles to merge") } p, err := combineHeaders(srcs) if err != nil { return nil, err } pm := &profileMerger{ p: p, samples: make(map[sampleKey]*Sample, len(srcs[0].Sample)), locations: make(map[loca...
[ "func", "Merge", "(", "srcs", "[", "]", "*", "Profile", ")", "(", "*", "Profile", ",", "error", ")", "{", "if", "len", "(", "srcs", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ...
// 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. profi...
[ "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", "unus...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L39-L86
164,939
google/pprof
profile/merge.go
Normalize
func (p *Profile) Normalize(pb *Profile) error { if err := p.compatible(pb); err != nil { return err } baseVals := make([]int64, len(p.SampleType)) for _, s := range pb.Sample { for i, v := range s.Value { baseVals[i] += v } } srcVals := make([]int64, len(p.SampleType)) for _, s := range p.Sample { ...
go
func (p *Profile) Normalize(pb *Profile) error { if err := p.compatible(pb); err != nil { return err } baseVals := make([]int64, len(p.SampleType)) for _, s := range pb.Sample { for i, v := range s.Value { baseVals[i] += v } } srcVals := make([]int64, len(p.SampleType)) for _, s := range p.Sample { ...
[ "func", "(", "p", "*", "Profile", ")", "Normalize", "(", "pb", "*", "Profile", ")", "error", "{", "if", "err", ":=", "p", ".", "compatible", "(", "pb", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "baseVals", ":=", "make...
// 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.
[ "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",...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L91-L121
164,940
google/pprof
profile/merge.go
key
func (sample *Sample) key() sampleKey { ids := make([]string, len(sample.Location)) for i, l := range sample.Location { ids[i] = strconv.FormatUint(l.ID, 16) } labels := make([]string, 0, len(sample.Label)) for k, v := range sample.Label { labels = append(labels, fmt.Sprintf("%q%q", k, v)) } sort.Strings(la...
go
func (sample *Sample) key() sampleKey { ids := make([]string, len(sample.Location)) for i, l := range sample.Location { ids[i] = strconv.FormatUint(l.ID, 16) } labels := make([]string, 0, len(sample.Label)) for k, v := range sample.Label { labels = append(labels, fmt.Sprintf("%q%q", k, v)) } sort.Strings(la...
[ "func", "(", "sample", "*", "Sample", ")", "key", "(", ")", "sampleKey", "{", "ids", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "sample", ".", "Location", ")", ")", "\n", "for", "i", ",", "l", ":=", "range", "sample", ".", "Location"...
// key generates sampleKey to be used as a key for maps.
[ "key", "generates", "sampleKey", "to", "be", "used", "as", "a", "key", "for", "maps", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L194-L217
164,941
google/pprof
profile/merge.go
key
func (l *Location) key() locationKey { key := locationKey{ addr: l.Address, isFolded: l.IsFolded, } if l.Mapping != nil { // Normalizes address to handle address space randomization. key.addr -= l.Mapping.Start key.mappingID = l.Mapping.ID } lines := make([]string, len(l.Line)*2) for i, line := rang...
go
func (l *Location) key() locationKey { key := locationKey{ addr: l.Address, isFolded: l.IsFolded, } if l.Mapping != nil { // Normalizes address to handle address space randomization. key.addr -= l.Mapping.Start key.mappingID = l.Mapping.ID } lines := make([]string, len(l.Line)*2) for i, line := rang...
[ "func", "(", "l", "*", "Location", ")", "key", "(", ")", "locationKey", "{", "key", ":=", "locationKey", "{", "addr", ":", "l", ".", "Address", ",", "isFolded", ":", "l", ".", "IsFolded", ",", "}", "\n", "if", "l", ".", "Mapping", "!=", "nil", "{...
// key generates locationKey to be used as a key for maps.
[ "key", "generates", "locationKey", "to", "be", "used", "as", "a", "key", "for", "maps", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L260-L279
164,942
google/pprof
profile/merge.go
key
func (m *Mapping) key() mappingKey { // Normalize addresses to handle address space randomization. // Round up to next 4K boundary to avoid minor discrepancies. const mapsizeRounding = 0x1000 size := m.Limit - m.Start size = size + mapsizeRounding - 1 size = size - (size % mapsizeRounding) key := mappingKey{ ...
go
func (m *Mapping) key() mappingKey { // Normalize addresses to handle address space randomization. // Round up to next 4K boundary to avoid minor discrepancies. const mapsizeRounding = 0x1000 size := m.Limit - m.Start size = size + mapsizeRounding - 1 size = size - (size % mapsizeRounding) key := mappingKey{ ...
[ "func", "(", "m", "*", "Mapping", ")", "key", "(", ")", "mappingKey", "{", "// Normalize addresses to handle address space randomization.", "// Round up to next 4K boundary to avoid minor discrepancies.", "const", "mapsizeRounding", "=", "0x1000", "\n\n", "size", ":=", "m", ...
// key generates encoded strings of Mapping to be used as a key for // maps.
[ "key", "generates", "encoded", "strings", "of", "Mapping", "to", "be", "used", "as", "a", "key", "for", "maps", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L326-L350
164,943
google/pprof
profile/merge.go
key
func (f *Function) key() functionKey { return functionKey{ f.StartLine, f.Name, f.SystemName, f.Filename, } }
go
func (f *Function) key() functionKey { return functionKey{ f.StartLine, f.Name, f.SystemName, f.Filename, } }
[ "func", "(", "f", "*", "Function", ")", "key", "(", ")", "functionKey", "{", "return", "functionKey", "{", "f", ".", "StartLine", ",", "f", ".", "Name", ",", "f", ".", "SystemName", ",", "f", ".", "Filename", ",", "}", "\n", "}" ]
// key generates a struct to be used as a key for maps.
[ "key", "generates", "a", "struct", "to", "be", "used", "as", "a", "key", "for", "maps", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L391-L398
164,944
google/pprof
profile/merge.go
combineHeaders
func combineHeaders(srcs []*Profile) (*Profile, error) { for _, s := range srcs[1:] { if err := srcs[0].compatible(s); err != nil { return nil, err } } var timeNanos, durationNanos, period int64 var comments []string seenComments := map[string]bool{} var defaultSampleType string for _, s := range srcs { ...
go
func combineHeaders(srcs []*Profile) (*Profile, error) { for _, s := range srcs[1:] { if err := srcs[0].compatible(s); err != nil { return nil, err } } var timeNanos, durationNanos, period int64 var comments []string seenComments := map[string]bool{} var defaultSampleType string for _, s := range srcs { ...
[ "func", "combineHeaders", "(", "srcs", "[", "]", "*", "Profile", ")", "(", "*", "Profile", ",", "error", ")", "{", "for", "_", ",", "s", ":=", "range", "srcs", "[", "1", ":", "]", "{", "if", "err", ":=", "srcs", "[", "0", "]", ".", "compatible"...
// combineHeaders checks that all profiles can be merged and returns // their combined profile.
[ "combineHeaders", "checks", "that", "all", "profiles", "can", "be", "merged", "and", "returns", "their", "combined", "profile", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/profile/merge.go#L407-L453
164,945
google/pprof
internal/driver/flags.go
Bool
func (*GoFlags) Bool(o string, d bool, c string) *bool { return flag.Bool(o, d, c) }
go
func (*GoFlags) Bool(o string, d bool, c string) *bool { return flag.Bool(o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "Bool", "(", "o", "string", ",", "d", "bool", ",", "c", "string", ")", "*", "bool", "{", "return", "flag", ".", "Bool", "(", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// Bool implements the plugin.FlagSet interface.
[ "Bool", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L28-L30
164,946
google/pprof
internal/driver/flags.go
Int
func (*GoFlags) Int(o string, d int, c string) *int { return flag.Int(o, d, c) }
go
func (*GoFlags) Int(o string, d int, c string) *int { return flag.Int(o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "Int", "(", "o", "string", ",", "d", "int", ",", "c", "string", ")", "*", "int", "{", "return", "flag", ".", "Int", "(", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// Int implements the plugin.FlagSet interface.
[ "Int", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L33-L35
164,947
google/pprof
internal/driver/flags.go
Float64
func (*GoFlags) Float64(o string, d float64, c string) *float64 { return flag.Float64(o, d, c) }
go
func (*GoFlags) Float64(o string, d float64, c string) *float64 { return flag.Float64(o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "Float64", "(", "o", "string", ",", "d", "float64", ",", "c", "string", ")", "*", "float64", "{", "return", "flag", ".", "Float64", "(", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// Float64 implements the plugin.FlagSet interface.
[ "Float64", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L38-L40
164,948
google/pprof
internal/driver/flags.go
BoolVar
func (*GoFlags) BoolVar(b *bool, o string, d bool, c string) { flag.BoolVar(b, o, d, c) }
go
func (*GoFlags) BoolVar(b *bool, o string, d bool, c string) { flag.BoolVar(b, o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "BoolVar", "(", "b", "*", "bool", ",", "o", "string", ",", "d", "bool", ",", "c", "string", ")", "{", "flag", ".", "BoolVar", "(", "b", ",", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// BoolVar implements the plugin.FlagSet interface.
[ "BoolVar", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L48-L50
164,949
google/pprof
internal/driver/flags.go
IntVar
func (*GoFlags) IntVar(i *int, o string, d int, c string) { flag.IntVar(i, o, d, c) }
go
func (*GoFlags) IntVar(i *int, o string, d int, c string) { flag.IntVar(i, o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "IntVar", "(", "i", "*", "int", ",", "o", "string", ",", "d", "int", ",", "c", "string", ")", "{", "flag", ".", "IntVar", "(", "i", ",", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// IntVar implements the plugin.FlagSet interface.
[ "IntVar", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L53-L55
164,950
google/pprof
internal/driver/flags.go
Float64Var
func (*GoFlags) Float64Var(f *float64, o string, d float64, c string) { flag.Float64Var(f, o, d, c) }
go
func (*GoFlags) Float64Var(f *float64, o string, d float64, c string) { flag.Float64Var(f, o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "Float64Var", "(", "f", "*", "float64", ",", "o", "string", ",", "d", "float64", ",", "c", "string", ")", "{", "flag", ".", "Float64Var", "(", "f", ",", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// Float64Var implements the plugin.FlagSet interface. // the value of the flag.
[ "Float64Var", "implements", "the", "plugin", ".", "FlagSet", "interface", ".", "the", "value", "of", "the", "flag", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L59-L61
164,951
google/pprof
internal/driver/flags.go
StringVar
func (*GoFlags) StringVar(s *string, o, d, c string) { flag.StringVar(s, o, d, c) }
go
func (*GoFlags) StringVar(s *string, o, d, c string) { flag.StringVar(s, o, d, c) }
[ "func", "(", "*", "GoFlags", ")", "StringVar", "(", "s", "*", "string", ",", "o", ",", "d", ",", "c", "string", ")", "{", "flag", ".", "StringVar", "(", "s", ",", "o", ",", "d", ",", "c", ")", "\n", "}" ]
// StringVar implements the plugin.FlagSet interface.
[ "StringVar", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L64-L66
164,952
google/pprof
internal/driver/flags.go
StringList
func (*GoFlags) StringList(o, d, c string) *[]*string { return &[]*string{flag.String(o, d, c)} }
go
func (*GoFlags) StringList(o, d, c string) *[]*string { return &[]*string{flag.String(o, d, c)} }
[ "func", "(", "*", "GoFlags", ")", "StringList", "(", "o", ",", "d", ",", "c", "string", ")", "*", "[", "]", "*", "string", "{", "return", "&", "[", "]", "*", "string", "{", "flag", ".", "String", "(", "o", ",", "d", ",", "c", ")", "}", "\n"...
// StringList implements the plugin.FlagSet interface.
[ "StringList", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L69-L71
164,953
google/pprof
internal/driver/flags.go
AddExtraUsage
func (f *GoFlags) AddExtraUsage(eu string) { f.UsageMsgs = append(f.UsageMsgs, eu) }
go
func (f *GoFlags) AddExtraUsage(eu string) { f.UsageMsgs = append(f.UsageMsgs, eu) }
[ "func", "(", "f", "*", "GoFlags", ")", "AddExtraUsage", "(", "eu", "string", ")", "{", "f", ".", "UsageMsgs", "=", "append", "(", "f", ".", "UsageMsgs", ",", "eu", ")", "\n", "}" ]
// AddExtraUsage implements the plugin.FlagSet interface.
[ "AddExtraUsage", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L79-L81
164,954
google/pprof
internal/driver/flags.go
Parse
func (*GoFlags) Parse(usage func()) []string { flag.Usage = usage flag.Parse() args := flag.Args() if len(args) == 0 { usage() } return args }
go
func (*GoFlags) Parse(usage func()) []string { flag.Usage = usage flag.Parse() args := flag.Args() if len(args) == 0 { usage() } return args }
[ "func", "(", "*", "GoFlags", ")", "Parse", "(", "usage", "func", "(", ")", ")", "[", "]", "string", "{", "flag", ".", "Usage", "=", "usage", "\n", "flag", ".", "Parse", "(", ")", "\n", "args", ":=", "flag", ".", "Args", "(", ")", "\n", "if", ...
// Parse implements the plugin.FlagSet interface.
[ "Parse", "implements", "the", "plugin", ".", "FlagSet", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/flags.go#L84-L92
164,955
google/pprof
internal/binutils/binutils.go
get
func (bu *Binutils) get() *binrep { bu.mu.Lock() r := bu.rep if r == nil { r = &binrep{} initTools(r, "") bu.rep = r } bu.mu.Unlock() return r }
go
func (bu *Binutils) get() *binrep { bu.mu.Lock() r := bu.rep if r == nil { r = &binrep{} initTools(r, "") bu.rep = r } bu.mu.Unlock() return r }
[ "func", "(", "bu", "*", "Binutils", ")", "get", "(", ")", "*", "binrep", "{", "bu", ".", "mu", ".", "Lock", "(", ")", "\n", "r", ":=", "bu", ".", "rep", "\n", "if", "r", "==", "nil", "{", "r", "=", "&", "binrep", "{", "}", "\n", "initTools"...
// get returns the current representation for bu, initializing it if necessary.
[ "get", "returns", "the", "current", "representation", "for", "bu", "initializing", "it", "if", "necessary", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/binutils.go#L61-L71
164,956
google/pprof
internal/binutils/binutils.go
update
func (bu *Binutils) update(fn func(r *binrep)) { r := &binrep{} bu.mu.Lock() defer bu.mu.Unlock() if bu.rep == nil { initTools(r, "") } else { *r = *bu.rep } fn(r) bu.rep = r }
go
func (bu *Binutils) update(fn func(r *binrep)) { r := &binrep{} bu.mu.Lock() defer bu.mu.Unlock() if bu.rep == nil { initTools(r, "") } else { *r = *bu.rep } fn(r) bu.rep = r }
[ "func", "(", "bu", "*", "Binutils", ")", "update", "(", "fn", "func", "(", "r", "*", "binrep", ")", ")", "{", "r", ":=", "&", "binrep", "{", "}", "\n", "bu", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "bu", ".", "mu", ".", "Unlock", "...
// update modifies the rep for bu via the supplied function.
[ "update", "modifies", "the", "rep", "for", "bu", "via", "the", "supplied", "function", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/binutils.go#L74-L85
164,957
google/pprof
internal/binutils/binutils.go
String
func (bu *Binutils) String() string { r := bu.get() var llvmSymbolizer, addr2line, nm, objdump string if r.llvmSymbolizerFound { llvmSymbolizer = r.llvmSymbolizer } if r.addr2lineFound { addr2line = r.addr2line } if r.nmFound { nm = r.nm } if r.objdumpFound { objdump = r.objdump } return fmt.Sprintf(...
go
func (bu *Binutils) String() string { r := bu.get() var llvmSymbolizer, addr2line, nm, objdump string if r.llvmSymbolizerFound { llvmSymbolizer = r.llvmSymbolizer } if r.addr2lineFound { addr2line = r.addr2line } if r.nmFound { nm = r.nm } if r.objdumpFound { objdump = r.objdump } return fmt.Sprintf(...
[ "func", "(", "bu", "*", "Binutils", ")", "String", "(", ")", "string", "{", "r", ":=", "bu", ".", "get", "(", ")", "\n", "var", "llvmSymbolizer", ",", "addr2line", ",", "nm", ",", "objdump", "string", "\n", "if", "r", ".", "llvmSymbolizerFound", "{",...
// String returns string representation of the binutils state for debug logging.
[ "String", "returns", "string", "representation", "of", "the", "binutils", "state", "for", "debug", "logging", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/binutils.go#L88-L105
164,958
google/pprof
internal/binutils/binutils.go
findExe
func findExe(cmd string, paths []string) (string, bool) { for _, p := range paths { cp := filepath.Join(p, cmd) if c, err := exec.LookPath(cp); err == nil { return c, true } } return cmd, false }
go
func findExe(cmd string, paths []string) (string, bool) { for _, p := range paths { cp := filepath.Join(p, cmd) if c, err := exec.LookPath(cp); err == nil { return c, true } } return cmd, false }
[ "func", "findExe", "(", "cmd", "string", ",", "paths", "[", "]", "string", ")", "(", "string", ",", "bool", ")", "{", "for", "_", ",", "p", ":=", "range", "paths", "{", "cp", ":=", "filepath", ".", "Join", "(", "p", ",", "cmd", ")", "\n", "if",...
// findExe looks for an executable command on a set of paths. // If it cannot find it, returns cmd.
[ "findExe", "looks", "for", "an", "executable", "command", "on", "a", "set", "of", "paths", ".", "If", "it", "cannot", "find", "it", "returns", "cmd", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/binutils.go#L148-L156
164,959
google/pprof
internal/binutils/binutils.go
Disasm
func (bu *Binutils) Disasm(file string, start, end uint64) ([]plugin.Inst, error) { b := bu.get() cmd := exec.Command(b.objdump, "-d", "-C", "--no-show-raw-insn", "-l", fmt.Sprintf("--start-address=%#x", start), fmt.Sprintf("--stop-address=%#x", end), file) out, err := cmd.Output() if err != nil { return ni...
go
func (bu *Binutils) Disasm(file string, start, end uint64) ([]plugin.Inst, error) { b := bu.get() cmd := exec.Command(b.objdump, "-d", "-C", "--no-show-raw-insn", "-l", fmt.Sprintf("--start-address=%#x", start), fmt.Sprintf("--stop-address=%#x", end), file) out, err := cmd.Output() if err != nil { return ni...
[ "func", "(", "bu", "*", "Binutils", ")", "Disasm", "(", "file", "string", ",", "start", ",", "end", "uint64", ")", "(", "[", "]", "plugin", ".", "Inst", ",", "error", ")", "{", "b", ":=", "bu", ".", "get", "(", ")", "\n", "cmd", ":=", "exec", ...
// Disasm returns the assembly instructions for the specified address range // of a binary.
[ "Disasm", "returns", "the", "assembly", "instructions", "for", "the", "specified", "address", "range", "of", "a", "binary", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/binutils.go#L160-L172
164,960
google/pprof
internal/binutils/binutils.go
Open
func (bu *Binutils) Open(name string, start, limit, offset uint64) (plugin.ObjFile, error) { b := bu.get() // Make sure file is a supported executable. // This uses magic numbers, mainly to provide better error messages but // it should also help speed. if _, err := os.Stat(name); err != nil { // For testing, ...
go
func (bu *Binutils) Open(name string, start, limit, offset uint64) (plugin.ObjFile, error) { b := bu.get() // Make sure file is a supported executable. // This uses magic numbers, mainly to provide better error messages but // it should also help speed. if _, err := os.Stat(name); err != nil { // For testing, ...
[ "func", "(", "bu", "*", "Binutils", ")", "Open", "(", "name", "string", ",", "start", ",", "limit", ",", "offset", "uint64", ")", "(", "plugin", ".", "ObjFile", ",", "error", ")", "{", "b", ":=", "bu", ".", "get", "(", ")", "\n\n", "// Make sure fi...
// Open satisfies the plugin.ObjTool interface.
[ "Open", "satisfies", "the", "plugin", ".", "ObjTool", "interface", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/binutils.go#L175-L235
164,961
google/pprof
internal/binutils/addr2liner_llvm.go
newLLVMSymbolizer
func newLLVMSymbolizer(cmd, file string, base uint64) (*llvmSymbolizer, error) { if cmd == "" { cmd = defaultLLVMSymbolizer } j := &llvmSymbolizerJob{ cmd: exec.Command(cmd, "-inlining", "-demangle=false"), } var err error if j.in, err = j.cmd.StdinPipe(); err != nil { return nil, err } outPipe, err :=...
go
func newLLVMSymbolizer(cmd, file string, base uint64) (*llvmSymbolizer, error) { if cmd == "" { cmd = defaultLLVMSymbolizer } j := &llvmSymbolizerJob{ cmd: exec.Command(cmd, "-inlining", "-demangle=false"), } var err error if j.in, err = j.cmd.StdinPipe(); err != nil { return nil, err } outPipe, err :=...
[ "func", "newLLVMSymbolizer", "(", "cmd", ",", "file", "string", ",", "base", "uint64", ")", "(", "*", "llvmSymbolizer", ",", "error", ")", "{", "if", "cmd", "==", "\"", "\"", "{", "cmd", "=", "defaultLLVMSymbolizer", "\n", "}", "\n\n", "j", ":=", "&", ...
// newLlvmSymbolizer starts the given llvmSymbolizer command reporting // information about the given executable file. If file is a shared // library, base should be the address at which it was mapped in the // program under consideration.
[ "newLlvmSymbolizer", "starts", "the", "given", "llvmSymbolizer", "command", "reporting", "information", "about", "the", "given", "executable", "file", ".", "If", "file", "is", "a", "shared", "library", "base", "should", "be", "the", "address", "at", "which", "it...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/addr2liner_llvm.go#L67-L98
164,962
google/pprof
internal/binutils/addr2liner_llvm.go
readFrame
func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) { funcname, err := d.readString() if err != nil { return plugin.Frame{}, true } switch funcname { case "": return plugin.Frame{}, true case "??": funcname = "" } fileline, err := d.readString() if err != nil { return plugin.Frame{Func: funcnam...
go
func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) { funcname, err := d.readString() if err != nil { return plugin.Frame{}, true } switch funcname { case "": return plugin.Frame{}, true case "??": funcname = "" } fileline, err := d.readString() if err != nil { return plugin.Frame{Func: funcnam...
[ "func", "(", "d", "*", "llvmSymbolizer", ")", "readFrame", "(", ")", "(", "plugin", ".", "Frame", ",", "bool", ")", "{", "funcname", ",", "err", ":=", "d", ".", "readString", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "plugin", ".", ...
// readFrame parses the llvm-symbolizer output for a single address. It // returns a populated plugin.Frame and whether it has reached the end of the // data.
[ "readFrame", "parses", "the", "llvm", "-", "symbolizer", "output", "for", "a", "single", "address", ".", "It", "returns", "a", "populated", "plugin", ".", "Frame", "and", "whether", "it", "has", "reached", "the", "end", "of", "the", "data", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/binutils/addr2liner_llvm.go#L111-L150
164,963
google/pprof
internal/driver/cli.go
addBaseProfiles
func (source *source) addBaseProfiles(flagBase, flagDiffBase []*string) error { base, diffBase := dropEmpty(flagBase), dropEmpty(flagDiffBase) if len(base) > 0 && len(diffBase) > 0 { return errors.New("-base and -diff_base flags cannot both be specified") } source.Base = base if len(diffBase) > 0 { source.Bas...
go
func (source *source) addBaseProfiles(flagBase, flagDiffBase []*string) error { base, diffBase := dropEmpty(flagBase), dropEmpty(flagDiffBase) if len(base) > 0 && len(diffBase) > 0 { return errors.New("-base and -diff_base flags cannot both be specified") } source.Base = base if len(diffBase) > 0 { source.Bas...
[ "func", "(", "source", "*", "source", ")", "addBaseProfiles", "(", "flagBase", ",", "flagDiffBase", "[", "]", "*", "string", ")", "error", "{", "base", ",", "diffBase", ":=", "dropEmpty", "(", "flagBase", ")", ",", "dropEmpty", "(", "flagDiffBase", ")", ...
// addBaseProfiles adds the list of base profiles or diff base profiles to // the source. This function will return an error if both base and diff base // profiles are specified.
[ "addBaseProfiles", "adds", "the", "list", "of", "base", "profiles", "or", "diff", "base", "profiles", "to", "the", "source", ".", "This", "function", "will", "return", "an", "error", "if", "both", "base", "and", "diff", "base", "profiles", "are", "specified"...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/cli.go#L172-L183
164,964
google/pprof
internal/driver/cli.go
dropEmpty
func dropEmpty(list []*string) []string { var l []string for _, s := range list { if *s != "" { l = append(l, *s) } } return l }
go
func dropEmpty(list []*string) []string { var l []string for _, s := range list { if *s != "" { l = append(l, *s) } } return l }
[ "func", "dropEmpty", "(", "list", "[", "]", "*", "string", ")", "[", "]", "string", "{", "var", "l", "[", "]", "string", "\n", "for", "_", ",", "s", ":=", "range", "list", "{", "if", "*", "s", "!=", "\"", "\"", "{", "l", "=", "append", "(", ...
// dropEmpty list takes a slice of string pointers, and outputs a slice of // non-empty strings associated with the flag.
[ "dropEmpty", "list", "takes", "a", "slice", "of", "string", "pointers", "and", "outputs", "a", "slice", "of", "non", "-", "empty", "strings", "associated", "with", "the", "flag", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/cli.go#L187-L195
164,965
google/pprof
internal/driver/cli.go
installFlags
func installFlags(flag plugin.FlagSet) flagsInstalled { f := flagsInstalled{ ints: make(map[string]*int), bools: make(map[string]*bool), floats: make(map[string]*float64), strings: make(map[string]*string), } for n, v := range pprofVariables { switch v.kind { case boolKind: if v.group != "" { ...
go
func installFlags(flag plugin.FlagSet) flagsInstalled { f := flagsInstalled{ ints: make(map[string]*int), bools: make(map[string]*bool), floats: make(map[string]*float64), strings: make(map[string]*string), } for n, v := range pprofVariables { switch v.kind { case boolKind: if v.group != "" { ...
[ "func", "installFlags", "(", "flag", "plugin", ".", "FlagSet", ")", "flagsInstalled", "{", "f", ":=", "flagsInstalled", "{", "ints", ":", "make", "(", "map", "[", "string", "]", "*", "int", ")", ",", "bools", ":", "make", "(", "map", "[", "string", "...
// installFlags creates command line flags for pprof variables.
[ "installFlags", "creates", "command", "line", "flags", "for", "pprof", "variables", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/cli.go#L198-L223
164,966
google/pprof
internal/driver/cli.go
updateFlags
func updateFlags(f flagsInstalled) error { vars := pprofVariables groups := map[string]string{} for n, v := range f.bools { vars.set(n, fmt.Sprint(*v)) if *v { g := vars[n].group if g != "" && groups[g] != "" { return fmt.Errorf("conflicting options %q and %q set", n, groups[g]) } groups[g] = n ...
go
func updateFlags(f flagsInstalled) error { vars := pprofVariables groups := map[string]string{} for n, v := range f.bools { vars.set(n, fmt.Sprint(*v)) if *v { g := vars[n].group if g != "" && groups[g] != "" { return fmt.Errorf("conflicting options %q and %q set", n, groups[g]) } groups[g] = n ...
[ "func", "updateFlags", "(", "f", "flagsInstalled", ")", "error", "{", "vars", ":=", "pprofVariables", "\n", "groups", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "n", ",", "v", ":=", "range", "f", ".", "bools", "{", "vars", ".",...
// updateFlags updates the pprof variables according to the flags // parsed in the command line.
[ "updateFlags", "updates", "the", "pprof", "variables", "according", "to", "the", "flags", "parsed", "in", "the", "command", "line", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/driver/cli.go#L227-L250
164,967
google/pprof
internal/graph/graph.go
FlatValue
func (n *Node) FlatValue() int64 { if n.FlatDiv == 0 { return n.Flat } return n.Flat / n.FlatDiv }
go
func (n *Node) FlatValue() int64 { if n.FlatDiv == 0 { return n.Flat } return n.Flat / n.FlatDiv }
[ "func", "(", "n", "*", "Node", ")", "FlatValue", "(", ")", "int64", "{", "if", "n", ".", "FlatDiv", "==", "0", "{", "return", "n", ".", "Flat", "\n", "}", "\n", "return", "n", ".", "Flat", "/", "n", ".", "FlatDiv", "\n", "}" ]
// FlatValue returns the exclusive value for this node, computing the // mean if a divisor is available.
[ "FlatValue", "returns", "the", "exclusive", "value", "for", "this", "node", "computing", "the", "mean", "if", "a", "divisor", "is", "available", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L92-L97
164,968
google/pprof
internal/graph/graph.go
CumValue
func (n *Node) CumValue() int64 { if n.CumDiv == 0 { return n.Cum } return n.Cum / n.CumDiv }
go
func (n *Node) CumValue() int64 { if n.CumDiv == 0 { return n.Cum } return n.Cum / n.CumDiv }
[ "func", "(", "n", "*", "Node", ")", "CumValue", "(", ")", "int64", "{", "if", "n", ".", "CumDiv", "==", "0", "{", "return", "n", ".", "Cum", "\n", "}", "\n", "return", "n", ".", "Cum", "/", "n", ".", "CumDiv", "\n", "}" ]
// CumValue returns the inclusive value for this node, computing the // mean if a divisor is available.
[ "CumValue", "returns", "the", "inclusive", "value", "for", "this", "node", "computing", "the", "mean", "if", "a", "divisor", "is", "available", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L101-L106
164,969
google/pprof
internal/graph/graph.go
AddToEdge
func (n *Node) AddToEdge(to *Node, v int64, residual, inline bool) { n.AddToEdgeDiv(to, 0, v, residual, inline) }
go
func (n *Node) AddToEdge(to *Node, v int64, residual, inline bool) { n.AddToEdgeDiv(to, 0, v, residual, inline) }
[ "func", "(", "n", "*", "Node", ")", "AddToEdge", "(", "to", "*", "Node", ",", "v", "int64", ",", "residual", ",", "inline", "bool", ")", "{", "n", ".", "AddToEdgeDiv", "(", "to", ",", "0", ",", "v", ",", "residual", ",", "inline", ")", "\n", "}...
// AddToEdge increases the weight of an edge between two nodes. If // there isn't such an edge one is created.
[ "AddToEdge", "increases", "the", "weight", "of", "an", "edge", "between", "two", "nodes", ".", "If", "there", "isn", "t", "such", "an", "edge", "one", "is", "created", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L110-L112
164,970
google/pprof
internal/graph/graph.go
AddToEdgeDiv
func (n *Node) AddToEdgeDiv(to *Node, dv, v int64, residual, inline bool) { if n.Out[to] != to.In[n] { panic(fmt.Errorf("asymmetric edges %v %v", *n, *to)) } if e := n.Out[to]; e != nil { e.WeightDiv += dv e.Weight += v if residual { e.Residual = true } if !inline { e.Inline = false } return ...
go
func (n *Node) AddToEdgeDiv(to *Node, dv, v int64, residual, inline bool) { if n.Out[to] != to.In[n] { panic(fmt.Errorf("asymmetric edges %v %v", *n, *to)) } if e := n.Out[to]; e != nil { e.WeightDiv += dv e.Weight += v if residual { e.Residual = true } if !inline { e.Inline = false } return ...
[ "func", "(", "n", "*", "Node", ")", "AddToEdgeDiv", "(", "to", "*", "Node", ",", "dv", ",", "v", "int64", ",", "residual", ",", "inline", "bool", ")", "{", "if", "n", ".", "Out", "[", "to", "]", "!=", "to", ".", "In", "[", "n", "]", "{", "p...
// AddToEdgeDiv increases the weight of an edge between two nodes. If // there isn't such an edge one is created.
[ "AddToEdgeDiv", "increases", "the", "weight", "of", "an", "edge", "between", "two", "nodes", ".", "If", "there", "isn", "t", "such", "an", "edge", "one", "is", "created", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L116-L136
164,971
google/pprof
internal/graph/graph.go
NameComponents
func (i *NodeInfo) NameComponents() []string { var name []string if i.Address != 0 { name = append(name, fmt.Sprintf("%016x", i.Address)) } if fun := i.Name; fun != "" { name = append(name, fun) } switch { case i.Lineno != 0: // User requested line numbers, provide what we have. name = append(name, fmt....
go
func (i *NodeInfo) NameComponents() []string { var name []string if i.Address != 0 { name = append(name, fmt.Sprintf("%016x", i.Address)) } if fun := i.Name; fun != "" { name = append(name, fun) } switch { case i.Lineno != 0: // User requested line numbers, provide what we have. name = append(name, fmt....
[ "func", "(", "i", "*", "NodeInfo", ")", "NameComponents", "(", ")", "[", "]", "string", "{", "var", "name", "[", "]", "string", "\n", "if", "i", ".", "Address", "!=", "0", "{", "name", "=", "append", "(", "name", ",", "fmt", ".", "Sprintf", "(", ...
// NameComponents returns the components of the printable name to be used for a node.
[ "NameComponents", "returns", "the", "components", "of", "the", "printable", "name", "to", "be", "used", "for", "a", "node", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L154-L180
164,972
google/pprof
internal/graph/graph.go
FindOrInsertNode
func (nm NodeMap) FindOrInsertNode(info NodeInfo, kept NodeSet) *Node { if kept != nil { if _, ok := kept[info]; !ok { return nil } } if n, ok := nm[info]; ok { return n } n := &Node{ Info: info, In: make(EdgeMap), Out: make(EdgeMap), LabelTags: make(TagMap), NumericT...
go
func (nm NodeMap) FindOrInsertNode(info NodeInfo, kept NodeSet) *Node { if kept != nil { if _, ok := kept[info]; !ok { return nil } } if n, ok := nm[info]; ok { return n } n := &Node{ Info: info, In: make(EdgeMap), Out: make(EdgeMap), LabelTags: make(TagMap), NumericT...
[ "func", "(", "nm", "NodeMap", ")", "FindOrInsertNode", "(", "info", "NodeInfo", ",", "kept", "NodeSet", ")", "*", "Node", "{", "if", "kept", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "kept", "[", "info", "]", ";", "!", "ok", "{", "return", "n...
// FindOrInsertNode takes the info for a node and either returns a matching node // from the node map if one exists, or adds one to the map if one does not. // If kept is non-nil, nodes are only added if they can be located on it.
[ "FindOrInsertNode", "takes", "the", "info", "for", "a", "node", "and", "either", "returns", "a", "matching", "node", "from", "the", "node", "map", "if", "one", "exists", "or", "adds", "one", "to", "the", "map", "if", "one", "does", "not", ".", "If", "k...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L202-L232
164,973
google/pprof
internal/graph/graph.go
WeightValue
func (e *Edge) WeightValue() int64 { if e.WeightDiv == 0 { return e.Weight } return e.Weight / e.WeightDiv }
go
func (e *Edge) WeightValue() int64 { if e.WeightDiv == 0 { return e.Weight } return e.Weight / e.WeightDiv }
[ "func", "(", "e", "*", "Edge", ")", "WeightValue", "(", ")", "int64", "{", "if", "e", ".", "WeightDiv", "==", "0", "{", "return", "e", ".", "Weight", "\n", "}", "\n", "return", "e", ".", "Weight", "/", "e", ".", "WeightDiv", "\n", "}" ]
// WeightValue returns the weight value for this edge, normalizing if a // divisor is available.
[ "WeightValue", "returns", "the", "weight", "value", "for", "this", "edge", "normalizing", "if", "a", "divisor", "is", "available", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L252-L257
164,974
google/pprof
internal/graph/graph.go
FlatValue
func (t *Tag) FlatValue() int64 { if t.FlatDiv == 0 { return t.Flat } return t.Flat / t.FlatDiv }
go
func (t *Tag) FlatValue() int64 { if t.FlatDiv == 0 { return t.Flat } return t.Flat / t.FlatDiv }
[ "func", "(", "t", "*", "Tag", ")", "FlatValue", "(", ")", "int64", "{", "if", "t", ".", "FlatDiv", "==", "0", "{", "return", "t", ".", "Flat", "\n", "}", "\n", "return", "t", ".", "Flat", "/", "t", ".", "FlatDiv", "\n", "}" ]
// FlatValue returns the exclusive value for this tag, computing the // mean if a divisor is available.
[ "FlatValue", "returns", "the", "exclusive", "value", "for", "this", "tag", "computing", "the", "mean", "if", "a", "divisor", "is", "available", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L270-L275
164,975
google/pprof
internal/graph/graph.go
CumValue
func (t *Tag) CumValue() int64 { if t.CumDiv == 0 { return t.Cum } return t.Cum / t.CumDiv }
go
func (t *Tag) CumValue() int64 { if t.CumDiv == 0 { return t.Cum } return t.Cum / t.CumDiv }
[ "func", "(", "t", "*", "Tag", ")", "CumValue", "(", ")", "int64", "{", "if", "t", ".", "CumDiv", "==", "0", "{", "return", "t", ".", "Cum", "\n", "}", "\n", "return", "t", ".", "Cum", "/", "t", ".", "CumDiv", "\n", "}" ]
// CumValue returns the inclusive value for this tag, computing the // mean if a divisor is available.
[ "CumValue", "returns", "the", "inclusive", "value", "for", "this", "tag", "computing", "the", "mean", "if", "a", "divisor", "is", "available", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L279-L284
164,976
google/pprof
internal/graph/graph.go
SortTags
func SortTags(t []*Tag, flat bool) []*Tag { ts := tags{t, flat} sort.Sort(ts) return ts.t }
go
func SortTags(t []*Tag, flat bool) []*Tag { ts := tags{t, flat} sort.Sort(ts) return ts.t }
[ "func", "SortTags", "(", "t", "[", "]", "*", "Tag", ",", "flat", "bool", ")", "[", "]", "*", "Tag", "{", "ts", ":=", "tags", "{", "t", ",", "flat", "}", "\n", "sort", ".", "Sort", "(", "ts", ")", "\n", "return", "ts", ".", "t", "\n", "}" ]
// SortTags sorts a slice of tags based on their weight.
[ "SortTags", "sorts", "a", "slice", "of", "tags", "based", "on", "their", "weight", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L290-L294
164,977
google/pprof
internal/graph/graph.go
New
func New(prof *profile.Profile, o *Options) *Graph { if o.CallTree { return newTree(prof, o) } g, _ := newGraph(prof, o) return g }
go
func New(prof *profile.Profile, o *Options) *Graph { if o.CallTree { return newTree(prof, o) } g, _ := newGraph(prof, o) return g }
[ "func", "New", "(", "prof", "*", "profile", ".", "Profile", ",", "o", "*", "Options", ")", "*", "Graph", "{", "if", "o", ".", "CallTree", "{", "return", "newTree", "(", "prof", ",", "o", ")", "\n", "}", "\n", "g", ",", "_", ":=", "newGraph", "(...
// New summarizes performance data from a profile into a graph.
[ "New", "summarizes", "performance", "data", "from", "a", "profile", "into", "a", "graph", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L297-L303
164,978
google/pprof
internal/graph/graph.go
newGraph
func newGraph(prof *profile.Profile, o *Options) (*Graph, map[uint64]Nodes) { nodes, locationMap := CreateNodes(prof, o) for _, sample := range prof.Sample { var w, dw int64 w = o.SampleValue(sample.Value) if o.SampleMeanDivisor != nil { dw = o.SampleMeanDivisor(sample.Value) } if dw == 0 && w == 0 { ...
go
func newGraph(prof *profile.Profile, o *Options) (*Graph, map[uint64]Nodes) { nodes, locationMap := CreateNodes(prof, o) for _, sample := range prof.Sample { var w, dw int64 w = o.SampleValue(sample.Value) if o.SampleMeanDivisor != nil { dw = o.SampleMeanDivisor(sample.Value) } if dw == 0 && w == 0 { ...
[ "func", "newGraph", "(", "prof", "*", "profile", ".", "Profile", ",", "o", "*", "Options", ")", "(", "*", "Graph", ",", "map", "[", "uint64", "]", "Nodes", ")", "{", "nodes", ",", "locationMap", ":=", "CreateNodes", "(", "prof", ",", "o", ")", "\n"...
// newGraph computes a graph from a profile. It returns the graph, and // a map from the profile location indices to the corresponding graph // nodes.
[ "newGraph", "computes", "a", "graph", "from", "a", "profile", ".", "It", "returns", "the", "graph", "and", "a", "map", "from", "the", "profile", "location", "indices", "to", "the", "corresponding", "graph", "nodes", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L308-L357
164,979
google/pprof
internal/graph/graph.go
ShortenFunctionName
func ShortenFunctionName(f string) string { for _, re := range []*regexp.Regexp{goRegExp, javaRegExp, cppRegExp} { if matches := re.FindStringSubmatch(f); len(matches) >= 2 { return strings.Join(matches[1:], "") } } return f }
go
func ShortenFunctionName(f string) string { for _, re := range []*regexp.Regexp{goRegExp, javaRegExp, cppRegExp} { if matches := re.FindStringSubmatch(f); len(matches) >= 2 { return strings.Join(matches[1:], "") } } return f }
[ "func", "ShortenFunctionName", "(", "f", "string", ")", "string", "{", "for", "_", ",", "re", ":=", "range", "[", "]", "*", "regexp", ".", "Regexp", "{", "goRegExp", ",", "javaRegExp", ",", "cppRegExp", "}", "{", "if", "matches", ":=", "re", ".", "Fi...
// ShortenFunctionName returns a shortened version of a function's name.
[ "ShortenFunctionName", "returns", "a", "shortened", "version", "of", "a", "function", "s", "name", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L431-L438
164,980
google/pprof
internal/graph/graph.go
TrimTree
func (g *Graph) TrimTree(kept NodePtrSet) { // Creates a new list of nodes oldNodes := g.Nodes g.Nodes = make(Nodes, 0, len(kept)) for _, cur := range oldNodes { // A node may not have multiple parents if len(cur.In) > 1 { panic("TrimTree only works on trees") } // If a node should be kept, add it to t...
go
func (g *Graph) TrimTree(kept NodePtrSet) { // Creates a new list of nodes oldNodes := g.Nodes g.Nodes = make(Nodes, 0, len(kept)) for _, cur := range oldNodes { // A node may not have multiple parents if len(cur.In) > 1 { panic("TrimTree only works on trees") } // If a node should be kept, add it to t...
[ "func", "(", "g", "*", "Graph", ")", "TrimTree", "(", "kept", "NodePtrSet", ")", "{", "// Creates a new list of nodes", "oldNodes", ":=", "g", ".", "Nodes", "\n", "g", ".", "Nodes", "=", "make", "(", "Nodes", ",", "0", ",", "len", "(", "kept", ")", "...
// TrimTree trims a Graph in forest form, keeping only the nodes in kept. This // will not work correctly if even a single node has multiple parents.
[ "TrimTree", "trims", "a", "Graph", "in", "forest", "form", "keeping", "only", "the", "nodes", "in", "kept", ".", "This", "will", "not", "work", "correctly", "if", "even", "a", "single", "node", "has", "multiple", "parents", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L442-L500
164,981
google/pprof
internal/graph/graph.go
isNegative
func isNegative(n *Node) bool { switch { case n.Flat < 0: return true case n.Flat == 0 && n.Cum < 0: return true default: return false } }
go
func isNegative(n *Node) bool { switch { case n.Flat < 0: return true case n.Flat == 0 && n.Cum < 0: return true default: return false } }
[ "func", "isNegative", "(", "n", "*", "Node", ")", "bool", "{", "switch", "{", "case", "n", ".", "Flat", "<", "0", ":", "return", "true", "\n", "case", "n", ".", "Flat", "==", "0", "&&", "n", ".", "Cum", "<", "0", ":", "return", "true", "\n", ...
// isNegative returns true if the node is considered as "negative" for the // purposes of drop_negative.
[ "isNegative", "returns", "true", "if", "the", "node", "is", "considered", "as", "negative", "for", "the", "purposes", "of", "drop_negative", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L519-L528
164,982
google/pprof
internal/graph/graph.go
Sum
func (ns Nodes) Sum() (flat int64, cum int64) { for _, n := range ns { flat += n.Flat cum += n.Cum } return }
go
func (ns Nodes) Sum() (flat int64, cum int64) { for _, n := range ns { flat += n.Flat cum += n.Cum } return }
[ "func", "(", "ns", "Nodes", ")", "Sum", "(", ")", "(", "flat", "int64", ",", "cum", "int64", ")", "{", "for", "_", ",", "n", ":=", "range", "ns", "{", "flat", "+=", "n", ".", "Flat", "\n", "cum", "+=", "n", ".", "Cum", "\n", "}", "\n", "ret...
// Sum adds the flat and cum values of a set of nodes.
[ "Sum", "adds", "the", "flat", "and", "cum", "values", "of", "a", "set", "of", "nodes", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L612-L618
164,983
google/pprof
internal/graph/graph.go
String
func (g *Graph) String() string { var s []string nodeIndex := make(map[*Node]int, len(g.Nodes)) for i, n := range g.Nodes { nodeIndex[n] = i + 1 } for i, n := range g.Nodes { name := n.Info.PrintableName() var in, out []int for _, from := range n.In { in = append(in, nodeIndex[from.Src]) } for _...
go
func (g *Graph) String() string { var s []string nodeIndex := make(map[*Node]int, len(g.Nodes)) for i, n := range g.Nodes { nodeIndex[n] = i + 1 } for i, n := range g.Nodes { name := n.Info.PrintableName() var in, out []int for _, from := range n.In { in = append(in, nodeIndex[from.Src]) } for _...
[ "func", "(", "g", "*", "Graph", ")", "String", "(", ")", "string", "{", "var", "s", "[", "]", "string", "\n\n", "nodeIndex", ":=", "make", "(", "map", "[", "*", "Node", "]", "int", ",", "len", "(", "g", ".", "Nodes", ")", ")", "\n\n", "for", ...
// String returns a text representation of a graph, for debugging purposes.
[ "String", "returns", "a", "text", "representation", "of", "a", "graph", "for", "debugging", "purposes", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L689-L711
164,984
google/pprof
internal/graph/graph.go
DiscardLowFrequencyNodes
func (g *Graph) DiscardLowFrequencyNodes(nodeCutoff int64) NodeSet { return makeNodeSet(g.Nodes, nodeCutoff) }
go
func (g *Graph) DiscardLowFrequencyNodes(nodeCutoff int64) NodeSet { return makeNodeSet(g.Nodes, nodeCutoff) }
[ "func", "(", "g", "*", "Graph", ")", "DiscardLowFrequencyNodes", "(", "nodeCutoff", "int64", ")", "NodeSet", "{", "return", "makeNodeSet", "(", "g", ".", "Nodes", ",", "nodeCutoff", ")", "\n", "}" ]
// DiscardLowFrequencyNodes returns a set of the nodes at or over a // specific cum value cutoff.
[ "DiscardLowFrequencyNodes", "returns", "a", "set", "of", "the", "nodes", "at", "or", "over", "a", "specific", "cum", "value", "cutoff", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L715-L717
164,985
google/pprof
internal/graph/graph.go
DiscardLowFrequencyNodePtrs
func (g *Graph) DiscardLowFrequencyNodePtrs(nodeCutoff int64) NodePtrSet { cutNodes := getNodesAboveCumCutoff(g.Nodes, nodeCutoff) kept := make(NodePtrSet, len(cutNodes)) for _, n := range cutNodes { kept[n] = true } return kept }
go
func (g *Graph) DiscardLowFrequencyNodePtrs(nodeCutoff int64) NodePtrSet { cutNodes := getNodesAboveCumCutoff(g.Nodes, nodeCutoff) kept := make(NodePtrSet, len(cutNodes)) for _, n := range cutNodes { kept[n] = true } return kept }
[ "func", "(", "g", "*", "Graph", ")", "DiscardLowFrequencyNodePtrs", "(", "nodeCutoff", "int64", ")", "NodePtrSet", "{", "cutNodes", ":=", "getNodesAboveCumCutoff", "(", "g", ".", "Nodes", ",", "nodeCutoff", ")", "\n", "kept", ":=", "make", "(", "NodePtrSet", ...
// DiscardLowFrequencyNodePtrs returns a NodePtrSet of nodes at or over a // specific cum value cutoff.
[ "DiscardLowFrequencyNodePtrs", "returns", "a", "NodePtrSet", "of", "nodes", "at", "or", "over", "a", "specific", "cum", "value", "cutoff", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L721-L728
164,986
google/pprof
internal/graph/graph.go
getNodesAboveCumCutoff
func getNodesAboveCumCutoff(nodes Nodes, nodeCutoff int64) Nodes { cutoffNodes := make(Nodes, 0, len(nodes)) for _, n := range nodes { if abs64(n.Cum) < nodeCutoff { continue } cutoffNodes = append(cutoffNodes, n) } return cutoffNodes }
go
func getNodesAboveCumCutoff(nodes Nodes, nodeCutoff int64) Nodes { cutoffNodes := make(Nodes, 0, len(nodes)) for _, n := range nodes { if abs64(n.Cum) < nodeCutoff { continue } cutoffNodes = append(cutoffNodes, n) } return cutoffNodes }
[ "func", "getNodesAboveCumCutoff", "(", "nodes", "Nodes", ",", "nodeCutoff", "int64", ")", "Nodes", "{", "cutoffNodes", ":=", "make", "(", "Nodes", ",", "0", ",", "len", "(", "nodes", ")", ")", "\n", "for", "_", ",", "n", ":=", "range", "nodes", "{", ...
// getNodesAboveCumCutoff returns all the nodes which have a Cum value greater // than or equal to cutoff.
[ "getNodesAboveCumCutoff", "returns", "all", "the", "nodes", "which", "have", "a", "Cum", "value", "greater", "than", "or", "equal", "to", "cutoff", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L741-L750
164,987
google/pprof
internal/graph/graph.go
TrimLowFrequencyTags
func (g *Graph) TrimLowFrequencyTags(tagCutoff int64) { // Remove nodes with value <= total*nodeFraction for _, n := range g.Nodes { n.LabelTags = trimLowFreqTags(n.LabelTags, tagCutoff) for s, nt := range n.NumericTags { n.NumericTags[s] = trimLowFreqTags(nt, tagCutoff) } } }
go
func (g *Graph) TrimLowFrequencyTags(tagCutoff int64) { // Remove nodes with value <= total*nodeFraction for _, n := range g.Nodes { n.LabelTags = trimLowFreqTags(n.LabelTags, tagCutoff) for s, nt := range n.NumericTags { n.NumericTags[s] = trimLowFreqTags(nt, tagCutoff) } } }
[ "func", "(", "g", "*", "Graph", ")", "TrimLowFrequencyTags", "(", "tagCutoff", "int64", ")", "{", "// Remove nodes with value <= total*nodeFraction", "for", "_", ",", "n", ":=", "range", "g", ".", "Nodes", "{", "n", ".", "LabelTags", "=", "trimLowFreqTags", "(...
// TrimLowFrequencyTags removes tags that have less than // the specified weight.
[ "TrimLowFrequencyTags", "removes", "tags", "that", "have", "less", "than", "the", "specified", "weight", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L754-L762
164,988
google/pprof
internal/graph/graph.go
TrimLowFrequencyEdges
func (g *Graph) TrimLowFrequencyEdges(edgeCutoff int64) int { var droppedEdges int for _, n := range g.Nodes { for src, e := range n.In { if abs64(e.Weight) < edgeCutoff { delete(n.In, src) delete(src.Out, n) droppedEdges++ } } } return droppedEdges }
go
func (g *Graph) TrimLowFrequencyEdges(edgeCutoff int64) int { var droppedEdges int for _, n := range g.Nodes { for src, e := range n.In { if abs64(e.Weight) < edgeCutoff { delete(n.In, src) delete(src.Out, n) droppedEdges++ } } } return droppedEdges }
[ "func", "(", "g", "*", "Graph", ")", "TrimLowFrequencyEdges", "(", "edgeCutoff", "int64", ")", "int", "{", "var", "droppedEdges", "int", "\n", "for", "_", ",", "n", ":=", "range", "g", ".", "Nodes", "{", "for", "src", ",", "e", ":=", "range", "n", ...
// TrimLowFrequencyEdges removes edges that have less than // the specified weight. Returns the number of edges removed
[ "TrimLowFrequencyEdges", "removes", "edges", "that", "have", "less", "than", "the", "specified", "weight", ".", "Returns", "the", "number", "of", "edges", "removed" ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L776-L788
164,989
google/pprof
internal/graph/graph.go
SortNodes
func (g *Graph) SortNodes(cum bool, visualMode bool) { // Sort nodes based on requested mode switch { case visualMode: // Specialized sort to produce a more visually-interesting graph g.Nodes.Sort(EntropyOrder) case cum: g.Nodes.Sort(CumNameOrder) default: g.Nodes.Sort(FlatNameOrder) } }
go
func (g *Graph) SortNodes(cum bool, visualMode bool) { // Sort nodes based on requested mode switch { case visualMode: // Specialized sort to produce a more visually-interesting graph g.Nodes.Sort(EntropyOrder) case cum: g.Nodes.Sort(CumNameOrder) default: g.Nodes.Sort(FlatNameOrder) } }
[ "func", "(", "g", "*", "Graph", ")", "SortNodes", "(", "cum", "bool", ",", "visualMode", "bool", ")", "{", "// Sort nodes based on requested mode", "switch", "{", "case", "visualMode", ":", "// Specialized sort to produce a more visually-interesting graph", "g", ".", ...
// SortNodes sorts the nodes in a graph based on a specific heuristic.
[ "SortNodes", "sorts", "the", "nodes", "in", "a", "graph", "based", "on", "a", "specific", "heuristic", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L791-L802
164,990
google/pprof
internal/graph/graph.go
SelectTopNodes
func (g *Graph) SelectTopNodes(maxNodes int, visualMode bool) NodeSet { return makeNodeSet(g.selectTopNodes(maxNodes, visualMode), 0) }
go
func (g *Graph) SelectTopNodes(maxNodes int, visualMode bool) NodeSet { return makeNodeSet(g.selectTopNodes(maxNodes, visualMode), 0) }
[ "func", "(", "g", "*", "Graph", ")", "SelectTopNodes", "(", "maxNodes", "int", ",", "visualMode", "bool", ")", "NodeSet", "{", "return", "makeNodeSet", "(", "g", ".", "selectTopNodes", "(", "maxNodes", ",", "visualMode", ")", ",", "0", ")", "\n", "}" ]
// SelectTopNodes returns a set of the top maxNodes nodes in a graph.
[ "SelectTopNodes", "returns", "a", "set", "of", "the", "top", "maxNodes", "nodes", "in", "a", "graph", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L814-L816
164,991
google/pprof
internal/graph/graph.go
selectTopNodes
func (g *Graph) selectTopNodes(maxNodes int, visualMode bool) Nodes { if maxNodes > 0 { if visualMode { var count int // If generating a visual graph, count tags as nodes. Update // maxNodes to account for them. for i, n := range g.Nodes { tags := countTags(n) if tags > maxNodelets { tags = ...
go
func (g *Graph) selectTopNodes(maxNodes int, visualMode bool) Nodes { if maxNodes > 0 { if visualMode { var count int // If generating a visual graph, count tags as nodes. Update // maxNodes to account for them. for i, n := range g.Nodes { tags := countTags(n) if tags > maxNodelets { tags = ...
[ "func", "(", "g", "*", "Graph", ")", "selectTopNodes", "(", "maxNodes", "int", ",", "visualMode", "bool", ")", "Nodes", "{", "if", "maxNodes", ">", "0", "{", "if", "visualMode", "{", "var", "count", "int", "\n", "// If generating a visual graph, count tags as ...
// selectTopNodes returns a slice of the top maxNodes nodes in a graph.
[ "selectTopNodes", "returns", "a", "slice", "of", "the", "top", "maxNodes", "nodes", "in", "a", "graph", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L819-L841
164,992
google/pprof
internal/graph/graph.go
countTags
func countTags(n *Node) int { count := 0 for _, e := range n.LabelTags { if e.Flat != 0 { count++ } } for _, t := range n.NumericTags { for _, e := range t { if e.Flat != 0 { count++ } } } return count }
go
func countTags(n *Node) int { count := 0 for _, e := range n.LabelTags { if e.Flat != 0 { count++ } } for _, t := range n.NumericTags { for _, e := range t { if e.Flat != 0 { count++ } } } return count }
[ "func", "countTags", "(", "n", "*", "Node", ")", "int", "{", "count", ":=", "0", "\n", "for", "_", ",", "e", ":=", "range", "n", ".", "LabelTags", "{", "if", "e", ".", "Flat", "!=", "0", "{", "count", "++", "\n", "}", "\n", "}", "\n", "for", ...
// countTags counts the tags with flat count. This underestimates the // number of tags being displayed, but in practice is close enough.
[ "countTags", "counts", "the", "tags", "with", "flat", "count", ".", "This", "underestimates", "the", "number", "of", "tags", "being", "displayed", "but", "in", "practice", "is", "close", "enough", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L845-L860
164,993
google/pprof
internal/graph/graph.go
RemoveRedundantEdges
func (g *Graph) RemoveRedundantEdges() { // Walk the nodes and outgoing edges in reverse order to prefer // removing edges with the lowest weight. for i := len(g.Nodes); i > 0; i-- { n := g.Nodes[i-1] in := n.In.Sort() for j := len(in); j > 0; j-- { e := in[j-1] if !e.Residual { // Do not remove edge...
go
func (g *Graph) RemoveRedundantEdges() { // Walk the nodes and outgoing edges in reverse order to prefer // removing edges with the lowest weight. for i := len(g.Nodes); i > 0; i-- { n := g.Nodes[i-1] in := n.In.Sort() for j := len(in); j > 0; j-- { e := in[j-1] if !e.Residual { // Do not remove edge...
[ "func", "(", "g", "*", "Graph", ")", "RemoveRedundantEdges", "(", ")", "{", "// Walk the nodes and outgoing edges in reverse order to prefer", "// removing edges with the lowest weight.", "for", "i", ":=", "len", "(", "g", ".", "Nodes", ")", ";", "i", ">", "0", ";",...
// RemoveRedundantEdges removes residual edges if the destination can // be reached through another path. This is done to simplify the graph // while preserving connectivity.
[ "RemoveRedundantEdges", "removes", "residual", "edges", "if", "the", "destination", "can", "be", "reached", "through", "another", "path", ".", "This", "is", "done", "to", "simplify", "the", "graph", "while", "preserving", "connectivity", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L865-L884
164,994
google/pprof
internal/graph/graph.go
isRedundantEdge
func isRedundantEdge(e *Edge) bool { src, n := e.Src, e.Dest seen := map[*Node]bool{n: true} queue := Nodes{n} for len(queue) > 0 { n := queue[0] queue = queue[1:] for _, ie := range n.In { if e == ie || seen[ie.Src] { continue } if ie.Src == src { return true } seen[ie.Src] = true q...
go
func isRedundantEdge(e *Edge) bool { src, n := e.Src, e.Dest seen := map[*Node]bool{n: true} queue := Nodes{n} for len(queue) > 0 { n := queue[0] queue = queue[1:] for _, ie := range n.In { if e == ie || seen[ie.Src] { continue } if ie.Src == src { return true } seen[ie.Src] = true q...
[ "func", "isRedundantEdge", "(", "e", "*", "Edge", ")", "bool", "{", "src", ",", "n", ":=", "e", ".", "Src", ",", "e", ".", "Dest", "\n", "seen", ":=", "map", "[", "*", "Node", "]", "bool", "{", "n", ":", "true", "}", "\n", "queue", ":=", "Nod...
// isRedundantEdge determines if there is a path that allows e.Src // to reach e.Dest after removing e.
[ "isRedundantEdge", "determines", "if", "there", "is", "a", "path", "that", "allows", "e", ".", "Src", "to", "reach", "e", ".", "Dest", "after", "removing", "e", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L888-L907
164,995
google/pprof
internal/graph/graph.go
compareNodes
func compareNodes(l, r *Node) bool { return fmt.Sprint(l.Info) < fmt.Sprint(r.Info) }
go
func compareNodes(l, r *Node) bool { return fmt.Sprint(l.Info) < fmt.Sprint(r.Info) }
[ "func", "compareNodes", "(", "l", ",", "r", "*", "Node", ")", "bool", "{", "return", "fmt", ".", "Sprint", "(", "l", ".", "Info", ")", "<", "fmt", ".", "Sprint", "(", "r", ".", "Info", ")", "\n", "}" ]
// compareNodes compares two nodes to provide a deterministic ordering // between them. Two nodes cannot have the same Node.Info value.
[ "compareNodes", "compares", "two", "nodes", "to", "provide", "a", "deterministic", "ordering", "between", "them", ".", "Two", "nodes", "cannot", "have", "the", "same", "Node", ".", "Info", "value", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L1027-L1029
164,996
google/pprof
internal/graph/graph.go
Sum
func (e EdgeMap) Sum() int64 { var ret int64 for _, edge := range e { ret += edge.Weight } return ret }
go
func (e EdgeMap) Sum() int64 { var ret int64 for _, edge := range e { ret += edge.Weight } return ret }
[ "func", "(", "e", "EdgeMap", ")", "Sum", "(", ")", "int64", "{", "var", "ret", "int64", "\n", "for", "_", ",", "edge", ":=", "range", "e", "{", "ret", "+=", "edge", ".", "Weight", "\n", "}", "\n", "return", "ret", "\n", "}" ]
// Sum returns the total weight for a set of nodes.
[ "Sum", "returns", "the", "total", "weight", "for", "a", "set", "of", "nodes", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/graph/graph.go#L1110-L1116
164,997
google/pprof
internal/elfexec/elfexec.go
parseNotes
func parseNotes(reader io.Reader, alignment int, order binary.ByteOrder) ([]elfNote, error) { r := bufio.NewReader(reader) // padding returns the number of bytes required to pad the given size to an // alignment boundary. padding := func(size int) int { return ((size + (alignment - 1)) &^ (alignment - 1)) - size...
go
func parseNotes(reader io.Reader, alignment int, order binary.ByteOrder) ([]elfNote, error) { r := bufio.NewReader(reader) // padding returns the number of bytes required to pad the given size to an // alignment boundary. padding := func(size int) int { return ((size + (alignment - 1)) &^ (alignment - 1)) - size...
[ "func", "parseNotes", "(", "reader", "io", ".", "Reader", ",", "alignment", "int", ",", "order", "binary", ".", "ByteOrder", ")", "(", "[", "]", "elfNote", ",", "error", ")", "{", "r", ":=", "bufio", ".", "NewReader", "(", "reader", ")", "\n\n", "// ...
// parseNotes returns the notes from a SHT_NOTE section or PT_NOTE segment.
[ "parseNotes", "returns", "the", "notes", "from", "a", "SHT_NOTE", "section", "or", "PT_NOTE", "segment", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/elfexec/elfexec.go#L39-L115
164,998
google/pprof
internal/elfexec/elfexec.go
GetBase
func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint64, start, limit, offset uint64) (uint64, error) { const ( pageSize = 4096 // PAGE_OFFSET for PowerPC64, see arch/powerpc/Kconfig in the kernel sources. pageOffsetPpc64 = 0xc000000000000000 ) if start == 0 && offset == 0 && (limit ...
go
func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint64, start, limit, offset uint64) (uint64, error) { const ( pageSize = 4096 // PAGE_OFFSET for PowerPC64, see arch/powerpc/Kconfig in the kernel sources. pageOffsetPpc64 = 0xc000000000000000 ) if start == 0 && offset == 0 && (limit ...
[ "func", "GetBase", "(", "fh", "*", "elf", ".", "FileHeader", ",", "loadSegment", "*", "elf", ".", "ProgHeader", ",", "stextOffset", "*", "uint64", ",", "start", ",", "limit", ",", "offset", "uint64", ")", "(", "uint64", ",", "error", ")", "{", "const",...
// GetBase determines the base address to subtract from virtual // address to get symbol table address. For an executable, the base // is 0. Otherwise, it's a shared library, and the base is the // address where the mapping starts. The kernel is special, and may // use the address of the _stext symbol as the mmap start...
[ "GetBase", "determines", "the", "base", "address", "to", "subtract", "from", "virtual", "address", "to", "get", "symbol", "table", "address", ".", "For", "an", "executable", "the", "base", "is", "0", ".", "Otherwise", "it", "s", "a", "shared", "library", "...
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/elfexec/elfexec.go#L174-L269
164,999
google/pprof
internal/elfexec/elfexec.go
FindTextProgHeader
func FindTextProgHeader(f *elf.File) *elf.ProgHeader { for _, s := range f.Sections { if s.Name == ".text" { // Find the LOAD segment containing the .text section. for _, p := range f.Progs { if p.Type == elf.PT_LOAD && p.Flags&elf.PF_X != 0 && s.Addr >= p.Vaddr && s.Addr < p.Vaddr+p.Memsz { return &p...
go
func FindTextProgHeader(f *elf.File) *elf.ProgHeader { for _, s := range f.Sections { if s.Name == ".text" { // Find the LOAD segment containing the .text section. for _, p := range f.Progs { if p.Type == elf.PT_LOAD && p.Flags&elf.PF_X != 0 && s.Addr >= p.Vaddr && s.Addr < p.Vaddr+p.Memsz { return &p...
[ "func", "FindTextProgHeader", "(", "f", "*", "elf", ".", "File", ")", "*", "elf", ".", "ProgHeader", "{", "for", "_", ",", "s", ":=", "range", "f", ".", "Sections", "{", "if", "s", ".", "Name", "==", "\"", "\"", "{", "// Find the LOAD segment containin...
// FindTextProgHeader finds the program segment header containing the .text // section or nil if the segment cannot be found.
[ "FindTextProgHeader", "finds", "the", "program", "segment", "header", "containing", "the", ".", "text", "section", "or", "nil", "if", "the", "segment", "cannot", "be", "found", "." ]
8358a9778bd1e48718ffcb96eb11ee061385bf62
https://github.com/google/pprof/blob/8358a9778bd1e48718ffcb96eb11ee061385bf62/internal/elfexec/elfexec.go#L273-L285