MCPcopy Index your code
hub / github.com/pkg/profile

github.com/pkg/profile @v1.7.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.7.0 ↗ · + Follow
37 symbols 98 edges 4 files 24 documented · 65% 40 cross-repo links updated 3y agov1.7.0 · 2022-10-20★ 2,05910 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

profile

Simple profiling support package for Go

Build Status GoDoc

installation

go get github.com/pkg/profile

usage

Enabling profiling in your application is as simple as one line at the top of your main function

import "github.com/pkg/profile"

func main() {
    defer profile.Start().Stop()
    ...
}

options

What to profile is controlled by config value passed to profile.Start. By default CPU profiling is enabled.

import "github.com/pkg/profile"

func main() {
    // p.Stop() must be called before the program exits to
    // ensure profiling information is written to disk.
    p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
    ...
    // You can enable different kinds of memory profiling, either Heap or Allocs where Heap
    // profiling is the default with profile.MemProfile.
    p := profile.Start(profile.MemProfileAllocs, profile.ProfilePath("."), profile.NoShutdownHook)
}

Several convenience package level values are provided for cpu, memory, and block (contention) profiling.

For more complex options, consult the documentation.

contributing

We welcome pull requests, bug fixes and issue reports.

Before proposing a change, please discuss it first by raising an issue.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Stop
called by 15
profile.go
Start
called by 13
profile.go
MemProfileRate
called by 1
profile.go
ProfilePath
called by 1
profile.go
NoShutdownHook
called by 0
profile.go
Quiet
called by 0
profile.go
CPUProfile
called by 0
profile.go
MemProfile
called by 0
profile.go

Shape

Function 34
FuncType 1
Method 1
Struct 1

Languages

Go100%

Modules by API surface

profile.go17 symbols
profile_test.go10 symbols
example_test.go9 symbols
trace_test.go1 symbols

For agents

$ claude mcp add profile \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page