Coder Social home page Coder Social logo

envpprof's Introduction

envpprof

pkg.go.dev badge

Allows run-time configuration of Go's pprof features and default HTTP mux using the environment variable GOPPROF. Import the package with import _ "github.com/anacrolix/envpprof". envpprof has an init function that will run at process initialization that checks the value of the GOPPROF environment variable. The variable can contain a comma-separated list of values, for example GOPPROF=http,block. The supported keys are:

Key Effect
http Exposes the default HTTP muxer "net/http".DefaultServeMux to the first free TCP port after 6060 on localhost. The process PID, and location are logged automatically when this is enabled. DefaultServeMux is frequently the default location to expose status, and debugging endpoints, including those provided by net/http/pprof. Note that the net/http/pprof import is included with envpprof, and exposed on DefaultServeMux.
cpu Calls "runtime/pprof".StartCPUProfile, writing to a temporary file in $HOME/pprof with the prefix cpu. The file is not removed after use. The name of the file is logged when this is enabled. envpprof.Stop should be deferred from main when this will be used, to ensure proper clean up.
heap This is similar to the cpu key, but writes heap profile information to a file prefixed with heap. The profile will not be written unless Stop is invoked. See cpu for more.
block This calls "runtime".SetBlockProfileRate(1) enabling the profiling of goroutine blocking events. Note that if http is enabled, this exposes the blocking profile at the HTTP path /debug/pprof/block per package net/http/pprof.
mutex This calls "runtime".SetMutexProfileFraction(1) enabling profiling of mutex contention events. Note that if http is enabled, this exposes the profile at the HTTP path /debug/pprof/mutex per package net/http/pprof.

envpprof's People

Contributors

anacrolix avatar jbenet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jbenet roamz

envpprof's Issues

License?

Could you please add a license? BSD or MIT?

Can't compile

Hey,

Have just updated all the packages and now envprof can't compile:

# github.com/anacrolix/envpprof
../../go/src/github.com/anacrolix/envpprof/envpprof.go:28:3: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:33:2: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:53:3: undefined: "github.com/anacrolix/log".Print
../../go/src/github.com/anacrolix/envpprof/envpprof.go:56:2: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:59:3: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:79:4: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:88:5: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:93:5: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:96:4: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:104:4: undefined: "github.com/anacrolix/log".Printf
../../go/src/github.com/anacrolix/envpprof/envpprof.go:104:4: too many errors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.