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
d48e6ae6
Commit
d48e6ae6
authored
Oct 19, 2016
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trie: make the cache miss counter a real metric
parent
ca49510e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
trie.go
trie/trie.go
+5
-7
No files found.
trie/trie.go
View file @
d48e6ae6
...
...
@@ -20,12 +20,12 @@ package trie
import
(
"bytes"
"fmt"
"sync/atomic"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/rcrowley/go-metrics"
)
var
(
...
...
@@ -35,15 +35,13 @@ var (
emptyState
common
.
Hash
)
// cacheMisses maintains the number of times a trie node was loaded from disk.
// Always use atomic operations when accessing this global variable.
var
cacheMisses
uint64
var
cacheMissCounter
=
metrics
.
NewRegisteredCounter
(
"trie/cachemiss"
,
nil
)
// CacheMisses retrieves a global counter measuring the number of cache misses
// the trie did since process startup. This isn't useful for anything apart from
// trie debugging purposes.
func
CacheMisses
()
u
int64
{
return
atomic
.
LoadUint64
(
&
cacheMisses
)
func
CacheMisses
()
int64
{
return
cacheMissCounter
.
Count
(
)
}
func
init
()
{
...
...
@@ -432,7 +430,7 @@ func (t *Trie) resolve(n node, prefix, suffix []byte) (node, error) {
}
func
(
t
*
Trie
)
resolveHash
(
n
hashNode
,
prefix
,
suffix
[]
byte
)
(
node
,
error
)
{
atomic
.
AddUint64
(
&
cacheMisses
,
1
)
cacheMissCounter
.
Inc
(
1
)
enc
,
err
:=
t
.
db
.
Get
(
n
)
if
err
!=
nil
||
enc
==
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