forked from cerc-io/plugeth
Merge pull request #2518 from fjl/debug-go-trace
internal/debug: also rename debug_startTrace to debug_startGoTrace
This commit is contained in:
commit
f821b0188a
@ -73,15 +73,13 @@ func StartNode(stack *node.Node) {
|
|||||||
<-sigc
|
<-sigc
|
||||||
glog.V(logger.Info).Infoln("Got interrupt, shutting down...")
|
glog.V(logger.Info).Infoln("Got interrupt, shutting down...")
|
||||||
go stack.Stop()
|
go stack.Stop()
|
||||||
logger.Flush()
|
|
||||||
for i := 10; i > 0; i-- {
|
for i := 10; i > 0; i-- {
|
||||||
<-sigc
|
<-sigc
|
||||||
if i > 1 {
|
if i > 1 {
|
||||||
glog.V(logger.Info).Infoln("Already shutting down, please be patient.")
|
glog.V(logger.Info).Infof("Already shutting down, interrupt %d more times for panic.", i-1)
|
||||||
glog.V(logger.Info).Infoln("Interrupt", i-1, "more times to induce panic.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(logger.Error).Infof("Force quitting: this might not end so well.")
|
debug.Exit() // ensure trace and CPU profile data is flushed.
|
||||||
debug.LoudPanic("boom")
|
debug.LoudPanic("boom")
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ type HandlerT struct {
|
|||||||
traceFile string
|
traceFile string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verbosity sets the glog verbosity floor.
|
// Verbosity sets the glog verbosity ceiling.
|
||||||
// The verbosity of individual packages and source files
|
// The verbosity of individual packages and source files
|
||||||
// can be raised using Vmodule.
|
// can be raised using Vmodule.
|
||||||
func (*HandlerT) Verbosity(level int) {
|
func (*HandlerT) Verbosity(level int) {
|
||||||
@ -134,11 +134,11 @@ func (h *HandlerT) StopCPUProfile() error {
|
|||||||
// GoTrace turns on tracing for nsec seconds and writes
|
// GoTrace turns on tracing for nsec seconds and writes
|
||||||
// trace data to file.
|
// trace data to file.
|
||||||
func (h *HandlerT) GoTrace(file string, nsec uint) error {
|
func (h *HandlerT) GoTrace(file string, nsec uint) error {
|
||||||
if err := h.StartTrace(file); err != nil {
|
if err := h.StartGoTrace(file); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
time.Sleep(time.Duration(nsec) * time.Second)
|
time.Sleep(time.Duration(nsec) * time.Second)
|
||||||
h.StopTrace()
|
h.StopGoTrace()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ func Setup(ctx *cli.Context) error {
|
|||||||
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
||||||
Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
|
Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
|
||||||
if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
|
if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
|
||||||
if err := Handler.StartTrace(traceFile); err != nil {
|
if err := Handler.StartGoTrace(traceFile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,5 +114,5 @@ func Setup(ctx *cli.Context) error {
|
|||||||
// respective file.
|
// respective file.
|
||||||
func Exit() {
|
func Exit() {
|
||||||
Handler.StopCPUProfile()
|
Handler.StopCPUProfile()
|
||||||
Handler.StopTrace()
|
Handler.StopGoTrace()
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/logger/glog"
|
"github.com/ethereum/go-ethereum/logger/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StartTrace turns on tracing, writing to the given file.
|
// StartGoTrace turns on tracing, writing to the given file.
|
||||||
func (h *HandlerT) StartTrace(file string) error {
|
func (h *HandlerT) StartGoTrace(file string) error {
|
||||||
h.mu.Lock()
|
h.mu.Lock()
|
||||||
defer h.mu.Unlock()
|
defer h.mu.Unlock()
|
||||||
if h.traceW != nil {
|
if h.traceW != nil {
|
||||||
@ -49,7 +49,7 @@ func (h *HandlerT) StartTrace(file string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StopTrace stops an ongoing trace.
|
// StopTrace stops an ongoing trace.
|
||||||
func (h *HandlerT) StopTrace() error {
|
func (h *HandlerT) StopGoTrace() error {
|
||||||
h.mu.Lock()
|
h.mu.Lock()
|
||||||
defer h.mu.Unlock()
|
defer h.mu.Unlock()
|
||||||
trace.Stop()
|
trace.Stop()
|
||||||
|
@ -22,10 +22,10 @@ package debug
|
|||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
func (*HandlerT) StartTrace(string) error {
|
func (*HandlerT) StartGoTrace(string) error {
|
||||||
return errors.New("tracing is not supported on Go < 1.5")
|
return errors.New("tracing is not supported on Go < 1.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*HandlerT) StopTrace() error {
|
func (*HandlerT) StopGoTrace() error {
|
||||||
return errors.New("tracing is not supported on Go < 1.5")
|
return errors.New("tracing is not supported on Go < 1.5")
|
||||||
}
|
}
|
||||||
|
@ -371,13 +371,13 @@ web3._extend({
|
|||||||
params: 2
|
params: 2
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'startTrace',
|
name: 'startGoTrace',
|
||||||
call: 'debug_startTrace',
|
call: 'debug_startGoTrace',
|
||||||
params: 1
|
params: 1
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'stopTrace',
|
name: 'stopGoTrace',
|
||||||
call: 'debug_stopTrace',
|
call: 'debug_stopGoTrace',
|
||||||
params: 0
|
params: 0
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
|
Loading…
Reference in New Issue
Block a user