go.net.http.pprof
1.23.1.3
dotnet add package go.net.http.pprof --version 1.23.1.3
NuGet\Install-Package go.net.http.pprof -Version 1.23.1.3
<PackageReference Include="go.net.http.pprof" Version="1.23.1.3" />
<PackageVersion Include="go.net.http.pprof" Version="1.23.1.3" />
<PackageReference Include="go.net.http.pprof" />
paket add go.net.http.pprof --version 1.23.1.3
#r "nuget: go.net.http.pprof, 1.23.1.3"
#:package go.net.http.pprof@1.23.1.3
#addin nuget:?package=go.net.http.pprof&version=1.23.1.3
#tool nuget:?package=go.net.http.pprof&version=1.23.1.3
go.net.http.pprof
C# package converted from the Go standard library by go2cs. Go version: 1.23.1
Package pprof 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/. As of Go 1.22, all the paths must be requested with GET.
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))
}()
By default, all the profiles listed in runtime/pprof.Profile are available (via [Handler]), in addition to the [Cmdline], [Profile], [Symbol], and [Trace] profiles defined in this package. If you are not using DefaultServeMux, you will have to register handlers with the mux you are using.
Parameters
Parameters can be passed via GET query params:
- debug=N (all profiles): response format: N = 0: binary (default), N > 0: plaintext
- gc=N (heap profile): N > 0: run a garbage collection cycle before profiling
- seconds=N (allocs, block, goroutine, heap, mutex, threadcreate profiles): return a delta profile
- seconds=N (cpu (profile), trace profiles): profile for the given duration
Usage examples
Use the pprof tool to look at the heap profile:
go tool pprof http://localhost:6060/debug/pprof/heap
Or to look at a 30-second CPU profile:
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
Or to look at the goroutine blocking profile, after calling runtime.SetBlockProfileRate in your program:
go tool pprof http://localhost:6060/debug/pprof/block
Or to look at the holders of contended mutexes, after calling runtime.SetMutexProfileFraction in your program:
go tool pprof http://localhost:6060/debug/pprof/mutex
The package also exports a handler that serves execution trace data for the "go tool trace" command. To collect a 5-second execution trace:
curl -o trace.out http://localhost:6060/debug/pprof/trace?seconds=5
go tool trace trace.out
To view all available profiles, open http://localhost:6060/debug/pprof/ in your browser.
For a study of the facility in action, visit https://blog.golang.org/2011/06/profiling-go-programs.html.
Part of the go2cs converted Go standard library. See the repository for usage and details.
Copyright 2009 The Go Authors. All rights reserved. This C# package is converted from Go standard library source; use of that source is governed by a BSD-style license that can be found in the LICENSE file. The go2cs conversion itself is distributed under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- go.bufio (>= 1.23.1.3)
- go.bytes (>= 1.23.1.3)
- go.context (>= 1.23.1.3)
- go.fmt (>= 1.23.1.3)
- go.html (>= 1.23.1.3)
- go.internal.godebug (>= 1.23.1.3)
- go.internal.profile (>= 1.23.1.3)
- go.io (>= 1.23.1.3)
- go.lib (>= 1.23.1.3)
- go.log (>= 1.23.1.3)
- go.net.http (>= 1.23.1.3)
- go.net.url (>= 1.23.1.3)
- go.os (>= 1.23.1.3)
- go.runtime (>= 1.23.1.3)
- go.runtime.pprof (>= 1.23.1.3)
- go.runtime.trace (>= 1.23.1.3)
- go.sort (>= 1.23.1.3)
- go.strconv (>= 1.23.1.3)
- go.strings (>= 1.23.1.3)
- go.time (>= 1.23.1.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.