-[](https://travis-ci.org/google/pprof)
-[](https://codecov.io/gh/google/pprof)
-
# Introduction
pprof is a tool for visualization and analysis of profiling data.
Prerequisites:
-- Go development kit. Requires Go 1.7 or newer.
+- Go development kit. Known to work with Go 1.5.
Follow [these instructions](http://golang.org/doc/code.html) to install the
go tool and set up GOPATH.
go get github.com/google/pprof
-Remember to set GOPATH to the directory where you want pprof to be
-installed. The binary will be in $GOPATH/bin and the sources under
-$GOPATH/src/github.com/google/pprof.
-
# Basic usage
pprof can read a profile from a file or directly from a server via http.
// manager. Then it generates a report formatted according to the
// options selected through the flags package.
func PProf(o *Options) error {
- return internaldriver.PProf(o.internalOptions())
+ return internaldriver.PProf(o.InternalOptions())
}
-func (o *Options) internalOptions() *plugin.Options {
+func (o *Options) InternalOptions() *plugin.Options {
var obj plugin.ObjTool
if o.Obj != nil {
obj = &internalObjTool{o.Obj}
}
func (s *internalSymbolizer) Symbolize(mode string, srcs plugin.MappingSources, prof *profile.Profile) error {
- isrcs := MappingSources{}
+ isrcs := plugin.MappingSources{}
for m, s := range srcs {
isrcs[m] = s
}
- return s.Symbolizer.Symbolize(mode, isrcs, prof)
+ return s.Symbolize(mode, isrcs, prof)
}
func checkSymbol(got []*plugin.Sym, want []plugin.Sym) error {
if len(got) != len(want) {
- return fmt.Errorf("unexpected number of symbols %d (want %d)", len(got), len(want))
+ return fmt.Errorf("unexpected number of symbols %d (want %d)\n", len(got), len(want))
}
for i, g := range got {
},
}
+ const objdump = "testdata/wrapper/objdump"
+
for _, tc := range testcases {
insts, err := disassemble([]byte(tc.asm))
if err != nil {
"functions": &variable{boolKind, "t", "granularity", helpText(
"Aggregate at the function level.",
"Takes into account the filename/lineno where the function was defined.")},
+ "functionnameonly": &variable{boolKind, "f", "granularity", helpText(
+ "Aggregate at the function level.",
+ "Ignores the filename/lineno where the function was defined.")},
"files": &variable{boolKind, "f", "granularity", "Aggregate at the file level."},
"lines": &variable{boolKind, "f", "granularity", "Aggregate at the source code line level."},
"addresses": &variable{boolKind, "f", "granularity", helpText(
case boolKind:
var b bool
if b, err = stringToBool(value); err == nil {
- if v.group != "" && !b {
+ if v.group != "" && b == false {
err = fmt.Errorf("%q can only be set to true", name)
}
}
v.set("nodecount", "80")
}
}
- if !trim {
+ if trim == false {
v.set("nodecount", "0")
v.set("nodefraction", "0")
v.set("edgefraction", "0")
}
- if !focus {
+ if focus == false {
v.set("focus", "")
v.set("ignore", "")
}
- if !tagfocus {
+ if tagfocus == false {
v.set("tagfocus", "")
v.set("tagignore", "")
}
- if !hide {
+ if hide == false {
v.set("hide", "")
v.set("show", "")
}
case v["functions"].boolValue():
inlines = true
function = true
+ filename = true
case v["noinlines"].boolValue():
function = true
+ filename = true
case v["addressnoinlines"].boolValue():
function = true
filename = true
linenumber = true
address = true
+ case v["functionnameonly"].boolValue():
+ inlines = true
+ function = true
default:
return fmt.Errorf("unexpected granularity")
}
if prunefrom != nil {
prof.PruneFrom(prunefrom)
}
- return err
+ return nil
}
func compileRegexOption(name, value string, err error) (*regexp.Regexp, error) {
import (
"bytes"
- "flag"
"fmt"
"io/ioutil"
- "net"
- _ "net/http/pprof"
"os"
"regexp"
"runtime"
"github.com/google/pprof/profile"
)
-var updateFlag = flag.Bool("update", false, "Update the golden files")
-
func TestParse(t *testing.T) {
// Override weblist command to collect output in buffer
pprofCommands["weblist"].postProcess = nil
savePath := os.Getenv("PPROF_BINARY_PATH")
os.Setenv("PPROF_BINARY_PATH", "/path/to")
defer os.Setenv("PPROF_BINARY_PATH", savePath)
+
testcase := []struct {
flags, source string
}{
{"text,functions,flat", "cpu"},
{"tree,addresses,flat,nodecount=4", "cpusmall"},
- {"text,functions,flat,nodecount=5,call_tree", "unknown"},
+ {"text,functions,flat", "unknown"},
{"text,alloc_objects,flat", "heap_alloc"},
{"text,files,flat", "heap"},
{"text,inuse_objects,flat", "heap"},
{"tree,lines,cum,focus=[24]00", "heap"},
{"tree,relative_percentages,cum,focus=[24]00", "heap"},
{"callgrind", "cpu"},
- {"callgrind,call_tree", "cpu"},
{"callgrind", "heap"},
{"dot,functions,flat", "cpu"},
- {"dot,functions,flat,call_tree", "cpu"},
{"dot,lines,flat,focus=[12]00", "heap"},
{"dot,addresses,flat,ignore=[X3]002,focus=[X1]000", "contention"},
{"dot,files,cum", "contention"},
if err != nil {
t.Errorf("cannot create tempfile: %v", err)
}
- defer os.Remove(protoTempFile.Name())
defer protoTempFile.Close()
f.strings["output"] = protoTempFile.Name()
if err != nil {
t.Errorf("cannot create tempfile: %v", err)
}
- defer os.Remove(outputTempFile.Name())
defer outputTempFile.Close()
f.strings["output"] = outputTempFile.Name()
f.args = []string{protoTempFile.Name()}
t.Fatalf("diff %s %v", solution, err)
}
t.Errorf("%s\n%s\n", solution, d)
- if *updateFlag {
- err := ioutil.WriteFile(solution, b, 0644)
- if err != nil {
- t.Errorf("failed to update the solution file %q: %v", solution, err)
- }
- }
}
}
}
}
}
-func testSourceURL(port int) string {
- return fmt.Sprintf("http://%s/", net.JoinHostPort(testSourceAddress, strconv.Itoa(port)))
-}
-
// solutionFilename returns the name of the solution file for the test
func solutionFilename(source string, f *testFlags) string {
- name := []string{"pprof", strings.TrimPrefix(source, testSourceURL(8000))}
+ name := []string{"pprof", strings.TrimPrefix(source, "http://host:8000/")}
name = addString(name, f, []string{"flat", "cum"})
name = addString(name, f, []string{"functions", "files", "lines", "addresses"})
name = addString(name, f, []string{"inuse_space", "inuse_objects", "alloc_space", "alloc_objects"})
name = addString(name, f, []string{"relative_percentages"})
name = addString(name, f, []string{"seconds"})
- name = addString(name, f, []string{"call_tree"})
name = addString(name, f, []string{"text", "tree", "callgrind", "dot", "svg", "tags", "dot", "traces", "disasm", "peek", "weblist", "topproto", "comments"})
if f.strings["focus"] != "" || f.strings["tagfocus"] != "" {
name = append(name, "focus")
}
}
+type testProfile struct {
+}
+
const testStart = 0x1000
const testOffset = 0x5000
func (testFetcher) Fetch(s string, d, t time.Duration) (*profile.Profile, string, error) {
var p *profile.Profile
+ s = strings.TrimPrefix(s, "http://host:8000/")
switch s {
case "cpu", "unknown":
p = cpuProfile()
p = contentionProfile()
case "symbolz":
p = symzProfile()
+ case "http://host2/symbolz":
+ p = symzProfile()
+ p.Mapping[0].Start += testOffset
+ p.Mapping[0].Limit += testOffset
+ for i := range p.Location {
+ p.Location[i].Address += testOffset
+ }
default:
return nil, "", fmt.Errorf("unexpected source: %s", s)
}
- return p, testSourceURL(8000) + s, nil
+ return p, s, nil
}
type testSymbolizer struct{}
func testFetchSymbols(source, post string) ([]byte, error) {
var buf bytes.Buffer
- switch source {
- case testSourceURL(8000) + "symbolz":
- for _, address := range strings.Split(post, "+") {
- a, _ := strconv.ParseInt(address, 0, 64)
- fmt.Fprintf(&buf, "%v\t", address)
- if a-testStart > testOffset {
- fmt.Fprintf(&buf, "wrong_source_%v_", address)
- continue
- }
- fmt.Fprintf(&buf, "%#x\n", a-testStart)
- }
- return buf.Bytes(), nil
- case testSourceURL(8001) + "symbolz":
+ if source == "http://host2/symbolz" {
for _, address := range strings.Split(post, "+") {
a, _ := strconv.ParseInt(address, 0, 64)
fmt.Fprintf(&buf, "%v\t", address)
fmt.Fprintf(&buf, "%#x\n", a-testStart-testOffset)
}
return buf.Bytes(), nil
- default:
- return nil, fmt.Errorf("unexpected source: %s", source)
}
+ for _, address := range strings.Split(post, "+") {
+ a, _ := strconv.ParseInt(address, 0, 64)
+ fmt.Fprintf(&buf, "%v\t", address)
+ if a-testStart > testOffset {
+ fmt.Fprintf(&buf, "wrong_source_%v_", address)
+ continue
+ }
+ fmt.Fprintf(&buf, "%#x\n", a-testStart)
+ }
+ return buf.Bytes(), nil
}
type testSymbolzSymbolizer struct{}
Location: []*profile.Location{cpuL[0], cpuL[1], cpuL[2]},
Value: []int64{1000, 1000},
Label: map[string][]string{
- "key1": {"tag1"},
- "key2": {"tag1"},
+ "key1": []string{"tag1"},
+ "key2": []string{"tag1"},
},
},
{
Location: []*profile.Location{cpuL[0], cpuL[3]},
Value: []int64{100, 100},
Label: map[string][]string{
- "key1": {"tag2"},
- "key3": {"tag2"},
+ "key1": []string{"tag2"},
+ "key3": []string{"tag2"},
},
},
{
Location: []*profile.Location{cpuL[1], cpuL[4]},
Value: []int64{10, 10},
Label: map[string][]string{
- "key1": {"tag3"},
- "key2": {"tag2"},
+ "key1": []string{"tag3"},
+ "key2": []string{"tag2"},
},
},
{
Location: []*profile.Location{cpuL[2]},
Value: []int64{10, 10},
Label: map[string][]string{
- "key1": {"tag4"},
- "key2": {"tag1"},
+ "key1": []string{"tag4"},
+ "key2": []string{"tag1"},
},
},
},
Location: []*profile.Location{heapL[0], heapL[1], heapL[2]},
Value: []int64{10, 1024000},
NumLabel: map[string][]int64{
- "bytes": {102400},
+ "bytes": []int64{102400},
},
},
{
Location: []*profile.Location{heapL[0], heapL[3]},
Value: []int64{20, 4096000},
NumLabel: map[string][]int64{
- "bytes": {204800},
+ "bytes": []int64{204800},
},
},
{
Location: []*profile.Location{heapL[1], heapL[4]},
Value: []int64{40, 65536000},
NumLabel: map[string][]int64{
- "bytes": {1638400},
+ "bytes": []int64{1638400},
},
},
{
Location: []*profile.Location{heapL[2]},
Value: []int64{80, 32768000},
NumLabel: map[string][]int64{
- "bytes": {409600},
+ "bytes": []int64{409600},
},
},
},
}
}
-type testSymbolzMergeFetcher struct{}
-
-func (testSymbolzMergeFetcher) Fetch(s string, d, t time.Duration) (*profile.Profile, string, error) {
- var p *profile.Profile
- switch s {
- case testSourceURL(8000) + "symbolz":
- p = symzProfile()
- case testSourceURL(8001) + "symbolz":
- p = symzProfile()
- p.Mapping[0].Start += testOffset
- p.Mapping[0].Limit += testOffset
- for i := range p.Location {
- p.Location[i].Address += testOffset
- }
- default:
- return nil, "", fmt.Errorf("unexpected source: %s", s)
- }
- return p, s, nil
-}
-
func TestSymbolzAfterMerge(t *testing.T) {
baseVars := pprofVariables
pprofVariables = baseVars.makeCopy()
defer func() { pprofVariables = baseVars }()
f := baseFlags()
- f.args = []string{
- testSourceURL(8000) + "symbolz",
- testSourceURL(8001) + "symbolz",
- }
+ f.args = []string{"symbolz", "http://host2/symbolz"}
o := setDefaults(nil)
o.Flagset = f
t.Fatalf("parseFlags returned command %v, want [proto]", cmd)
}
- o.Fetch = testSymbolzMergeFetcher{}
+ o.Fetch = testFetcher{}
o.Sym = testSymbolzSymbolizer{}
p, err := fetchProfiles(src, o)
if err != nil {
switch start {
case 0x1000:
return []plugin.Inst{
- {Addr: 0x1000, Text: "instruction one", File: "file1000.src", Line: 1},
- {Addr: 0x1001, Text: "instruction two", File: "file1000.src", Line: 1},
- {Addr: 0x1002, Text: "instruction three", File: "file1000.src", Line: 2},
- {Addr: 0x1003, Text: "instruction four", File: "file1000.src", Line: 1},
+ {Addr: 0x1000, Text: "instruction one"},
+ {Addr: 0x1001, Text: "instruction two"},
+ {Addr: 0x1002, Text: "instruction three"},
+ {Addr: 0x1003, Text: "instruction four"},
}, nil
case 0x3000:
return []plugin.Inst{
}
type mockFile struct {
- name, buildID string
+ name, buildId string
base uint64
}
// BuildID returns the GNU build ID of the file, or an empty string.
func (m *mockFile) BuildID() string {
- return m.buildID
+ return m.buildId
}
// SourceLine reports the source line information for a given
return "", fmt.Errorf("failed to identify temp dir")
}
-const testSourceAddress = "pproftest.local"
-
// grabProfile fetches a profile. Returns the profile, sources for the
// profile mappings, a bool indicating if the profile was fetched
// remotely, and an error.
if src != "" {
msrc = collectMappingSources(p, src)
remote = true
- if strings.HasPrefix(src, "http://"+testSourceAddress) {
- // Treat test inputs as local to avoid saving
- // testcase profiles during driver testing.
- remote = false
- }
}
return
}
}
}
}
- if len(p.Mapping) == 0 {
- // If there are no mappings, add a fake mapping to attempt symbolization.
- // This is useful for some profiles generated by the golang runtime, which
- // do not include any mappings. Symbolization with a fake mapping will only
- // be successful against a non-PIE binary.
- m := &profile.Mapping{ID: 1}
- p.Mapping = []*profile.Mapping{m}
- for _, l := range p.Location {
- l.Mapping = m
- }
- }
// Replace executable filename/buildID with the overrides from source.
// Assumes the executable is the first Mapping entry.
if execName, buildID := s.ExecName, s.BuildID; execName != "" || buildID != "" {
+ if len(p.Mapping) == 0 {
+ // If there are no mappings, add a fake mapping to attempt symbolization.
+ // This is useful for some profiles generated by the golang runtime, which
+ // do not include any mappings. Symbolization with a fake mapping will only
+ // be successful against a non-PIE binary.
+ m := &profile.Mapping{ID: 1}
+ p.Mapping = []*profile.Mapping{m}
+ for _, l := range p.Location {
+ l.Mapping = m
+ }
+ }
m := p.Mapping[0]
if execName != "" {
m.File = execName
package driver
import (
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/tls"
- "crypto/x509"
- "encoding/pem"
"fmt"
"io/ioutil"
- "math/big"
"net/http"
"net/url"
"os"
"reflect"
"regexp"
"runtime"
- "strings"
"testing"
"time"
- "github.com/google/pprof/internal/binutils"
"github.com/google/pprof/internal/plugin"
"github.com/google/pprof/internal/proftest"
- "github.com/google/pprof/internal/symbolizer"
"github.com/google/pprof/profile"
)
const path = "testdata/"
// Intercept http.Get calls from HTTPFetcher.
- savedHTTPGet := httpGet
- defer func() { httpGet = savedHTTPGet }()
httpGet = stubHTTPGet
type testcase struct {
c := &http.Client{Transport: t}
return c.Get("file:///" + file)
}
-
-func TestHttpsInsecure(t *testing.T) {
-
- if runtime.GOOS == "nacl" {
- t.Skip("test assumes tcp available")
- }
-
- baseVars := pprofVariables
- pprofVariables = baseVars.makeCopy()
- defer func() { pprofVariables = baseVars }()
-
- tlsConfig := &tls.Config{Certificates: []tls.Certificate{selfSignedCert(t)}}
-
- l, err := tls.Listen("tcp", "localhost:0", tlsConfig)
- if err != nil {
- t.Fatalf("net.Listen: got error %v, want no error", err)
- }
-
- donec := make(chan error, 1)
- go func(donec chan<- error) {
- donec <- http.Serve(l, nil)
- }(donec)
- defer func() {
- if got, want := <-donec, "use of closed"; !strings.Contains(got.Error(), want) {
- t.Fatalf("Serve got error %v, want %q", got, want)
- }
- }()
- defer l.Close()
-
- go func() {
- deadline := time.Now().Add(5 * time.Second)
- for time.Now().Before(deadline) {
- // Simulate a hotspot function.
- }
- }()
-
- outputTempFile, err := ioutil.TempFile("", "profile_output")
- if err != nil {
- t.Fatalf("Failed to create tempfile: %v", err)
- }
- defer os.Remove(outputTempFile.Name())
- defer outputTempFile.Close()
-
- address := "https+insecure://" + l.Addr().String() + "/debug/pprof/profile"
- s := &source{
- Sources: []string{address},
- Seconds: 10,
- Timeout: 10,
- Symbolize: "remote",
- }
- o := &plugin.Options{
- Obj: &binutils.Binutils{},
- UI: &proftest.TestUI{T: t, IgnoreRx: "Saved profile in"},
- }
- o.Sym = &symbolizer.Symbolizer{Obj: o.Obj, UI: o.UI}
- p, err := fetchProfiles(s, o)
- if err != nil {
- t.Fatal(err)
- }
- if len(p.SampleType) == 0 {
- t.Fatalf("grabProfile(%s) got empty profile: len(p.SampleType)==0", address)
- }
- if err := checkProfileHasFunction(p, "TestHttpsInsecure"); err != nil {
- t.Fatalf("grabProfile(%s) %v", address, err)
- }
-}
-
-func checkProfileHasFunction(p *profile.Profile, fname string) error {
- for _, f := range p.Function {
- if strings.Contains(f.Name, fname) {
- return nil
- }
- }
- return fmt.Errorf("got %s, want function %q", p.String(), fname)
-}
-
-func selfSignedCert(t *testing.T) tls.Certificate {
- privKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
- if err != nil {
- t.Fatalf("failed to generate private key: %v", err)
- }
- b, err := x509.MarshalECPrivateKey(privKey)
- if err != nil {
- t.Fatalf("failed to marshal private key: %v", err)
- }
- bk := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: b})
-
- tmpl := x509.Certificate{
- SerialNumber: big.NewInt(1),
- NotBefore: time.Now(),
- NotAfter: time.Now().Add(10 * time.Minute),
- }
-
- b, err = x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, privKey.Public(), privKey)
- if err != nil {
- t.Fatalf("failed to create cert: %v", err)
- }
- bc := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: b})
-
- cert, err := tls.X509KeyPair(bc, bk)
- if err != nil {
- t.Fatalf("failed to create TLS key pair: %v", err)
- }
- return cert
-}
+++ /dev/null
-positions: instr line
-events: cpu(ms)
-
-ob=(1) /path/to/testbinary
-fl=(1) testdata/file1000.src
-fn=(1) line1000
-0x1000 1 1000
-* 1 100
-
-ob=(1)
-fl=(2) testdata/file2000.src
-fn=(2) line2001
-+4096 9 10
-
-ob=(1)
-fl=(3) testdata/file3000.src
-fn=(3) line3002
-+4096 2 10
-cfl=(2)
-cfn=(4) line2000 [1/2]
-calls=0 * 4
-* * 1000
-
-ob=(1)
-fl=(2)
-fn=(5) line2000
--4096 4 0
-cfl=(2)
-cfn=(6) line2001 [2/2]
-calls=0 -4096 9
-* * 1000
-* 4 0
-cfl=(2)
-cfn=(7) line2001 [1/2]
-calls=0 * 9
-* * 10
-
-ob=(1)
-fl=(2)
-fn=(2)
-* 9 0
-cfl=(1)
-cfn=(8) line1000 [1/2]
-calls=0 -4096 1
-* * 1000
-
-ob=(1)
-fl=(3)
-fn=(9) line3000
-+4096 6 0
-cfl=(3)
-cfn=(10) line3001 [1/2]
-calls=0 +4096 5
-* * 1010
-
-ob=(1)
-fl=(3)
-fn=(11) line3001
-* 5 0
-cfl=(3)
-cfn=(12) line3002 [1/2]
-calls=0 * 2
-* * 1010
-
-ob=(1)
-fl=(3)
-fn=(9)
-+1 9 0
-cfl=(3)
-cfn=(13) line3001 [2/2]
-calls=0 +1 8
-* * 100
-
-ob=(1)
-fl=(3)
-fn=(11)
-* 8 0
-cfl=(1)
-cfn=(14) line1000 [2/2]
-calls=0 -8193 1
-* * 100
-
-ob=(1)
-fl=(3)
-fn=(9)
-+1 9 0
-cfl=(3)
-cfn=(15) line3002 [2/2]
-calls=0 +1 5
-* * 10
-
-ob=(1)
-fl=(3)
-fn=(3)
-* 5 0
-cfl=(2)
-cfn=(16) line2000 [2/2]
-calls=0 -4098 4
-* * 10
ROUTINE ======================== line1000
1.10s 1.10s (flat, cum) 98.21% of Total
1.10s 1.10s 1000: instruction one ;line1000 file1000.src:1
- . . 1001: instruction two ;file1000.src:1
- . . 1002: instruction three ;file1000.src:2
- . . 1003: instruction four ;file1000.src:1
+ . . 1001: instruction two
+ . . 1002: instruction three
+ . . 1003: instruction four
ROUTINE ======================== line3000
10ms 1.12s (flat, cum) 100% of Total
10ms 1.01s 3000: instruction one ;line3000 file3000.src:6
<!DOCTYPE html>
<html>
<head>
-<meta charset="UTF-8">
<title>Pprof listing</title>
<style type="text/css">
body {
<pre onClick="pprof_toggle_asm(event)">
Total: 1.10s 1.10s (flat, cum) 98.21%
<span class=line> 1</span> <span class=deadsrc> 1.10s 1.10s line1 </span><span class=asm> 1.10s 1.10s 1000: instruction one <span class=disasmloc>file1000.src:1</span>
- . . 1001: instruction two <span class=disasmloc>file1000.src:1</span>
- â‹®
- . . 1003: instruction four <span class=disasmloc>file1000.src:1</span>
-</span>
-<span class=line> 2</span> <span class=deadsrc> . . line2 </span><span class=asm> . . 1002: instruction three <span class=disasmloc>file1000.src:2</span>
+ . . 1001: instruction two <span class=disasmloc></span>
+ . . 1002: instruction three <span class=disasmloc></span>
+ . . 1003: instruction four <span class=disasmloc></span>
</span>
+<span class=line> 2</span> <span class=nop> . . line2 </span>
<span class=line> 3</span> <span class=nop> . . line3 </span>
<span class=line> 4</span> <span class=nop> . . line4 </span>
<span class=line> 5</span> <span class=nop> . . line5 </span>
<span class=line> 6</span> <span class=nop> . . line6 </span>
-<span class=line> 7</span> <span class=nop> . . line7 </span>
</pre>
<h1>line3000</h1>testdata/file3000.src
<pre onClick="pprof_toggle_asm(event)">
+++ /dev/null
-digraph "testbinary" {
-node [style=filled fillcolor="#f8f8f8"]
-subgraph cluster_L { "File: testbinary" [shape=box fontsize=16 label="File: testbinary\lType: cpu\lDuration: 10s, Total samples = 1.12s (11.20%)\lShowing nodes accounting for 1.11s, 99.11% of 1.12s total\lDropped 3 nodes (cum <= 0.06s)\l"] }
-N1 [label="line1000\n1s (89.29%)" fontsize=24 shape=box tooltip="line1000 (1s)" color="#b20500" fillcolor="#edd6d5"]
-N1_0 [label = "key1:tag1\nkey2:tag1" fontsize=8 shape=box3d tooltip="1s"]
-N1 -> N1_0 [label=" 1s" weight=100 tooltip="1s" labeltooltip="1s"]
-N2 [label="line3000\n0 of 1.12s (100%)" fontsize=8 shape=box tooltip="line3000 (1.12s)" color="#b20000" fillcolor="#edd5d5"]
-N3 [label="line3001\n0 of 1.11s (99.11%)" fontsize=8 shape=box tooltip="line3001 (1.11s)" color="#b20000" fillcolor="#edd5d5"]
-N4 [label="line1000\n0.10s (8.93%)" fontsize=14 shape=box tooltip="line1000 (0.10s)" color="#b28b62" fillcolor="#ede8e2"]
-N4_0 [label = "key1:tag2\nkey3:tag2" fontsize=8 shape=box3d tooltip="0.10s"]
-N4 -> N4_0 [label=" 0.10s" weight=100 tooltip="0.10s" labeltooltip="0.10s"]
-N5 [label="line3002\n0.01s (0.89%)\nof 1.01s (90.18%)" fontsize=10 shape=box tooltip="line3002 (1.01s)" color="#b20500" fillcolor="#edd6d5"]
-N6 [label="line2000\n0 of 1s (89.29%)" fontsize=8 shape=box tooltip="line2000 (1s)" color="#b20500" fillcolor="#edd6d5"]
-N7 [label="line2001\n0 of 1s (89.29%)" fontsize=8 shape=box tooltip="line2001 (1s)" color="#b20500" fillcolor="#edd6d5"]
-N2 -> N3 [label=" 1.11s\n (inline)" weight=100 penwidth=5 color="#b20000" tooltip="line3000 -> line3001 (1.11s)" labeltooltip="line3000 -> line3001 (1.11s)"]
-N3 -> N5 [label=" 1.01s\n (inline)" weight=91 penwidth=5 color="#b20500" tooltip="line3001 -> line3002 (1.01s)" labeltooltip="line3001 -> line3002 (1.01s)"]
-N6 -> N7 [label=" 1s\n (inline)" weight=90 penwidth=5 color="#b20500" tooltip="line2000 -> line2001 (1s)" labeltooltip="line2000 -> line2001 (1s)"]
-N7 -> N1 [label=" 1s" weight=90 penwidth=5 color="#b20500" tooltip="line2001 -> line1000 (1s)" labeltooltip="line2001 -> line1000 (1s)"]
-N5 -> N6 [label=" 1s" weight=90 penwidth=5 color="#b20500" tooltip="line3002 -> line2000 (1s)" labeltooltip="line3002 -> line2000 (1s)"]
-N3 -> N4 [label=" 0.10s" weight=9 color="#b28b62" tooltip="line3001 -> line1000 (0.10s)" labeltooltip="line3001 -> line1000 (0.10s)"]
-}
digraph "testbinary" {
node [style=filled fillcolor="#f8f8f8"]
subgraph cluster_L { "File: testbinary" [shape=box fontsize=16 label="File: testbinary\lType: cpu\lDuration: 10s, Total samples = 1.12s (11.20%)\lShowing nodes accounting for 1.12s, 100% of 1.12s total\l"] }
-N1 [label="line1000\n1.10s (98.21%)" fontsize=24 shape=box tooltip="line1000 (1.10s)" color="#b20000" fillcolor="#edd5d5"]
+N1 [label="line1000\nfile1000.src\n1.10s (98.21%)" fontsize=24 shape=box tooltip="line1000 testdata/file1000.src (1.10s)" color="#b20000" fillcolor="#edd5d5"]
N1_0 [label = "key1:tag1\nkey2:tag1" fontsize=8 shape=box3d tooltip="1s"]
N1 -> N1_0 [label=" 1s" weight=100 tooltip="1s" labeltooltip="1s"]
N1_1 [label = "key1:tag2\nkey3:tag2" fontsize=8 shape=box3d tooltip="0.10s"]
N1 -> N1_1 [label=" 0.10s" weight=100 tooltip="0.10s" labeltooltip="0.10s"]
-N2 [label="line3000\n0 of 1.12s (100%)" fontsize=8 shape=box tooltip="line3000 (1.12s)" color="#b20000" fillcolor="#edd5d5"]
-N3 [label="line3001\n0 of 1.11s (99.11%)" fontsize=8 shape=box tooltip="line3001 (1.11s)" color="#b20000" fillcolor="#edd5d5"]
-N4 [label="line3002\n0.01s (0.89%)\nof 1.02s (91.07%)" fontsize=10 shape=box tooltip="line3002 (1.02s)" color="#b20400" fillcolor="#edd6d5"]
-N5 [label="line2001\n0.01s (0.89%)\nof 1.01s (90.18%)" fontsize=10 shape=box tooltip="line2001 (1.01s)" color="#b20500" fillcolor="#edd6d5"]
-N6 [label="line2000\n0 of 1.01s (90.18%)" fontsize=8 shape=box tooltip="line2000 (1.01s)" color="#b20500" fillcolor="#edd6d5"]
-N2 -> N3 [label=" 1.11s\n (inline)" weight=100 penwidth=5 color="#b20000" tooltip="line3000 -> line3001 (1.11s)" labeltooltip="line3000 -> line3001 (1.11s)"]
-N6 -> N5 [label=" 1.01s\n (inline)" weight=91 penwidth=5 color="#b20500" tooltip="line2000 -> line2001 (1.01s)" labeltooltip="line2000 -> line2001 (1.01s)"]
-N3 -> N4 [label=" 1.01s\n (inline)" weight=91 penwidth=5 color="#b20500" tooltip="line3001 -> line3002 (1.01s)" labeltooltip="line3001 -> line3002 (1.01s)"]
-N4 -> N6 [label=" 1.01s" weight=91 penwidth=5 color="#b20500" tooltip="line3002 -> line2000 (1.01s)" labeltooltip="line3002 -> line2000 (1.01s)"]
-N5 -> N1 [label=" 1s" weight=90 penwidth=5 color="#b20500" tooltip="line2001 -> line1000 (1s)" labeltooltip="line2001 -> line1000 (1s)"]
-N3 -> N1 [label=" 0.10s" weight=9 color="#b28b62" tooltip="line3001 -> line1000 (0.10s)" labeltooltip="line3001 -> line1000 (0.10s)"]
+N2 [label="line3000\nfile3000.src\n0 of 1.12s (100%)" fontsize=8 shape=box tooltip="line3000 testdata/file3000.src (1.12s)" color="#b20000" fillcolor="#edd5d5"]
+N3 [label="line3001\nfile3000.src\n0 of 1.11s (99.11%)" fontsize=8 shape=box tooltip="line3001 testdata/file3000.src (1.11s)" color="#b20000" fillcolor="#edd5d5"]
+N4 [label="line3002\nfile3000.src\n0.01s (0.89%)\nof 1.02s (91.07%)" fontsize=10 shape=box tooltip="line3002 testdata/file3000.src (1.02s)" color="#b20400" fillcolor="#edd6d5"]
+N5 [label="line2001\nfile2000.src\n0.01s (0.89%)\nof 1.01s (90.18%)" fontsize=10 shape=box tooltip="line2001 testdata/file2000.src (1.01s)" color="#b20500" fillcolor="#edd6d5"]
+N6 [label="line2000\nfile2000.src\n0 of 1.01s (90.18%)" fontsize=8 shape=box tooltip="line2000 testdata/file2000.src (1.01s)" color="#b20500" fillcolor="#edd6d5"]
+N2 -> N3 [label=" 1.11s\n (inline)" weight=100 penwidth=5 color="#b20000" tooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (1.11s)" labeltooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (1.11s)"]
+N6 -> N5 [label=" 1.01s\n (inline)" weight=91 penwidth=5 color="#b20500" tooltip="line2000 testdata/file2000.src -> line2001 testdata/file2000.src (1.01s)" labeltooltip="line2000 testdata/file2000.src -> line2001 testdata/file2000.src (1.01s)"]
+N3 -> N4 [label=" 1.01s\n (inline)" weight=91 penwidth=5 color="#b20500" tooltip="line3001 testdata/file3000.src -> line3002 testdata/file3000.src (1.01s)" labeltooltip="line3001 testdata/file3000.src -> line3002 testdata/file3000.src (1.01s)"]
+N4 -> N6 [label=" 1.01s" weight=91 penwidth=5 color="#b20500" tooltip="line3002 testdata/file3000.src -> line2000 testdata/file2000.src (1.01s)" labeltooltip="line3002 testdata/file3000.src -> line2000 testdata/file2000.src (1.01s)"]
+N5 -> N1 [label=" 1s" weight=90 penwidth=5 color="#b20500" tooltip="line2001 testdata/file2000.src -> line1000 testdata/file1000.src (1s)" labeltooltip="line2001 testdata/file2000.src -> line1000 testdata/file1000.src (1s)"]
+N3 -> N1 [label=" 0.10s" weight=9 color="#b28b62" tooltip="line3001 testdata/file3000.src -> line1000 testdata/file1000.src (0.10s)" labeltooltip="line3001 testdata/file3000.src -> line1000 testdata/file1000.src (0.10s)"]
}
Showing nodes accounting for 1.12s, 100% of 1.12s total
flat flat% sum% cum cum%
- 1.10s 98.21% 98.21% 1.10s 98.21% line1000
- 0.01s 0.89% 99.11% 1.01s 90.18% line2001 (inline)
- 0.01s 0.89% 100% 1.02s 91.07% line3002 (inline)
- 0 0% 100% 1.01s 90.18% line2000
- 0 0% 100% 1.12s 100% line3000
- 0 0% 100% 1.11s 99.11% line3001 (inline)
+ 1.10s 98.21% 98.21% 1.10s 98.21% line1000 testdata/file1000.src
+ 0.01s 0.89% 99.11% 1.01s 90.18% line2001 testdata/file2000.src (inline)
+ 0.01s 0.89% 100% 1.02s 91.07% line3002 testdata/file3000.src (inline)
+ 0 0% 100% 1.01s 90.18% line2000 testdata/file2000.src
+ 0 0% 100% 1.12s 100% line3000 testdata/file3000.src
+ 0 0% 100% 1.11s 99.11% line3001 testdata/file3000.src (inline)
----------------------------------------------------------+-------------
flat flat% sum% cum cum% calls calls% + context
----------------------------------------------------------+-------------
- 1.01s 100% | line2000 (inline)
- 0.01s 0.89% 0.89% 1.01s 90.18% | line2001
- 1s 99.01% | line1000
-----------------------------------------------------------+-------------
- 1.11s 100% | line3000 (inline)
- 0 0% 0.89% 1.11s 99.11% | line3001
- 1.01s 90.99% | line3002 (inline)
- 0.10s 9.01% | line1000
+ 1.01s 100% | line2000 testdata/file2000.src (inline)
+ 0.01s 0.89% 0.89% 1.01s 90.18% | line2001 testdata/file2000.src
+ 1s 99.01% | line1000 testdata/file1000.src
+----------------------------------------------------------+-------------
+ 1.11s 100% | line3000 testdata/file3000.src (inline)
+ 0 0% 0.89% 1.11s 99.11% | line3001 testdata/file3000.src
+ 1.01s 90.99% | line3002 testdata/file3000.src (inline)
+ 0.10s 9.01% | line1000 testdata/file1000.src
----------------------------------------------------------+-------------
- key1: Total 1.1s
- 1.0s (89.29%): tag1
- 100.0ms ( 8.93%): tag2
- 10.0ms ( 0.89%): tag3
- 10.0ms ( 0.89%): tag4
+key1: Total 1120
+ 1000 (89.29%): tag1
+ 100 ( 8.93%): tag2
+ 10 ( 0.89%): tag3
+ 10 ( 0.89%): tag4
- key2: Total 1.0s
- 1.0s (99.02%): tag1
- 10.0ms ( 0.98%): tag2
+key2: Total 1020
+ 1010 (99.02%): tag1
+ 10 ( 0.98%): tag2
- key3: Total 100.0ms
- 100.0ms ( 100%): tag2
+key3: Total 100
+ 100 ( 100%): tag2
- key1: Total 100.0ms
- 100.0ms ( 100%): tag2
+key1: Total 100
+ 100 ( 100%): tag2
- key3: Total 100.0ms
- 100.0ms ( 100%): tag2
+key3: Total 100
+ 100 ( 100%): tag2
-----------+-------------------------------------------------------
key1: tag1
key2: tag1
- 1s line1000
- line2001
- line2000
- line3002
- line3001
- line3000
+ 1s line1000 testdata/file1000.src
+ line2001 testdata/file2000.src
+ line2000 testdata/file2000.src
+ line3002 testdata/file3000.src
+ line3001 testdata/file3000.src
+ line3000 testdata/file3000.src
-----------+-------------------------------------------------------
key1: tag2
key3: tag2
- 100ms line1000
- line3001
- line3000
+ 100ms line1000 testdata/file1000.src
+ line3001 testdata/file3000.src
+ line3000 testdata/file3000.src
-----------+-------------------------------------------------------
key1: tag3
key2: tag2
- 10ms line2001
- line2000
- line3002
- line3000
+ 10ms line2001 testdata/file2000.src
+ line2000 testdata/file2000.src
+ line3002 testdata/file3000.src
+ line3000 testdata/file3000.src
-----------+-------------------------------------------------------
key1: tag4
key2: tag1
- 10ms line3002
- line3001
- line3000
+ 10ms line3002 testdata/file3000.src
+ line3001 testdata/file3000.src
+ line3000 testdata/file3000.src
-----------+-------------------------------------------------------
----------------------------------------------------------+-------------
flat flat% sum% cum cum% calls calls% + context
----------------------------------------------------------+-------------
- 63.48MB 100% | line3002
- 0 0% 0% 63.48MB 100% | line2000
- 63.48MB 100% | line2001 (inline)
+ 63.48MB 100% | line3002 testdata/file3000.src
+ 0 0% 0% 63.48MB 100% | line2000 testdata/file2000.src
+ 63.48MB 100% | line2001 testdata/file2000.src (inline)
----------------------------------------------------------+-------------
- 63.48MB 100% | line2000 (inline)
- 62.50MB 98.46% 98.46% 63.48MB 100% | line2001
+ 63.48MB 100% | line2000 testdata/file2000.src (inline)
+ 62.50MB 98.46% 98.46% 63.48MB 100% | line2001 testdata/file2000.src
----------------------------------------------------------+-------------
- 0 0% 98.46% 63.48MB 100% | line3000
- 63.48MB 100% | line3002 (inline)
+ 0 0% 98.46% 63.48MB 100% | line3000 testdata/file3000.src
+ 63.48MB 100% | line3002 testdata/file3000.src (inline)
----------------------------------------------------------+-------------
- 63.48MB 100% | line3000 (inline)
- 0 0% 98.46% 63.48MB 100% | line3002
- 63.48MB 100% | line2000
+ 63.48MB 100% | line3000 testdata/file3000.src (inline)
+ 0 0% 98.46% 63.48MB 100% | line3002 testdata/file3000.src
+ 63.48MB 100% | line2000 testdata/file2000.src
----------------------------------------------------------+-------------
Showing nodes accounting for 150, 100% of 150 total
flat flat% sum% cum cum%
- 80 53.33% 53.33% 130 86.67% line3002 (inline)
- 40 26.67% 80.00% 50 33.33% line2001 (inline)
- 30 20.00% 100% 30 20.00% line1000
- 0 0% 100% 50 33.33% line2000
- 0 0% 100% 150 100% line3000
- 0 0% 100% 110 73.33% line3001 (inline)
+ 80 53.33% 53.33% 130 86.67% line3002 testdata/file3000.src (inline)
+ 40 26.67% 80.00% 50 33.33% line2001 testdata/file2000.src (inline)
+ 30 20.00% 100% 30 20.00% line1000 testdata/file1000.src
+ 0 0% 100% 50 33.33% line2000 testdata/file2000.src
+ 0 0% 100% 150 100% line3000 testdata/file3000.src
+ 0 0% 100% 110 73.33% line3001 testdata/file3000.src (inline)
digraph "unnamed" {
node [style=filled fillcolor="#f8f8f8"]
subgraph cluster_L { "Build ID: buildid" [shape=box fontsize=16 label="Build ID: buildid\lcomment\lType: inuse_space\lShowing nodes accounting for 62.50MB, 63.37% of 98.63MB total\l"] }
-N1 [label="line2001\n62.50MB (63.37%)" fontsize=24 shape=box tooltip="line2001 (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
+N1 [label="line2001\nfile2000.src\n62.50MB (63.37%)" fontsize=24 shape=box tooltip="line2001 testdata/file2000.src (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
NN1_0 [label = "1.56MB" fontsize=8 shape=box3d tooltip="62.50MB"]
N1 -> NN1_0 [label=" 62.50MB" weight=100 tooltip="62.50MB" labeltooltip="62.50MB"]
-N2 [label="line3000\n0 of 62.50MB (63.37%)" fontsize=8 shape=box tooltip="line3000 (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
-N3 [label="line2000\n0 of 62.50MB (63.37%)" fontsize=8 shape=box tooltip="line2000 (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
-N4 [label="line3002\n0 of 62.50MB (63.37%)" fontsize=8 shape=box tooltip="line3002 (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
-N3 -> N1 [label=" 62.50MB\n (inline)" weight=64 penwidth=4 color="#b21600" tooltip="line2000 -> line2001 (62.50MB)" labeltooltip="line2000 -> line2001 (62.50MB)"]
-N2 -> N4 [label=" 62.50MB\n (inline)" weight=64 penwidth=4 color="#b21600" tooltip="line3000 -> line3002 (62.50MB)" labeltooltip="line3000 -> line3002 (62.50MB)"]
-N4 -> N3 [label=" 62.50MB" weight=64 penwidth=4 color="#b21600" tooltip="line3002 -> line2000 (62.50MB)" labeltooltip="line3002 -> line2000 (62.50MB)"]
+N2 [label="line3000\nfile3000.src\n0 of 62.50MB (63.37%)" fontsize=8 shape=box tooltip="line3000 testdata/file3000.src (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
+N3 [label="line2000\nfile2000.src\n0 of 62.50MB (63.37%)" fontsize=8 shape=box tooltip="line2000 testdata/file2000.src (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
+N4 [label="line3002\nfile3000.src\n0 of 62.50MB (63.37%)" fontsize=8 shape=box tooltip="line3002 testdata/file3000.src (62.50MB)" color="#b21600" fillcolor="#edd8d5"]
+N3 -> N1 [label=" 62.50MB\n (inline)" weight=64 penwidth=4 color="#b21600" tooltip="line2000 testdata/file2000.src -> line2001 testdata/file2000.src (62.50MB)" labeltooltip="line2000 testdata/file2000.src -> line2001 testdata/file2000.src (62.50MB)"]
+N2 -> N4 [label=" 62.50MB\n (inline)" weight=64 penwidth=4 color="#b21600" tooltip="line3000 testdata/file3000.src -> line3002 testdata/file3000.src (62.50MB)" labeltooltip="line3000 testdata/file3000.src -> line3002 testdata/file3000.src (62.50MB)"]
+N4 -> N3 [label=" 62.50MB" weight=64 penwidth=4 color="#b21600" tooltip="line3002 testdata/file3000.src -> line2000 testdata/file2000.src (62.50MB)" labeltooltip="line3002 testdata/file3000.src -> line2000 testdata/file2000.src (62.50MB)"]
}
digraph "unnamed" {
node [style=filled fillcolor="#f8f8f8"]
subgraph cluster_L { "Build ID: buildid" [shape=box fontsize=16 label="Build ID: buildid\lcomment\lType: inuse_space\lShowing nodes accounting for 36.13MB, 36.63% of 98.63MB total\lDropped 2 nodes (cum <= 4.93MB)\l"] }
-N1 [label="line3002\n31.25MB (31.68%)\nof 32.23MB (32.67%)" fontsize=24 shape=box tooltip="line3002 (32.23MB)" color="#b23200" fillcolor="#eddcd5"]
+N1 [label="line3002\nfile3000.src\n31.25MB (31.68%)\nof 32.23MB (32.67%)" fontsize=24 shape=box tooltip="line3002 testdata/file3000.src (32.23MB)" color="#b23200" fillcolor="#eddcd5"]
NN1_0 [label = "400kB" fontsize=8 shape=box3d tooltip="31.25MB"]
N1 -> NN1_0 [label=" 31.25MB" weight=100 tooltip="31.25MB" labeltooltip="31.25MB"]
-N2 [label="line3000\n0 of 36.13MB (36.63%)" fontsize=8 shape=box tooltip="line3000 (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
-N3 [label="line3001\n0 of 36.13MB (36.63%)" fontsize=8 shape=box tooltip="line3001 (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
-N4 [label="line1000\n4.88MB (4.95%)" fontsize=15 shape=box tooltip="line1000 (4.88MB)" color="#b2a086" fillcolor="#edeae7"]
+N2 [label="line3000\nfile3000.src\n0 of 36.13MB (36.63%)" fontsize=8 shape=box tooltip="line3000 testdata/file3000.src (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
+N3 [label="line3001\nfile3000.src\n0 of 36.13MB (36.63%)" fontsize=8 shape=box tooltip="line3001 testdata/file3000.src (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
+N4 [label="line1000\nfile1000.src\n4.88MB (4.95%)" fontsize=15 shape=box tooltip="line1000 testdata/file1000.src (4.88MB)" color="#b2a086" fillcolor="#edeae7"]
NN4_0 [label = "200kB" fontsize=8 shape=box3d tooltip="3.91MB"]
N4 -> NN4_0 [label=" 3.91MB" weight=100 tooltip="3.91MB" labeltooltip="3.91MB"]
-N2 -> N3 [label=" 36.13MB\n (inline)" weight=37 penwidth=2 color="#b22e00" tooltip="line3000 -> line3001 (36.13MB)" labeltooltip="line3000 -> line3001 (36.13MB)"]
-N3 -> N1 [label=" 32.23MB\n (inline)" weight=33 penwidth=2 color="#b23200" tooltip="line3001 -> line3002 (32.23MB)" labeltooltip="line3001 -> line3002 (32.23MB)"]
-N3 -> N4 [label=" 3.91MB" weight=4 color="#b2a58f" tooltip="line3001 -> line1000 (3.91MB)" labeltooltip="line3001 -> line1000 (3.91MB)"]
-N1 -> N4 [label=" 0.98MB" color="#b2b0a9" tooltip="line3002 ... line1000 (0.98MB)" labeltooltip="line3002 ... line1000 (0.98MB)" style="dotted" minlen=2]
+N2 -> N3 [label=" 36.13MB\n (inline)" weight=37 penwidth=2 color="#b22e00" tooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (36.13MB)" labeltooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (36.13MB)"]
+N3 -> N1 [label=" 32.23MB\n (inline)" weight=33 penwidth=2 color="#b23200" tooltip="line3001 testdata/file3000.src -> line3002 testdata/file3000.src (32.23MB)" labeltooltip="line3001 testdata/file3000.src -> line3002 testdata/file3000.src (32.23MB)"]
+N3 -> N4 [label=" 3.91MB" weight=4 color="#b2a58f" tooltip="line3001 testdata/file3000.src -> line1000 testdata/file1000.src (3.91MB)" labeltooltip="line3001 testdata/file3000.src -> line1000 testdata/file1000.src (3.91MB)"]
+N1 -> N4 [label=" 0.98MB" color="#b2b0a9" tooltip="line3002 testdata/file3000.src ... line1000 testdata/file1000.src (0.98MB)" labeltooltip="line3002 testdata/file3000.src ... line1000 testdata/file1000.src (0.98MB)" style="dotted" minlen=2]
}
- bytes: Total 98.6MB
- 62.5MB (63.37%): 1.56MB
- 31.2MB (31.68%): 400kB
- 3.9MB ( 3.96%): 200kB
- 1000.0kB ( 0.99%): 100kB
+bytes: Total 150
+ 80 (53.33%): 400kB
+ 40 (26.67%): 1.56MB
+ 20 (13.33%): 200kB
+ 10 ( 6.67%): 100kB
- bytes: Total 103424000.0B
- 65536000.0B (63.37%): 1638400B
- 32768000.0B (31.68%): 409600B
- 4096000.0B ( 3.96%): 204800B
- 1024000.0B ( 0.99%): 102400B
+bytes: Total 150
+ 80 (53.33%): 409600B
+ 40 (26.67%): 1638400B
+ 20 (13.33%): 204800B
+ 10 ( 6.67%): 102400B
Showing nodes accounting for 150, 100% of 150 total
flat flat% sum% cum cum%
- 80 53.33% 53.33% 130 86.67% line3002 (inline)
- 40 26.67% 80.00% 50 33.33% line2001 (inline)
- 30 20.00% 100% 30 20.00% line1000
- 0 0% 100% 50 33.33% line2000
- 0 0% 100% 150 100% line3000
- 0 0% 100% 110 73.33% line3001 (inline)
+ 80 53.33% 53.33% 130 86.67% line3002 testdata/file3000.src (inline)
+ 40 26.67% 80.00% 50 33.33% line2001 testdata/file2000.src (inline)
+ 30 20.00% 100% 30 20.00% line1000 testdata/file1000.src
+ 0 0% 100% 50 33.33% line2000 testdata/file2000.src
+ 0 0% 100% 150 100% line3000 testdata/file3000.src
+ 0 0% 100% 110 73.33% line3001 testdata/file3000.src (inline)
digraph "unnamed" {
node [style=filled fillcolor="#f8f8f8"]
subgraph cluster_L { "Build ID: buildid" [shape=box fontsize=16 label="Build ID: buildid\lcomment\lType: alloc_space\lShowing nodes accounting for 93.75MB, 95.05% of 98.63MB total\lDropped 1 node (cum <= 4.93MB)\l"] }
-N1 [label="line3002\n31.25MB (31.68%)\nof 94.73MB (96.04%)" fontsize=20 shape=box tooltip="line3002 (94.73MB)" color="#b20200" fillcolor="#edd5d5"]
+N1 [label="line3002\nfile3000.src\n31.25MB (31.68%)\nof 94.73MB (96.04%)" fontsize=20 shape=box tooltip="line3002 testdata/file3000.src (94.73MB)" color="#b20200" fillcolor="#edd5d5"]
NN1_0 [label = "400kB" fontsize=8 shape=box3d tooltip="31.25MB"]
N1 -> NN1_0 [label=" 31.25MB" weight=100 tooltip="31.25MB" labeltooltip="31.25MB"]
-N2 [label="line3000\n0 of 98.63MB (100%)" fontsize=8 shape=box tooltip="line3000 (98.63MB)" color="#b20000" fillcolor="#edd5d5"]
-N3 [label="line2001\n62.50MB (63.37%)\nof 63.48MB (64.36%)" fontsize=24 shape=box tooltip="line2001 (63.48MB)" color="#b21600" fillcolor="#edd8d5"]
+N2 [label="line3000\nfile3000.src\n0 of 98.63MB (100%)" fontsize=8 shape=box tooltip="line3000 testdata/file3000.src (98.63MB)" color="#b20000" fillcolor="#edd5d5"]
+N3 [label="line2001\nfile2000.src\n62.50MB (63.37%)\nof 63.48MB (64.36%)" fontsize=24 shape=box tooltip="line2001 testdata/file2000.src (63.48MB)" color="#b21600" fillcolor="#edd8d5"]
NN3_0 [label = "1.56MB" fontsize=8 shape=box3d tooltip="62.50MB"]
N3 -> NN3_0 [label=" 62.50MB" weight=100 tooltip="62.50MB" labeltooltip="62.50MB"]
-N4 [label="line2000\n0 of 63.48MB (64.36%)" fontsize=8 shape=box tooltip="line2000 (63.48MB)" color="#b21600" fillcolor="#edd8d5"]
-N5 [label="line3001\n0 of 36.13MB (36.63%)" fontsize=8 shape=box tooltip="line3001 (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
-N4 -> N3 [label=" 63.48MB\n (inline)" weight=65 penwidth=4 color="#b21600" tooltip="line2000 -> line2001 (63.48MB)" labeltooltip="line2000 -> line2001 (63.48MB)"]
-N1 -> N4 [label=" 63.48MB" weight=65 penwidth=4 color="#b21600" tooltip="line3002 -> line2000 (63.48MB)" labeltooltip="line3002 -> line2000 (63.48MB)" minlen=2]
-N2 -> N1 [label=" 62.50MB\n (inline)" weight=64 penwidth=4 color="#b21600" tooltip="line3000 -> line3002 (62.50MB)" labeltooltip="line3000 -> line3002 (62.50MB)"]
-N2 -> N5 [label=" 36.13MB\n (inline)" weight=37 penwidth=2 color="#b22e00" tooltip="line3000 -> line3001 (36.13MB)" labeltooltip="line3000 -> line3001 (36.13MB)"]
-N5 -> N1 [label=" 32.23MB\n (inline)" weight=33 penwidth=2 color="#b23200" tooltip="line3001 -> line3002 (32.23MB)" labeltooltip="line3001 -> line3002 (32.23MB)"]
+N4 [label="line2000\nfile2000.src\n0 of 63.48MB (64.36%)" fontsize=8 shape=box tooltip="line2000 testdata/file2000.src (63.48MB)" color="#b21600" fillcolor="#edd8d5"]
+N5 [label="line3001\nfile3000.src\n0 of 36.13MB (36.63%)" fontsize=8 shape=box tooltip="line3001 testdata/file3000.src (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
+N4 -> N3 [label=" 63.48MB\n (inline)" weight=65 penwidth=4 color="#b21600" tooltip="line2000 testdata/file2000.src -> line2001 testdata/file2000.src (63.48MB)" labeltooltip="line2000 testdata/file2000.src -> line2001 testdata/file2000.src (63.48MB)"]
+N1 -> N4 [label=" 63.48MB" weight=65 penwidth=4 color="#b21600" tooltip="line3002 testdata/file3000.src -> line2000 testdata/file2000.src (63.48MB)" labeltooltip="line3002 testdata/file3000.src -> line2000 testdata/file2000.src (63.48MB)" minlen=2]
+N2 -> N1 [label=" 62.50MB\n (inline)" weight=64 penwidth=4 color="#b21600" tooltip="line3000 testdata/file3000.src -> line3002 testdata/file3000.src (62.50MB)" labeltooltip="line3000 testdata/file3000.src -> line3002 testdata/file3000.src (62.50MB)"]
+N2 -> N5 [label=" 36.13MB\n (inline)" weight=37 penwidth=2 color="#b22e00" tooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (36.13MB)" labeltooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (36.13MB)"]
+N5 -> N1 [label=" 32.23MB\n (inline)" weight=33 penwidth=2 color="#b23200" tooltip="line3001 testdata/file3000.src -> line3002 testdata/file3000.src (32.23MB)" labeltooltip="line3001 testdata/file3000.src -> line3002 testdata/file3000.src (32.23MB)"]
}
digraph "unnamed" {
node [style=filled fillcolor="#f8f8f8"]
subgraph cluster_L { "Build ID: buildid" [shape=box fontsize=16 label="Build ID: buildid\lcomment\lType: alloc_space\lShowing nodes accounting for 93.75MB, 95.05% of 98.63MB total\lDropped 1 node (cum <= 4.93MB)\l"] }
-N1 [label="line3000\n62.50MB (63.37%)\nof 98.63MB (100%)" fontsize=24 shape=box tooltip="line3000 (98.63MB)" color="#b20000" fillcolor="#edd5d5"]
+N1 [label="line3000\nfile3000.src\n62.50MB (63.37%)\nof 98.63MB (100%)" fontsize=24 shape=box tooltip="line3000 testdata/file3000.src (98.63MB)" color="#b20000" fillcolor="#edd5d5"]
NN1_0 [label = "1.56MB" fontsize=8 shape=box3d tooltip="62.50MB"]
N1 -> NN1_0 [label=" 62.50MB" weight=100 tooltip="62.50MB" labeltooltip="62.50MB"]
-N2 [label="line3001\n31.25MB (31.68%)\nof 36.13MB (36.63%)" fontsize=20 shape=box tooltip="line3001 (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
+N2 [label="line3001\nfile3000.src\n31.25MB (31.68%)\nof 36.13MB (36.63%)" fontsize=20 shape=box tooltip="line3001 testdata/file3000.src (36.13MB)" color="#b22e00" fillcolor="#eddbd5"]
NN2_0 [label = "400kB" fontsize=8 shape=box3d tooltip="31.25MB"]
N2 -> NN2_0 [label=" 31.25MB" weight=100 tooltip="31.25MB" labeltooltip="31.25MB"]
-N1 -> N2 [label=" 36.13MB\n (inline)" weight=37 penwidth=2 color="#b22e00" tooltip="line3000 -> line3001 (36.13MB)" labeltooltip="line3000 -> line3001 (36.13MB)" minlen=2]
+N1 -> N2 [label=" 36.13MB\n (inline)" weight=37 penwidth=2 color="#b22e00" tooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (36.13MB)" labeltooltip="line3000 testdata/file3000.src -> line3001 testdata/file3000.src (36.13MB)" minlen=2]
}
+++ /dev/null
-Showing nodes accounting for 1.12s, 100% of 1.12s total
-Showing top 5 nodes out of 6
- flat flat% sum% cum cum%
- 1.10s 98.21% 98.21% 1.10s 98.21% line1000
- 0.01s 0.89% 99.11% 1.01s 90.18% line2001 (inline)
- 0.01s 0.89% 100% 1.02s 91.07% line3002 (inline)
- 0 0% 100% 1.01s 90.18% line2000
- 0 0% 100% 1.12s 100% line3000
--- /dev/null
+Showing nodes accounting for 1.12s, 100% of 1.12s total
+ flat flat% sum% cum cum%
+ 1.10s 98.21% 98.21% 1.10s 98.21% line1000 testdata/file1000.src
+ 0.01s 0.89% 99.11% 1.01s 90.18% line2001 testdata/file2000.src (inline)
+ 0.01s 0.89% 100% 1.02s 91.07% line3002 testdata/file3000.src (inline)
+ 0 0% 100% 1.01s 90.18% line2000 testdata/file2000.src
+ 0 0% 100% 1.12s 100% line3000 testdata/file3000.src
+ 0 0% 100% 1.11s 99.11% line3001 testdata/file3000.src (inline)
if buildID == nil {
buildID = note.Desc
} else {
- return nil, fmt.Errorf("multiple build ids found, don't know which to use")
+ return nil, fmt.Errorf("multiple build ids found, don't know which to use!")
}
}
}
}
return start, nil
case elf.ET_DYN:
- // The process mapping information, start = start of virtual address range,
- // and offset = offset in the executable file of the start address, tells us
- // that a runtime virtual address x maps to a file offset
- // fx = x - start + offset.
+ if offset != 0 {
+ if loadSegment == nil || loadSegment.Vaddr == 0 {
+ return start - offset, nil
+ }
+ return 0, fmt.Errorf("Don't know how to handle mapping. Offset=%x, vaddr=%x",
+ offset, loadSegment.Vaddr)
+ }
if loadSegment == nil {
- return start - offset, nil
+ return start, nil
}
- // The program header, if not nil, indicates the offset in the file where
- // the executable segment is located (loadSegment.Off), and the base virtual
- // address where the first byte of the segment is loaded
- // (loadSegment.Vaddr). A file offset fx maps to a virtual (symbol) address
- // sx = fx - loadSegment.Off + loadSegment.Vaddr.
- //
- // Thus, a runtime virtual address x maps to a symbol address
- // sx = x - start + offset - loadSegment.Off + loadSegment.Vaddr.
- return start - offset + loadSegment.Off - loadSegment.Vaddr, nil
+ return start - loadSegment.Vaddr, nil
}
return 0, fmt.Errorf("Don't know how to handle FileHeader.Type %v", fh.Type)
}
{"exec chromeos kernel 4", fhExec, kernelHeader, uint64p(0xffffffff81200198), 0x198, 0x100000, 0, 0x7ee00000, false},
{"exec chromeos kernel unremapped", fhExec, kernelHeader, uint64p(0xffffffff810001c8), 0xffffffff834001c8, 0xffffffffc0000000, 0xffffffff834001c8, 0x2400000, false},
{"dyn", fhDyn, nil, nil, 0x200000, 0x300000, 0, 0x200000, false},
- {"dyn map", fhDyn, lsOffset, nil, 0x0, 0x300000, 0, 0xFFFFFFFFFFE00000, false},
+ {"dyn offset", fhDyn, lsOffset, nil, 0x0, 0x300000, 0, 0xFFFFFFFFFFC00000, false},
{"dyn nomap", fhDyn, nil, nil, 0x0, 0x0, 0, 0, false},
- {"dyn map+offset", fhDyn, lsOffset, nil, 0x900000, 0xa00000, 0x200000, 0x500000, false},
{"rel", fhRel, nil, nil, 0x2000000, 0x3000000, 0, 0x2000000, false},
{"rel nomap", fhRel, nil, nil, 0x0, ^uint64(0), 0, 0, false},
{"rel offset", fhRel, nil, nil, 0x100000, 0x200000, 0x1, 0, true},
Total int64 // The total weight of the graph, used to compute percentages
}
-const maxNodelets = 4 // Number of nodelets for labels (both numeric and non)
-
-// ComposeDot creates and writes a in the DOT format to the writer, using
+// Compose creates and writes a in the DOT format to the writer, using
// the configurations given.
func ComposeDot(w io.Writer, g *Graph, a *DotAttributes, c *DotConfig) {
builder := &builder{w, a, c}
// addNodelets generates the DOT boxes for the node tags if they exist.
func (b *builder) addNodelets(node *Node, nodeID int) bool {
+ const maxNodelets = 4 // Number of nodelets for alphanumeric labels
+ const maxNumNodelets = 4 // Number of nodelets for numeric labels
var nodelets string
// Populate two Tag slices, one for LabelTags and one for NumericTags.
var ts []*Tag
- lnts := make(map[string][]*Tag)
+ lnts := make(map[string][]*Tag, 0)
for _, t := range node.LabelTags {
ts = append(ts, t)
}
nodelets += fmt.Sprintf(`N%d_%d [label = "%s" fontsize=8 shape=box3d tooltip="%s"]`+"\n", nodeID, i, t.Name, weight)
nodelets += fmt.Sprintf(`N%d -> N%d_%d [label=" %s" weight=100 tooltip="%s" labeltooltip="%s"]`+"\n", nodeID, nodeID, i, weight, weight, weight)
if nts := lnts[t.Name]; nts != nil {
- nodelets += b.numericNodelets(nts, maxNodelets, flatTags, fmt.Sprintf(`N%d_%d`, nodeID, i))
+ nodelets += b.numericNodelets(nts, maxNumNodelets, flatTags, fmt.Sprintf(`N%d_%d`, nodeID, i))
}
}
if nts := lnts[""]; nts != nil {
- nodelets += b.numericNodelets(nts, maxNodelets, flatTags, fmt.Sprintf(`N%d`, nodeID))
+ nodelets += b.numericNodelets(nts, maxNumNodelets, flatTags, fmt.Sprintf(`N%d`, nodeID))
}
fmt.Fprint(b, nodelets)
}
}
-func TestNodeletCountCapping(t *testing.T) {
- labelTags := make(TagMap)
- for i := 0; i < 10; i++ {
- name := fmt.Sprintf("tag-%d", i)
- labelTags[name] = &Tag{
- Name: name,
- Flat: 10,
- Cum: 10,
- }
- }
- numTags := make(TagMap)
- for i := 0; i < 10; i++ {
- name := fmt.Sprintf("num-tag-%d", i)
- numTags[name] = &Tag{
- Name: name,
- Unit: "mb",
- Value: 16,
- Flat: 10,
- Cum: 10,
- }
- }
- node1 := &Node{
- Info: NodeInfo{Name: "node1-with-tags"},
- Flat: 10,
- Cum: 10,
- NumericTags: map[string]TagMap{"": numTags},
- LabelTags: labelTags,
- }
- node2 := &Node{
- Info: NodeInfo{Name: "node2"},
- Flat: 15,
- Cum: 15,
- }
- node3 := &Node{
- Info: NodeInfo{Name: "node3"},
- Flat: 15,
- Cum: 15,
- }
- g := &Graph{
- Nodes: Nodes{
- node1,
- node2,
- node3,
- },
- }
- for n := 1; n <= 3; n++ {
- input := maxNodelets + n
- if got, want := len(g.SelectTopNodes(input, true)), n; got != want {
- t.Errorf("SelectTopNodes(%d): got %d nodes, want %d", input, got, want)
- }
- }
-}
-
func TestMultilinePrintableName(t *testing.T) {
ni := &NodeInfo{
Name: "test1.test2::test3",
}
tagWant := [][]*Tag{
- {
+ []*Tag{
makeTag("1B..2GB", "", 0, 2401, 2401),
},
- {
+ []*Tag{
makeTag("2GB", "", 0, 1000, 1000),
makeTag("1B..12MB", "", 0, 1401, 1401),
},
- {
+ []*Tag{
makeTag("2GB", "", 0, 1000, 1000),
makeTag("12MB", "", 0, 100, 100),
makeTag("1B..1MB", "", 0, 1301, 1301),
},
- {
+ []*Tag{
makeTag("2GB", "", 0, 1000, 1000),
makeTag("1MB", "", 0, 1000, 1000),
makeTag("2B..1kB", "", 0, 201, 201),
Inline bool
}
-// WeightValue returns the weight value for this edge, normalizing if a
-// divisor is available.
func (e *Edge) WeightValue() int64 {
if e.WeightDiv == 0 {
return e.Weight
// 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 = maxNodelets
- }
- if count += tags + 1; count >= maxNodes {
+ if count += countTags(n) + 1; count >= maxNodes {
maxNodes = i + 1
break
}
return count
}
+// countEdges counts the number of edges below the specified cutoff.
+func countEdges(el EdgeMap, cutoff int64) int {
+ count := 0
+ for _, e := range el {
+ if e.Weight > cutoff {
+ count++
+ }
+ }
+ return count
+}
+
// RemoveRedundantEdges removes residual edges if the destination can
// be reached through another path. This is done to simplify the graph
// while preserving connectivity.
switch fromUnit {
case "byte", "b":
- case "kb", "kbyte", "kilobyte":
+ case "kilobyte", "kb":
value *= 1024
- case "mb", "mbyte", "megabyte":
+ case "megabyte", "mb":
value *= 1024 * 1024
- case "gb", "gbyte", "gigabyte":
+ case "gigabyte", "gb":
value *= 1024 * 1024 * 1024
- case "tb", "tbyte", "terabyte":
- value *= 1024 * 1024 * 1024 * 1024
- case "pb", "pbyte", "petabyte":
- value *= 1024 * 1024 * 1024 * 1024 * 1024
default:
return 0, "", false
}
toUnit = "kb"
case value < 1024*1024*1024:
toUnit = "mb"
- case value < 1024*1024*1024*1024:
- toUnit = "gb"
- case value < 1024*1024*1024*1024*1024:
- toUnit = "tb"
default:
- toUnit = "pb"
+ toUnit = "gb"
}
}
output, toUnit = float64(value)/(1024*1024), "MB"
case "gb", "gbyte", "gigabyte":
output, toUnit = float64(value)/(1024*1024*1024), "GB"
- case "tb", "tbyte", "terabyte":
- output, toUnit = float64(value)/(1024*1024*1024*1024), "TB"
- case "pb", "pbyte", "petabyte":
- output, toUnit = float64(value)/(1024*1024*1024*1024*1024), "PB"
}
return output, toUnit, true
}
+++ /dev/null
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package measurement
-
-import (
- "testing"
-)
-
-func TestScale(t *testing.T) {
- for _, tc := range []struct {
- value int64
- fromUnit, toUnit string
- wantValue float64
- wantUnit string
- }{
- {1, "s", "ms", 1000, "ms"},
- {1, "kb", "b", 1024, "B"},
- {1, "kbyte", "b", 1024, "B"},
- {1, "kilobyte", "b", 1024, "B"},
- {1, "mb", "kb", 1024, "kB"},
- {1, "gb", "mb", 1024, "MB"},
- {1024, "gb", "tb", 1, "TB"},
- {1024, "tb", "pb", 1, "PB"},
- {2048, "mb", "auto", 2, "GB"},
- } {
- if gotValue, gotUnit := Scale(tc.value, tc.fromUnit, tc.toUnit); gotValue != tc.wantValue || gotUnit != tc.wantUnit {
- t.Errorf("Scale(%d, %q, %q) = (%f, %q), want (%f, %q)",
- tc.value, tc.fromUnit, tc.toUnit, gotValue, gotUnit, tc.wantValue, tc.wantUnit)
- }
- }
-}
"io/ioutil"
"os"
"os/exec"
- "regexp"
"testing"
)
}
// TestUI implements the plugin.UI interface, triggering test failures
-// if more than Ignore errors not matching IgnoreRx are printed.
+// if more than Ignore errors are printed.
type TestUI struct {
- T *testing.T
- Ignore int
- IgnoreRx string
+ T *testing.T
+ Ignore int
}
// ReadLine returns no input, as no input is expected during testing.
// PrintErr messages may trigger an error failure. A fixed number of
// error messages are permitted when appropriate.
func (ui *TestUI) PrintErr(args ...interface{}) {
- if ui.IgnoreRx != "" {
- if matched, err := regexp.MatchString(ui.IgnoreRx, fmt.Sprint(args)); matched || err != nil {
- if err != nil {
- ui.T.Errorf("failed to match against regex %q: %v", ui.IgnoreRx, err)
- }
- return
- }
- }
if ui.Ignore > 0 {
ui.Ignore--
return
"sort"
"strconv"
"strings"
- "text/tabwriter"
"time"
"github.com/google/pprof/internal/graph"
visualMode := o.OutputFormat == Dot
cumSort := o.CumSort
- // The call_tree option is only honored when generating visual representations of the callgraph.
- callTree := o.CallTree && (o.OutputFormat == Dot || o.OutputFormat == Callgrind)
-
// First step: Build complete graph to identify low frequency nodes, based on their cum weight.
g = rpt.newGraph(nil)
totalValue, _ := g.Nodes.Sum()
// Filter out nodes with cum value below nodeCutoff.
if nodeCutoff > 0 {
- if callTree {
+ if o.CallTree {
if nodesKept := g.DiscardLowFrequencyNodePtrs(nodeCutoff); len(g.Nodes) != len(nodesKept) {
droppedNodes = len(g.Nodes) - len(nodesKept)
g.TrimTree(nodesKept)
// Remove low frequency tags and edges as they affect selection.
g.TrimLowFrequencyTags(nodeCutoff)
g.TrimLowFrequencyEdges(edgeCutoff)
- if callTree {
+ if o.CallTree {
if nodesKept := g.SelectTopNodePtrs(nodeCount, visualMode); len(g.Nodes) != len(nodesKept) {
g.TrimTree(nodesKept)
g.SortNodes(cumSort, visualMode)
line int
flat, cum int64
flatDiv, cumDiv int64
- startsBlock bool
}
func (a *assemblyInstruction) flatValue() int64 {
for _, s := range p.Sample {
for key, vals := range s.Label {
for _, val := range vals {
- valueMap, ok := tagMap[key]
- if !ok {
- valueMap = make(map[string]int64)
- tagMap[key] = valueMap
+ if valueMap, ok := tagMap[key]; ok {
+ valueMap[val] = valueMap[val] + s.Value[0]
+ continue
}
- valueMap[val] += o.SampleValue(s.Value)
+ valueMap := make(map[string]int64)
+ valueMap[val] = s.Value[0]
+ tagMap[key] = valueMap
}
}
for key, vals := range s.NumLabel {
for _, nval := range vals {
val := formatTag(nval, key)
- valueMap, ok := tagMap[key]
- if !ok {
- valueMap = make(map[string]int64)
- tagMap[key] = valueMap
+ if valueMap, ok := tagMap[key]; ok {
+ valueMap[val] = valueMap[val] + s.Value[0]
+ continue
}
- valueMap[val] += o.SampleValue(s.Value)
+ valueMap := make(map[string]int64)
+ valueMap[val] = s.Value[0]
+ tagMap[key] = valueMap
}
}
}
for key := range tagMap {
tagKeys = append(tagKeys, &graph.Tag{Name: key})
}
- tabw := tabwriter.NewWriter(w, 0, 0, 1, ' ', tabwriter.AlignRight)
for _, tagKey := range graph.SortTags(tagKeys, true) {
var total int64
key := tagKey.Name
tags = append(tags, &graph.Tag{Name: t, Flat: c})
}
- f, u := measurement.Scale(total, o.SampleUnit, o.OutputUnit)
- fmt.Fprintf(tabw, "%s:\t Total %.1f%s\n", key, f, u)
+ fmt.Fprintf(w, "%s: Total %d\n", key, total)
for _, t := range graph.SortTags(tags, true) {
- f, u := measurement.Scale(t.FlatValue(), o.SampleUnit, o.OutputUnit)
if total > 0 {
- fmt.Fprintf(tabw, " \t%.1f%s (%s):\t %s\n", f, u, percentage(t.FlatValue(), total), t.Name)
+ fmt.Fprintf(w, " %8d (%s): %s\n", t.FlatValue(),
+ percentage(t.FlatValue(), total), t.Name)
} else {
- fmt.Fprintf(tabw, " \t%.1f%s:\t %s\n", f, u, t.Name)
+ fmt.Fprintf(w, " %8d: %s\n", t.FlatValue(), t.Name)
}
}
- fmt.Fprintln(tabw)
+ fmt.Fprintln(w)
}
- return tabw.Flush()
+ return nil
}
// printComments prints all freeform comments in the profile.
var label []string
if len(rpt.options.ProfileLabels) > 0 {
- label = append(label, rpt.options.ProfileLabels...)
+ for _, l := range rpt.options.ProfileLabels {
+ label = append(label, l)
+ }
} else if fullHeaders || !rpt.options.CompactLabels {
label = ProfileLabels(rpt)
}
}
if len(fileNodes) == 0 {
- return fmt.Errorf("No source information for %s", o.Symbol.String())
+ return fmt.Errorf("No source information for %s\n", o.Symbol.String())
}
sourceFiles := make(graph.Nodes, 0, len(fileNodes))
srcBase := filepath.Base(src)
anodes := annotateAssembly(insts, rs, o.base)
var lineno = 0
- var prevline = 0
for _, an := range anodes {
if filepath.Base(an.file) == srcBase {
lineno = an.line
}
if lineno != 0 {
- if lineno != prevline {
- // This instruction starts a new block
- // of contiguous instructions on this line.
- an.startsBlock = true
- }
- prevline = lineno
assembly[lineno] = append(assembly[lineno], an)
}
}
valueOrDot(fn.Flat, rpt), valueOrDot(fn.Cum, rpt),
template.HTMLEscapeString(fn.Info.Name))
fmt.Fprint(w, "<span class=asm>")
- for i, an := range assembly {
- if an.startsBlock && i != 0 {
- // Insert a separator between discontiguous blocks.
- fmt.Fprintf(w, " %8s %30s\n", "", "â‹®")
- }
-
+ for _, an := range assembly {
var fileline string
class := "disasmloc"
if an.file != "" {
if an.cumDiv != 0 {
cum = cum / an.cumDiv
}
- fmt.Fprintf(w, " %8s %10s %10s %8x: %s <span class=%s>%s</span>\n", "",
+ fmt.Fprintf(w, " %8s %10s %10s %8x: %-48s <span class=%s>%s</span>\n", "",
valueOrDot(flat, rpt), valueOrDot(cum, rpt),
an.address,
- template.HTMLEscapeString(fmt.Sprintf("%-48s", strings.Replace(an.instruction, "\t", " ", -1))),
+ template.HTMLEscapeString(an.instruction),
class,
template.HTMLEscapeString(fileline))
}
<!DOCTYPE html>
<html>
<head>
-<meta charset="UTF-8">
<title>Pprof listing</title>
<style type="text/css">
body {
package symbolizer
import (
- "crypto/tls"
"fmt"
"io/ioutil"
"net/http"
// postURL issues a POST to a URL over HTTP.
func postURL(source, post string) ([]byte, error) {
- url, err := url.Parse(source)
- if err != nil {
- return nil, err
- }
-
- var tlsConfig *tls.Config
- if url.Scheme == "https+insecure" {
- tlsConfig = &tls.Config{
- InsecureSkipVerify: true,
- }
- url.Scheme = "https"
- source = url.String()
- }
-
- client := &http.Client{
- Transport: &http.Transport{
- TLSClientConfig: tlsConfig,
- },
- }
- resp, err := client.Post(source, "application/octet-stream", strings.NewReader(post))
+ resp, err := http.Post(source, "application/octet-stream", strings.NewReader(post))
if err != nil {
return nil, fmt.Errorf("http post %s: %v", source, err)
}
}
var mockAddresses = map[uint64][]plugin.Frame{
- 1000: {frame("fun11", "file11.src", 10)},
- 2000: {frame("fun21", "file21.src", 20), frame("fun22", "file22.src", 20)},
- 3000: {frame("fun31", "file31.src", 30), frame("fun32", "file32.src", 30), frame("fun33", "file33.src", 30)},
- 4000: {frame("fun41", "file41.src", 40), frame("fun42", "file42.src", 40), frame("fun43", "file43.src", 40), frame("fun44", "file44.src", 40)},
- 5000: {frame("fun51", "file51.src", 50), frame("fun52", "file52.src", 50), frame("fun53", "file53.src", 50), frame("fun54", "file54.src", 50), frame("fun55", "file55.src", 50)},
+ 1000: []plugin.Frame{frame("fun11", "file11.src", 10)},
+ 2000: []plugin.Frame{frame("fun21", "file21.src", 20), frame("fun22", "file22.src", 20)},
+ 3000: []plugin.Frame{frame("fun31", "file31.src", 30), frame("fun32", "file32.src", 30), frame("fun33", "file33.src", 30)},
+ 4000: []plugin.Frame{frame("fun41", "file41.src", 40), frame("fun42", "file42.src", 40), frame("fun43", "file43.src", 40), frame("fun44", "file44.src", 40)},
+ 5000: []plugin.Frame{frame("fun51", "file51.src", 50), frame("fun52", "file52.src", 50), frame("fun53", "file53.src", 50), frame("fun54", "file54.src", 50), frame("fun55", "file55.src", 50)},
}
func frame(fname, file string, line int) plugin.Frame {
switch pType {
case "heap":
const javaHeapzSamplingRate = 524288 // 512K
- s.NumLabel = map[string][]int64{"bytes": {s.Value[1] / s.Value[0]}}
+ s.NumLabel = map[string][]int64{"bytes": []int64{s.Value[1] / s.Value[0]}}
s.Value[0], s.Value[1] = scaleHeapSample(s.Value[0], s.Value[1], javaHeapzSamplingRate)
case "contention":
if period := p.Period; period != 0 {
}
// Unsymbolizable returns true if a mapping points to a binary for which
-// locations can't be symbolized in principle, at least now. Examples are
-// "[vdso]", [vsyscall]" and some others, see the code.
+// locations can't be symbolized in principle, at least now.
func (m *Mapping) Unsymbolizable() bool {
name := filepath.Base(m.File)
- return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/")
+ return name == "[vdso]" || strings.HasPrefix(name, "linux-vdso") || name == "[heap]" || strings.HasPrefix(m.File, "/dev/dri/")
}
// Copy makes a fully independent copy of a profile.
Location: []*Location{cpuL[0]},
Value: []int64{1000, 1000},
Label: map[string][]string{
- "key1": {"tag1"},
- "key2": {"tag1"},
+ "key1": []string{"tag1"},
+ "key2": []string{"tag1"},
},
},
{
Location: []*Location{cpuL[1], cpuL[0]},
Value: []int64{100, 100},
Label: map[string][]string{
- "key1": {"tag2"},
- "key3": {"tag2"},
+ "key1": []string{"tag2"},
+ "key3": []string{"tag2"},
},
},
{
Location: []*Location{cpuL[2], cpuL[0]},
Value: []int64{10, 10},
Label: map[string][]string{
- "key1": {"tag3"},
- "key2": {"tag2"},
+ "key1": []string{"tag3"},
+ "key2": []string{"tag2"},
},
},
{
Location: []*Location{cpuL[3], cpuL[0]},
Value: []int64{10000, 10000},
Label: map[string][]string{
- "key1": {"tag4"},
- "key2": {"tag1"},
+ "key1": []string{"tag4"},
+ "key2": []string{"tag1"},
},
},
{
Location: []*Location{cpuL[4], cpuL[0]},
Value: []int64{1, 1},
Label: map[string][]string{
- "key1": {"tag4"},
- "key2": {"tag1"},
+ "key1": []string{"tag4"},
+ "key2": []string{"tag1"},
},
},
},
}
var aggTests = map[string]aggTest{
- "precise": {true, true, true, true, 5},
- "fileline": {false, true, true, true, 4},
- "inline_function": {false, true, false, true, 3},
- "function": {false, true, false, false, 2},
+ "precise": aggTest{true, true, true, true, 5},
+ "fileline": aggTest{false, true, true, true, 4},
+ "inline_function": aggTest{false, true, false, true, 3},
+ "function": aggTest{false, true, false, false, 2},
}
type aggTest struct {
func encodeUint64(b *buffer, tag int, x uint64) {
// append varint to b.data
- encodeVarint(b, uint64(tag)<<3)
+ encodeVarint(b, uint64(tag)<<3|0)
encodeVarint(b, x)
}
}
}
+func encodeStringOpt(b *buffer, tag int, x string) {
+ if x == "" {
+ return
+ }
+ encodeString(b, tag, x)
+}
+
func encodeBool(b *buffer, tag int, x bool) {
if x {
encodeUint64(b, tag, 1)
}
func encodeBoolOpt(b *buffer, tag int, x bool) {
- if x {
- encodeBool(b, tag, x)
+ if x == false {
+ return
}
+ encodeBool(b, tag, x)
}
func encodeMessage(b *buffer, tag int, m message) {
{
Location: []*Location{testL[0], testL[1], testL[2], testL[1], testL[1]},
Label: map[string][]string{
- "key1": {"value1"},
- "key2": {"value2"},
+ "key1": []string{"value1"},
+ "key2": []string{"value2"},
},
Value: []int64{10, 20},
},
Location: []*Location{testL[1], testL[2], testL[0], testL[1]},
Value: []int64{30, 40},
Label: map[string][]string{
- "key1": {"value1"},
- "key2": {"value2"},
+ "key1": []string{"value1"},
+ "key2": []string{"value2"},
},
NumLabel: map[string][]int64{
- "key1": {1, 2},
- "key2": {3, 4},
+ "key1": []int64{1, 2},
+ "key2": []int64{3, 4},
},
},
},
"strings"
)
-var (
- reservedNames = []string{"(anonymous namespace)", "operator()"}
- bracketRx = func() *regexp.Regexp {
- var quotedNames []string
- for _, name := range append(reservedNames, "(") {
- quotedNames = append(quotedNames, regexp.QuoteMeta(name))
- }
- return regexp.MustCompile(strings.Join(quotedNames, "|"))
- }()
-)
-
-// simplifyFunc does some primitive simplification of function names.
-func simplifyFunc(f string) string {
- // Account for leading '.' on the PPC ELF v1 ABI.
- funcName := strings.TrimPrefix(f, ".")
- // Account for unsimplified names -- try to remove the argument list by trimming
- // starting from the first '(', but skipping reserved names that have '('.
- for _, ind := range bracketRx.FindAllStringSubmatchIndex(funcName, -1) {
- foundReserved := false
- for _, res := range reservedNames {
- if funcName[ind[0]:ind[1]] == res {
- foundReserved = true
- break
- }
- }
- if !foundReserved {
- funcName = funcName[:ind[0]]
- break
- }
- }
- return funcName
-}
-
// Prune removes all nodes beneath a node matching dropRx, and not
// matching keepRx. If the root node of a Sample matches, the sample
// will have an empty stack.
var i int
for i = len(loc.Line) - 1; i >= 0; i-- {
if fn := loc.Line[i].Function; fn != nil && fn.Name != "" {
- funcName := simplifyFunc(fn.Name)
+ // Account for leading '.' on the PPC ELF v1 ABI.
+ funcName := strings.TrimPrefix(fn.Name, ".")
+ // Account for unsimplified names -- trim starting from the first '('.
+ if index := strings.Index(funcName, "("); index > 0 {
+ funcName = funcName[:index]
+ }
if dropRx.MatchString(funcName) {
if keepRx == nil || !keepRx.MatchString(funcName) {
break
for _, loc := range p.Location {
for i := 0; i < len(loc.Line); i++ {
if fn := loc.Line[i].Function; fn != nil && fn.Name != "" {
- funcName := simplifyFunc(fn.Name)
+ // Account for leading '.' on the PPC ELF v1 ABI.
+ funcName := strings.TrimPrefix(fn.Name, ".")
+ // Account for unsimplified names -- trim starting from the first '('.
+ if index := strings.Index(funcName, "("); index > 0 {
+ funcName = funcName[:index]
+ }
if dropRx.MatchString(funcName) {
// Found matching entry to prune.
pruneBeneath[loc.ID] = true
want string
}{
{in1, out1},
- {in2, out2},
} {
in := test.in.Copy()
in.RemoveUninteresting()
{ID: 4, Name: "fun3", SystemName: "fun3", Filename: "fun.c"},
{ID: 5, Name: "fun4", SystemName: "fun4", Filename: "fun.c"},
{ID: 6, Name: "fun5", SystemName: "fun5", Filename: "fun.c"},
- {ID: 7, Name: "unsimplified_fun(int)", SystemName: "unsimplified_fun(int)", Filename: "fun.c"},
- {ID: 8, Name: "Foo::(anonymous namespace)::Test::Bar", SystemName: "Foo::(anonymous namespace)::Test::Bar", Filename: "fun.c"},
- {ID: 9, Name: "Hello::(anonymous namespace)::World(const Foo::(anonymous namespace)::Test::Bar)", SystemName: "Hello::(anonymous namespace)::World(const Foo::(anonymous namespace)::Test::Bar)", Filename: "fun.c"},
- {ID: 10, Name: "Foo::operator()(::Bar)", SystemName: "Foo::operator()(::Bar)", Filename: "fun.c"},
}
var locs1 = []*Location{
4: 0x0 fun5 fun.c:2 s=0
Mappings
`
-
-var locs2 = []*Location{
- {
- ID: 1,
- Line: []Line{
- {Function: funs[0], Line: 1},
- },
- },
- {
- ID: 2,
- Line: []Line{
- {Function: funs[6], Line: 1},
- },
- },
- {
- ID: 3,
- Line: []Line{
- {Function: funs[7], Line: 1},
- },
- },
- {
- ID: 4,
- Line: []Line{
- {Function: funs[8], Line: 1},
- },
- },
- {
- ID: 5,
- Line: []Line{
- {Function: funs[9], Line: 1},
- },
- },
-}
-
-var in2 = &Profile{
- PeriodType: &ValueType{Type: "cpu", Unit: "milliseconds"},
- Period: 1,
- DurationNanos: 10e9,
- SampleType: []*ValueType{
- {Type: "samples", Unit: "count"},
- {Type: "cpu", Unit: "milliseconds"},
- },
- Sample: []*Sample{
- // Unsimplified name with parameters shouldn't match.
- {
- Location: []*Location{locs2[1], locs2[0]},
- Value: []int64{1, 1},
- },
- // .*Foo::.*::Bar.* should (and will be dropped) regardless of the anonymous namespace.
- {
- Location: []*Location{locs2[2], locs2[0]},
- Value: []int64{1, 1},
- },
- // .*Foo::.*::Bar.* shouldn't match inside the parameter list.
- {
- Location: []*Location{locs2[3], locs2[0]},
- Value: []int64{1, 1},
- },
- // .*operator\(\) should match, regardless of parameters.
- {
- Location: []*Location{locs2[4], locs2[0]},
- Value: []int64{1, 1},
- },
- },
- Location: locs2,
- Function: funs,
- DropFrames: `unsimplified_fun\(int\)|.*Foo::.*::Bar.*|.*operator\(\)`,
-}
-
-const out2 = `PeriodType: cpu milliseconds
-Period: 1
-Duration: 10s
-Samples:
-samples/count cpu/milliseconds
- 1 1: 2 1
- 1 1: 1
- 1 1: 4 1
- 1 1: 1
-Locations
- 1: 0x0 main main.c:1 s=0
- 2: 0x0 unsimplified_fun(int) fun.c:1 s=0
- 3: 0x0 Foo::(anonymous namespace)::Test::Bar fun.c:1 s=0
- 4: 0x0 Hello::(anonymous namespace)::World(const Foo::(anonymous namespace)::Test::Bar) fun.c:1 s=0
- 5: 0x0 Foo::operator()(::Bar) fun.c:1 s=0
-Mappings
-`
{
"canonical": "github.com/google/pprof",
"local": "github.com/google/pprof",
- "revision": "fffc5831a499a958516664a34cb7ba2b9e228793",
- "revisionTime": "2017-05-27T06:02:07Z",
+ "revision": "dec22b42d9eee442222c36c8da24ddc9905e7ee6",
+ "revisionTime": "2017-03-01T19:58:13Z",
},
{
"canonical": "golang.org/x/arch/x86/x86asm",