Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
f821b018
Commit
f821b018
authored
May 06, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2518 from fjl/debug-go-trace
internal/debug: also rename debug_startTrace to debug_startGoTrace
parents
a1c201a5
130bccc7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
18 deletions
+16
-18
cmd.go
cmd/utils/cmd.go
+2
-4
api.go
internal/debug/api.go
+3
-3
flags.go
internal/debug/flags.go
+2
-2
trace.go
internal/debug/trace.go
+3
-3
trace_fallback.go
internal/debug/trace_fallback.go
+2
-2
web3ext.go
internal/web3ext/web3ext.go
+4
-4
No files found.
cmd/utils/cmd.go
View file @
f821b018
...
@@ -73,15 +73,13 @@ func StartNode(stack *node.Node) {
...
@@ -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"
)
}()
}()
}
}
...
...
internal/debug/api.go
View file @
f821b018
...
@@ -51,7 +51,7 @@ type HandlerT struct {
...
@@ -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 {
...
@@ -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
.
Start
Go
Trace
(
file
);
err
!=
nil
{
return
err
return
err
}
}
time
.
Sleep
(
time
.
Duration
(
nsec
)
*
time
.
Second
)
time
.
Sleep
(
time
.
Duration
(
nsec
)
*
time
.
Second
)
h
.
StopTrace
()
h
.
Stop
Go
Trace
()
return
nil
return
nil
}
}
...
...
internal/debug/flags.go
View file @
f821b018
...
@@ -89,7 +89,7 @@ func Setup(ctx *cli.Context) error {
...
@@ -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
.
Start
Go
Trace
(
traceFile
);
err
!=
nil
{
return
err
return
err
}
}
}
}
...
@@ -114,5 +114,5 @@ func Setup(ctx *cli.Context) error {
...
@@ -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
.
Stop
Go
Trace
()
}
}
internal/debug/trace.go
View file @
f821b018
...
@@ -27,8 +27,8 @@ import (
...
@@ -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.
// Start
Go
Trace turns on tracing, writing to the given file.
func
(
h
*
HandlerT
)
StartTrace
(
file
string
)
error
{
func
(
h
*
HandlerT
)
Start
Go
Trace
(
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 {
...
@@ -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
)
Stop
Go
Trace
()
error
{
h
.
mu
.
Lock
()
h
.
mu
.
Lock
()
defer
h
.
mu
.
Unlock
()
defer
h
.
mu
.
Unlock
()
trace
.
Stop
()
trace
.
Stop
()
...
...
internal/debug/trace_fallback.go
View file @
f821b018
...
@@ -22,10 +22,10 @@ package debug
...
@@ -22,10 +22,10 @@ package debug
import
"errors"
import
"errors"
func
(
*
HandlerT
)
StartTrace
(
string
)
error
{
func
(
*
HandlerT
)
Start
Go
Trace
(
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
)
Stop
Go
Trace
()
error
{
return
errors
.
New
(
"tracing is not supported on Go < 1.5"
)
return
errors
.
New
(
"tracing is not supported on Go < 1.5"
)
}
}
internal/web3ext/web3ext.go
View file @
f821b018
...
@@ -371,13 +371,13 @@ web3._extend({
...
@@ -371,13 +371,13 @@ web3._extend({
params: 2
params: 2
}),
}),
new web3._extend.Method({
new web3._extend.Method({
name: 'startTrace',
name: 'start
Go
Trace',
call: 'debug_startTrace',
call: 'debug_start
Go
Trace',
params: 1
params: 1
}),
}),
new web3._extend.Method({
new web3._extend.Method({
name: 'stopTrace',
name: 'stop
Go
Trace',
call: 'debug_stopTrace',
call: 'debug_stop
Go
Trace',
params: 0
params: 0
}),
}),
new web3._extend.Method({
new web3._extend.Method({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment