1
0
mirror of https://github.com/fluencelabs/tendermint synced 2025-06-27 19:51:41 +00:00
Files
.circleci
.github
DOCKER
abci
benchmarks
blockchain
cmd
config
consensus
crypto
docs
evidence
libs
lite
mempool
networks
node
p2p
privval
proxy
rpc
client
core
types
README.md
abci.go
blocks.go
blocks_test.go
consensus.go
dev.go
doc.go
doc_template.txt
events.go
health.go
mempool.go
net.go
pipe.go
pipe_test.go
routes.go
status.go
status_test.go
tx.go
version.go
grpc
lib
test
scripts
state
test
tools
types
version
.editorconfig
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
ROADMAP.md
SECURITY.md
Vagrantfile
appveyor.yml
codecov.yml
docker-compose.yml
tendermint/rpc/core/dev.go

52 lines
1.1 KiB
Go
Raw Normal View History

2016-03-07 18:38:05 -05:00
package core
import (
"os"
"runtime/pprof"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
2016-03-07 18:38:05 -05:00
)
2016-07-12 14:58:06 -04:00
func UnsafeFlushMempool() (*ctypes.ResultUnsafeFlushMempool, error) {
2016-10-14 21:36:42 -04:00
mempool.Flush()
2016-07-12 14:58:06 -04:00
return &ctypes.ResultUnsafeFlushMempool{}, nil
}
2016-03-07 18:38:05 -05:00
var profFile *os.File
2016-03-11 21:45:19 -05:00
func UnsafeStartCPUProfiler(filename string) (*ctypes.ResultUnsafeProfile, error) {
2016-03-07 18:38:05 -05:00
var err error
profFile, err = os.Create(filename)
if err != nil {
return nil, err
}
err = pprof.StartCPUProfile(profFile)
if err != nil {
return nil, err
}
2016-03-11 21:45:19 -05:00
return &ctypes.ResultUnsafeProfile{}, nil
2016-03-07 18:38:05 -05:00
}
2016-03-11 21:45:19 -05:00
func UnsafeStopCPUProfiler() (*ctypes.ResultUnsafeProfile, error) {
2016-03-07 18:38:05 -05:00
pprof.StopCPUProfile()
2017-09-06 11:50:43 -04:00
if err := profFile.Close(); err != nil {
return nil, err
}
2016-03-11 21:45:19 -05:00
return &ctypes.ResultUnsafeProfile{}, nil
}
func UnsafeWriteHeapProfile(filename string) (*ctypes.ResultUnsafeProfile, error) {
memProfFile, err := os.Create(filename)
if err != nil {
return nil, err
}
2017-09-06 11:50:43 -04:00
if err := pprof.WriteHeapProfile(memProfFile); err != nil {
return nil, err
}
if err := memProfFile.Close(); err != nil {
return nil, err
}
2016-03-11 21:45:19 -05:00
return &ctypes.ResultUnsafeProfile{}, nil
2016-03-07 18:38:05 -05:00
}