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
9e9bfc4e
Commit
9e9bfc4e
authored
Oct 14, 2016
by
Nick Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metrics, internal/debug: Add --pprofaddr flag, expose metrics via gexp
parent
c780901c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
flags.go
internal/debug/flags.go
+7
-2
metrics.go
metrics/metrics.go
+2
-0
No files found.
internal/debug/flags.go
View file @
9e9bfc4e
...
@@ -52,6 +52,11 @@ var (
...
@@ -52,6 +52,11 @@ var (
Usage
:
"pprof HTTP server listening port"
,
Usage
:
"pprof HTTP server listening port"
,
Value
:
6060
,
Value
:
6060
,
}
}
pprofAddrFlag
=
cli
.
StringFlag
{
Name
:
"pprofaddr"
,
Usage
:
"pprof HTTP server listening interface"
,
Value
:
"127.0.0.1"
,
}
memprofilerateFlag
=
cli
.
IntFlag
{
memprofilerateFlag
=
cli
.
IntFlag
{
Name
:
"memprofilerate"
,
Name
:
"memprofilerate"
,
Usage
:
"Turn on memory profiling with the given rate"
,
Usage
:
"Turn on memory profiling with the given rate"
,
...
@@ -74,7 +79,7 @@ var (
...
@@ -74,7 +79,7 @@ var (
// Flags holds all command-line flags required for debugging.
// Flags holds all command-line flags required for debugging.
var
Flags
=
[]
cli
.
Flag
{
var
Flags
=
[]
cli
.
Flag
{
verbosityFlag
,
vmoduleFlag
,
backtraceAtFlag
,
verbosityFlag
,
vmoduleFlag
,
backtraceAtFlag
,
pprofFlag
,
pprofPortFlag
,
pprofFlag
,
pprof
AddrFlag
,
pprof
PortFlag
,
memprofilerateFlag
,
blockprofilerateFlag
,
cpuprofileFlag
,
traceFlag
,
memprofilerateFlag
,
blockprofilerateFlag
,
cpuprofileFlag
,
traceFlag
,
}
}
...
@@ -101,7 +106,7 @@ func Setup(ctx *cli.Context) error {
...
@@ -101,7 +106,7 @@ func Setup(ctx *cli.Context) error {
// pprof server
// pprof server
if
ctx
.
GlobalBool
(
pprofFlag
.
Name
)
{
if
ctx
.
GlobalBool
(
pprofFlag
.
Name
)
{
address
:=
fmt
.
Sprintf
(
"
127.0.0.1:%d"
,
ctx
.
GlobalInt
(
pprofPortFlag
.
Name
))
address
:=
fmt
.
Sprintf
(
"
%s:%d"
,
ctx
.
GlobalString
(
pprofAddrFlag
.
Name
)
,
ctx
.
GlobalInt
(
pprofPortFlag
.
Name
))
go
func
()
{
go
func
()
{
glog
.
V
(
logger
.
Info
)
.
Infof
(
"starting pprof server at http://%s/debug/pprof"
,
address
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"starting pprof server at http://%s/debug/pprof"
,
address
)
glog
.
Errorln
(
http
.
ListenAndServe
(
address
,
nil
))
glog
.
Errorln
(
http
.
ListenAndServe
(
address
,
nil
))
...
...
metrics/metrics.go
View file @
9e9bfc4e
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/rcrowley/go-metrics"
"github.com/rcrowley/go-metrics"
"github.com/rcrowley/go-metrics/exp"
)
)
// MetricsEnabledFlag is the CLI flag name to use to enable metrics collections.
// MetricsEnabledFlag is the CLI flag name to use to enable metrics collections.
...
@@ -44,6 +45,7 @@ func init() {
...
@@ -44,6 +45,7 @@ func init() {
Enabled
=
true
Enabled
=
true
}
}
}
}
exp
.
Exp
(
metrics
.
DefaultRegistry
)
}
}
// NewMeter create a new metrics Meter, either a real one of a NOP stub depending
// NewMeter create a new metrics Meter, either a real one of a NOP stub depending
...
...
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