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
21f1370d
Commit
21f1370d
authored
Jan 10, 2017
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: improve import log alignment
parent
02b67558
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
blockchain.go
core/blockchain.go
+7
-9
headerchain.go
core/headerchain.go
+1
-1
No files found.
core/blockchain.go
View file @
21f1370d
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
...
@@ -799,7 +800,7 @@ func (self *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain
...
@@ -799,7 +800,7 @@ func (self *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain
if
stats
.
ignored
>
0
{
if
stats
.
ignored
>
0
{
ignored
=
fmt
.
Sprintf
(
" (%d ignored)"
,
stats
.
ignored
)
ignored
=
fmt
.
Sprintf
(
" (%d ignored)"
,
stats
.
ignored
)
}
}
glog
.
V
(
logger
.
Info
)
.
Infof
(
"imported %d receipts in %9v. #%d [%x… / %x…]%s"
,
stats
.
processed
,
common
.
PrettyDuration
(
time
.
Since
(
start
)),
last
.
Number
(),
first
.
Hash
()
.
Bytes
()[
:
4
],
last
.
Hash
()
.
Bytes
()[
:
4
],
ignored
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"imported %
4
d receipts in %9v. #%d [%x… / %x…]%s"
,
stats
.
processed
,
common
.
PrettyDuration
(
time
.
Since
(
start
)),
last
.
Number
(),
first
.
Hash
()
.
Bytes
()[
:
4
],
last
.
Hash
()
.
Bytes
()[
:
4
],
ignored
)
return
0
,
nil
return
0
,
nil
}
}
...
@@ -875,7 +876,7 @@ func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) {
...
@@ -875,7 +876,7 @@ func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) {
// faster than direct delivery and requires much less mutex
// faster than direct delivery and requires much less mutex
// acquiring.
// acquiring.
var
(
var
(
stats
=
insertStats
{
startTime
:
time
.
Now
()}
stats
=
insertStats
{
startTime
:
mclock
.
Now
()}
events
=
make
([]
interface
{},
0
,
len
(
chain
))
events
=
make
([]
interface
{},
0
,
len
(
chain
))
coalescedLogs
[]
*
types
.
Log
coalescedLogs
[]
*
types
.
Log
nonceChecked
=
make
([]
bool
,
len
(
chain
))
nonceChecked
=
make
([]
bool
,
len
(
chain
))
...
@@ -1031,7 +1032,7 @@ type insertStats struct {
...
@@ -1031,7 +1032,7 @@ type insertStats struct {
queued
,
processed
,
ignored
int
queued
,
processed
,
ignored
int
usedGas
uint64
usedGas
uint64
lastIndex
int
lastIndex
int
startTime
time
.
Time
startTime
mclock
.
Abs
Time
}
}
// statsReportLimit is the time limit during import after which we always print
// statsReportLimit is the time limit during import after which we always print
...
@@ -1043,12 +1044,9 @@ const statsReportLimit = 8 * time.Second
...
@@ -1043,12 +1044,9 @@ const statsReportLimit = 8 * time.Second
func
(
st
*
insertStats
)
report
(
chain
[]
*
types
.
Block
,
index
int
)
{
func
(
st
*
insertStats
)
report
(
chain
[]
*
types
.
Block
,
index
int
)
{
// Fetch the timings for the batch
// Fetch the timings for the batch
var
(
var
(
now
=
time
.
Now
()
now
=
mclock
.
Now
()
elapsed
=
now
.
Sub
(
st
.
startTime
)
elapsed
=
time
.
Duration
(
now
)
-
time
.
Duration
(
st
.
startTime
)
)
)
if
elapsed
==
0
{
// Yes Windows, I'm looking at you
elapsed
=
1
}
// If we're at the last block of the batch or report period reached, log
// If we're at the last block of the batch or report period reached, log
if
index
==
len
(
chain
)
-
1
||
elapsed
>=
statsReportLimit
{
if
index
==
len
(
chain
)
-
1
||
elapsed
>=
statsReportLimit
{
start
,
end
:=
chain
[
st
.
lastIndex
],
chain
[
index
]
start
,
end
:=
chain
[
st
.
lastIndex
],
chain
[
index
]
...
@@ -1063,7 +1061,7 @@ func (st *insertStats) report(chain []*types.Block, index int) {
...
@@ -1063,7 +1061,7 @@ func (st *insertStats) report(chain []*types.Block, index int) {
}
else
{
}
else
{
hashes
=
fmt
.
Sprintf
(
"%x…"
,
end
.
Hash
()
.
Bytes
()[
:
4
])
hashes
=
fmt
.
Sprintf
(
"%x…"
,
end
.
Hash
()
.
Bytes
()[
:
4
])
}
}
glog
.
Infof
(
"imported %d blocks, %5d txs (%7.3f Mg) in %9v (%6.3f Mg/s). #%v [%s]%s"
,
st
.
processed
,
txcount
,
float64
(
st
.
usedGas
)
/
1000000
,
common
.
PrettyDuration
(
elapsed
),
float64
(
st
.
usedGas
)
*
1000
/
float64
(
elapsed
),
end
.
Number
(),
hashes
,
extra
)
glog
.
Infof
(
"imported %
4
d blocks, %5d txs (%7.3f Mg) in %9v (%6.3f Mg/s). #%v [%s]%s"
,
st
.
processed
,
txcount
,
float64
(
st
.
usedGas
)
/
1000000
,
common
.
PrettyDuration
(
elapsed
),
float64
(
st
.
usedGas
)
*
1000
/
float64
(
elapsed
),
end
.
Number
(),
hashes
,
extra
)
*
st
=
insertStats
{
startTime
:
now
,
lastIndex
:
index
}
*
st
=
insertStats
{
startTime
:
now
,
lastIndex
:
index
}
}
}
...
...
core/headerchain.go
View file @
21f1370d
...
@@ -339,7 +339,7 @@ func (hc *HeaderChain) InsertHeaderChain(chain []*types.Header, checkFreq int, w
...
@@ -339,7 +339,7 @@ func (hc *HeaderChain) InsertHeaderChain(chain []*types.Header, checkFreq int, w
if
stats
.
ignored
>
0
{
if
stats
.
ignored
>
0
{
ignored
=
fmt
.
Sprintf
(
" (%d ignored)"
,
stats
.
ignored
)
ignored
=
fmt
.
Sprintf
(
" (%d ignored)"
,
stats
.
ignored
)
}
}
glog
.
V
(
logger
.
Info
)
.
Infof
(
"imported %d headers%s in %9v. #%v [%x… / %x…]"
,
stats
.
processed
,
ignored
,
common
.
PrettyDuration
(
time
.
Since
(
start
)),
last
.
Number
,
first
.
Hash
()
.
Bytes
()[
:
4
],
last
.
Hash
()
.
Bytes
()[
:
4
])
glog
.
V
(
logger
.
Info
)
.
Infof
(
"imported %
4
d headers%s in %9v. #%v [%x… / %x…]"
,
stats
.
processed
,
ignored
,
common
.
PrettyDuration
(
time
.
Since
(
start
)),
last
.
Number
,
first
.
Hash
()
.
Bytes
()[
:
4
],
last
.
Hash
()
.
Bytes
()[
:
4
])
return
0
,
nil
return
0
,
nil
}
}
...
...
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