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
88a593d5
Unverified
Commit
88a593d5
authored
Oct 19, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth, trie: report on trie cache unloads, also add debug log
parent
5d9bb0a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
chaincmd.go
cmd/geth/chaincmd.go
+2
-1
statedb.go
core/state/statedb.go
+2
-0
trie.go
trie/trie.go
+7
-0
No files found.
cmd/geth/chaincmd.go
View file @
88a593d5
...
...
@@ -99,7 +99,8 @@ func importChain(ctx *cli.Context) error {
utils
.
Fatalf
(
"Failed to read database stats: %v"
,
err
)
}
fmt
.
Println
(
stats
)
fmt
.
Printf
(
"Trie cache misses: %d
\n\n
"
,
trie
.
CacheMisses
())
fmt
.
Printf
(
"Trie cache misses: %d
\n
"
,
trie
.
CacheMisses
())
fmt
.
Printf
(
"Trie cache unloads: %d
\n\n
"
,
trie
.
CacheUnloads
())
// Compact the entire database to more accurately measure disk io and print the stats
start
=
time
.
Now
()
...
...
core/state/statedb.go
View file @
88a593d5
...
...
@@ -564,6 +564,8 @@ func (s *StateDB) Commit() (root common.Hash, err error) {
func
(
s
*
StateDB
)
CommitBatch
()
(
root
common
.
Hash
,
batch
ethdb
.
Batch
)
{
batch
=
s
.
db
.
NewBatch
()
root
,
_
=
s
.
commit
(
batch
)
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Trie cache stats: %d misses, %d unloads"
,
trie
.
CacheMisses
(),
trie
.
CacheUnloads
())
return
root
,
batch
}
...
...
trie/trie.go
View file @
88a593d5
...
...
@@ -47,6 +47,13 @@ func CacheMisses() int64 {
return
cacheMissCounter
.
Count
()
}
// CacheUnloads retrieves a global counter measuring the number of cache unloads
// the trie did since process startup. This isn't useful for anything apart from
// trie debugging purposes.
func
CacheUnloads
()
int64
{
return
cacheUnloadCounter
.
Count
()
}
func
init
()
{
sha3
.
NewKeccak256
()
.
Sum
(
emptyState
[
:
0
])
}
...
...
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