Profiling
debug_blockProfile
Turns on block profiling for the given duration and writes profile data to disk. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually using debug_writeBlockProfile.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling result. |
seconds | int | The profiling duration in seconds. |
Return Value
None
Example
Console
HTTP RPC
debug_cpuProfile
Turns on CPU profiling for the given duration and writes profile data to disk.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling result. |
seconds | int | The profiling duration in seconds. |
Return Value
None
Example
Console
HTTP RPC
debug_mutexProfile
Turns on mutex profiling for nsec (nanosecond) and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling result. |
seconds | int | The profiling duration in seconds. |
Return Value
None
Example
Console
HTTP RPC
debug_isPProfRunning
Returns true
if the pprof HTTP server is running and false
otherwise.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
None
Return Value
Type | Description |
---|---|
bool |
|
Example
Console
HTTP RPC
debug_setBlockProfileRate
Sets the rate (in samples/sec) of goroutine block profile data collection. A non-zero rate enables block profiling, setting it to zero stops the profile. Collected profile data can be written using debug_writeBlockProfile.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
rate | int | The profiling rate in samples/sec. |
Return Value
None
Example
Console
HTTP RPC
debug_startCPUProfile
Turns on CPU profiling indefinitely, writing to the given file.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling output. |
Return Value
None
Example
Console
HTTP RPC
debug_stopCPUProfile
Turns off CPU profiling.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
None
Return Value
None
Example
Console
HTTP RPC
debug_startPProf
Starts the pprof HTTP server. The running pprof server can be accessed by (when the default configuration, i.e., localhost:6060, is used):
http://localhost:6060/debug/pprof (for the pprof results)
http://localhost:6060/memsize/ (for the memory size reports)
http://localhost:6060/debug/vars (for the metrics)
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
address | string | (optional) pprof HTTP server listening interface (default: "127.0.0.1"). |
port | int | (optional) pprof HTTP server listening port (default: 6060). |
Return Value
None
Example
Console
HTTP RPC
debug_stopPProf
Stops the pprof HTTP server.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
None
Return Value
None
Example
Console
HTTP RPC
debug_writeBlockProfile
Writes a goroutine blocking profile to the given file.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling output. |
Return Value
None
Example
Console
HTTP RPC
debug_writeMemProfile
Writes an allocation profile to the given file. Note that the profiling rate cannot be set through the API, it must be set on the command line using the --memprofilerate
flag.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling output. |
Return Value
None
Example
Console
HTTP RPC
debug_writeMutexProfile
Writes a goroutine blocking profile to the given file.
Client | Method Invocation |
---|---|
Console |
|
RPC |
|
Parameters
Name | Type | Description |
---|---|---|
file | string | The filename for the profiling output. |
Return Value
None
Example
Console
HTTP RPC
Last updated