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
12f4d284
Unverified
Commit
12f4d284
authored
Mar 02, 2018
by
Felix Lange
Committed by
GitHub
Mar 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/debug: add support for mutex profiles (#16230)
parent
49bcb5fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
api.go
internal/debug/api.go
+23
-4
web3ext.go
internal/web3ext/web3ext.go
+15
-0
No files found.
internal/debug/api.go
View file @
12f4d284
...
...
@@ -140,10 +140,9 @@ func (h *HandlerT) GoTrace(file string, nsec uint) error {
return
nil
}
// BlockProfile turns on CPU profiling for nsec seconds 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.
// BlockProfile turns on goroutine profiling for nsec seconds 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.
func
(
*
HandlerT
)
BlockProfile
(
file
string
,
nsec
uint
)
error
{
runtime
.
SetBlockProfileRate
(
1
)
time
.
Sleep
(
time
.
Duration
(
nsec
)
*
time
.
Second
)
...
...
@@ -162,6 +161,26 @@ func (*HandlerT) WriteBlockProfile(file string) error {
return
writeProfile
(
"block"
,
file
)
}
// MutexProfile turns on mutex profiling for nsec seconds 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.
func
(
*
HandlerT
)
MutexProfile
(
file
string
,
nsec
uint
)
error
{
runtime
.
SetMutexProfileFraction
(
1
)
time
.
Sleep
(
time
.
Duration
(
nsec
)
*
time
.
Second
)
defer
runtime
.
SetMutexProfileFraction
(
0
)
return
writeProfile
(
"mutex"
,
file
)
}
// SetMutexProfileFraction sets the rate of mutex profiling.
func
(
*
HandlerT
)
SetMutexProfileFraction
(
rate
int
)
{
runtime
.
SetMutexProfileFraction
(
rate
)
}
// WriteMutexProfile writes a goroutine blocking profile to the given file.
func
(
*
HandlerT
)
WriteMutexProfile
(
file
string
)
error
{
return
writeProfile
(
"mutex"
,
file
)
}
// 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.
...
...
internal/web3ext/web3ext.go
View file @
12f4d284
...
...
@@ -307,6 +307,21 @@ web3._extend({
call: 'debug_writeBlockProfile',
params: 1
}),
new web3._extend.Method({
name: 'mutexProfile',
call: 'debug_mutexProfile',
params: 2
}),
new web3._extend.Method({
name: 'setMutexProfileRate',
call: 'debug_setMutexProfileRate',
params: 1
}),
new web3._extend.Method({
name: 'writeMutexProfile',
call: 'debug_writeMutexProfile',
params: 1
}),
new web3._extend.Method({
name: 'writeMemProfile',
call: 'debug_writeMemProfile',
...
...
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