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
1 answer

profile kubectl using pprof

In the kubernetes source code there is a block of code that handles the profiling part but I can not acces the endpoints: in kubernetes/pkgs/kubelet/server/stats/server.go func (s *Server) InstallProfilingHandler(enableProfilingLogHandler bool,…
Daniel Safta
  • 23
  • 1
  • 6
0
votes
1 answer

CPU profiling not covering all the vCPU time of Apache Beam pipeline on Dataflow

Our pipeline is developed based on the Apache Beam Go SDK. I'm trying to profile the CPU of all workers by setting the flag --cpu_profiling=gs://gs_location:…
Tao Liao
  • 25
  • 5
0
votes
1 answer

Pprof profiler doesnt capture anything

func main() { runtime.SetCPUProfileRate(500) cpuProfiler := "profile.prof" f, _ := os.Create(cpuProfiler) if err := pprof.StartCPUProfile(f); err != nil { log.Fatal("could not start CPU profile: ", err) } defer…
amrx
  • 673
  • 1
  • 9
  • 23
0
votes
0 answers

Trouble parsing "raw" output of `go tool pprof`

I am using Golang's pprof to profile my application. I get this .pb file that I can open using go tool pprof profile.pb And from within the tool I enter (pprof) raw which "Outputs a text representation of the raw profile", according to the docs.…
wheresmycookie
  • 683
  • 3
  • 16
  • 39
0
votes
0 answers

golang profiling running production application without restart

I have a running production golang application. It has memory leakage. Need to find the cause. If I restart with _ "net/http/pprof" issue might not happen again. Because out of 4 servers only this server has this issue I want to profile the running…
naveen
  • 124
  • 9
0
votes
0 answers

Understanding Go pprof statistics

I'm learning how Go profilig works. So I do the following example func Func() { var b [][]byte for i := 0; i < 8; i++ { b = append(b, make([]byte, 8)) } } func BenchmarkFunc(b *testing.B) { for i:=0; i
Yura
  • 969
  • 14
  • 33
0
votes
1 answer

Viewing source code in pprof with bazel built binary

I am trying to profile a binary that I've built under bazel using pprof. I am able to generate a profile, however when I view it in the web UI, I cannot see my code in the source code view. I see ??s instead. Here are the commands I'm…
Dig-Doug
  • 91
  • 8
0
votes
0 answers

go pprof heap profile vs top mem_usage

I am running go application and use pprof to get heap profile of it as below: curl -s http://localhost:/debug/pprof/heap > heap_profile.out go tool pprof heap_profile.out As a result, I get this: Showing nodes accounting for 507.98MB, 99.41%…
Rohanil
  • 1,717
  • 5
  • 22
  • 47
0
votes
1 answer

pprof profile with julienschmidtrouter and benchmarks not profiling handler

I am trying to profile my web server I wrote, but my pprof does not contain any data about the handler func. I am using the httprouter package by julienschmidt, and want to simply benchmark one of my handlers and see the pprof profile for that. For…
skaldesh
  • 1,325
  • 3
  • 15
  • 37
0
votes
1 answer

go pprof doesn't work in different platform

My application is running on CentOS,and when I run curl localhost:port/debug/pprof/profile > some.pprof,and run go tool pprof some.pprof, it works. But When I use scp copying the some.pprof file to my mac and run go tool pprof some.pprof,it doesn't…
caibirdme
  • 371
  • 1
  • 3
  • 15
0
votes
1 answer

pprof (for golang) doesn't show details for my package

I've been trying to profile my go application (evm-specification-miner) with pprof, but the output is not really useful: (pprof) top5 108.59mins of 109.29mins total (99.36%) Dropped 607 nodes (cum <= 0.55mins) Showing top 5 nodes out of 103 (cum >=…
Kegnarok
  • 1
  • 3
0
votes
1 answer

What does runtime.adjustdefers mean in pprof output?

We are running a Go program that spent most of the time doing GC. We took a memory profile and I did a 'go tool pprof -alloc_objects'. I then did a 'top5' in the pprof console and following is what it shows: My question is, what does…
Joe Lin
  • 450
  • 7
  • 20
0
votes
1 answer

profiler not showing function calls (/pgk/profile with pprof)

Edit: worked when i added the the executable to the pprof call I'm trying to profile a simple program with the profiler from https://github.com/pkg/profile: and go tool pprof. package main import "github.com/pkg/profile" func main() { defer…
Pownyan
  • 475
  • 1
  • 6
  • 23
0
votes
1 answer

gperftools not showing call graph results

I've got gperftools installed and collecting data, which looks reasonable so far. I see one node (?) that gets sampled a lot - but I'm interested in the callers to that node - I don't see them? I've tried callgrind/kcachegrind also, I feel like I'm…
Jeff
  • 1,969
  • 3
  • 21
  • 35
0
votes
0 answers

pprof source information from packages

When having open-source Go libraries their code local and running pprof, how could you actually ask pprof to inspect the source of those packages too? I want to look into the Get call of the sessions library, which then goes into Gorilla's…
user1467267
1 2 3
8
9