Questions tagged [pprof]

pprof is a golang package used to profile various runtime properties of golang's http server.

Golang's pprof package serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.

The package is typically only imported for the side effect of registering its HTTP handlers. The handled paths all begin with /debug/pprof/.

To use pprof, link this package into your program:

import _ "net/http/pprof"

If your application is not already running an http server, you need to start one. Add "net/http" and "log" to your imports and the following code to your main function:

go func() {
    log.Println(http.ListenAndServe("localhost:6060", nil))
}()

Then use the pprof tool to look at the heap profile:

go tool pprof http://localhost:6060/debug/pprof/heap

Useful links

133 questions
0
votes
0 answers

Go tool pprof list command gives 'Syntax error: "(" unexpected'

I've got a cpu profile file that I've been examining for a bottleneck in my code and using the commands like top10 works fine. However, when I want to look at the source code listing by typing list Remove Where Remove is the function I want to…
Chilly
  • 578
  • 4
  • 11
0
votes
1 answer

Golang profiling appengine tests

I appear to have a memory leak related to receiving large files and sending them to GCS. Trying to use pprof to profile memory usage for my appengine code. My tests use appengine/aetest and I can output the memory profile, but the results don't seem…
tgreiser
  • 393
  • 3
  • 13
0
votes
1 answer

exec.Command does not register error from Go's own pprof tool

Here is my code: cmd := exec.Command("go", "tool", "pprof", "-dot", "-lines", "http://google.com") out, err := cmd.Output() if err != nil { panic(err) } println(string(out)) When I run the exact same command in my console, I see: $ go tool…
Ben Sandler
  • 2,223
  • 5
  • 26
  • 36
0
votes
0 answers

pprof, No nodes to print

I have a memory leak in a small program. In order to find the leak, I would like to use pprof. I set it up like this: func main() { f, _ := os.Create("my_pprof.pprof") pprof.StartCPUProfile(f) go func() { main2() }() …
Julio
  • 2,493
  • 4
  • 33
  • 53
-1
votes
2 answers

memory consumption at encoding base64

I have problems with memory consumption at my software using golangs lib encoding/base64 My software is splitting a videofile to separate images, (gocv mat) converting them to base64 string and saving it to file in json format. During testing I…
-1
votes
1 answer

How do I analyze a bunch of profiles

I have a bunch of profiles about my application(200+ profiles per week), I want to analyze them for getting some performance information. I don't know what information can be analyzed from these files, maybe the slowest function or the hot-spot code…
fu4ng
  • 27
  • 4
-1
votes
1 answer

How to benchmark channel / mutex memory consumption / allocation?

I try to compare using channel for one value vs using mutex. Channel example: func BenchmarkNewDummy(b *testing.B) { one := make(chan string, 1) two := make(chan string, 1) var wg sync.WaitGroup wg.Add(2) go doWork(&wg, one) …
Sergii Getman
  • 3,845
  • 5
  • 34
  • 50
-1
votes
1 answer

Go Profiling - Wrong file

I'm doing profiling in Go using github.com/pkg/profile and it's creating the file when I run my code, but the return comes from the example page code, how would it be to run through my code? thanks in advance Code: package main import ( "fmt" …
Henrique Buzin
  • 99
  • 1
  • 2
  • 7
-1
votes
1 answer

Why is "MOVQ 0x30(SP), DX" slow?

Please see the following pprof session. In the treesort.add, line 42, there's an int comparison. I think it accounts for 64% of all cpu time. In disasm the operation is "MOVQ 0x30(SP), DX". Why is it so slow? File: treesort_bench.test.exe Type:…
-2
votes
1 answer

What is the best way to detect memory leak in go micro service running on production

I need to know some efficient way / tools in golang that will help us to detect memory leak in the micro service that is live and running on production
Irfan21
  • 17
-2
votes
1 answer

How to profile multiple goroutines

I want to profile a server written in Go. I am using "net/http/pprof", but the default behaviour is utterly useless, as it seems to only profile the goroutine running the server that serves the profiling data.
Joonazan
  • 1,408
  • 10
  • 18
-4
votes
1 answer

What does Go's pprof stand for?

pprof is a profiling tool of Go. But what does the word pprof stand for? It might be a silly question but I can't get an answer of it from anywhere. Google's pprof source code Go blog article about pprof
Coconut
  • 2,024
  • 18
  • 25
-4
votes
1 answer

How to analyze this Golang cpu pprof snapshot?

This problem occurs about 10 minutes after the program starts. CPU costs 300%. What's the problem? stackoverflow doesn't support .svg image. Please download the .svg file uploaded to github. https://github.com/.../raw/master/pprof001.svg
Dr.Nemo
  • 1,451
  • 2
  • 11
  • 15
1 2 3
8
9