mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
core: update
This commit is contained in:
parent
0882c4b7ee
commit
f4735fd15a
2 changed files with 6 additions and 46 deletions
|
|
@ -119,7 +119,6 @@ DB commit: %v
|
||||||
Block write: %v
|
Block write: %v
|
||||||
Total: %v
|
Total: %v
|
||||||
|
|
||||||
%s
|
|
||||||
%s
|
%s
|
||||||
##############################
|
##############################
|
||||||
`, block.Number(), block.Hash(), len(block.Transactions()), s.MgasPerSecond,
|
`, block.Number(), block.Hash(), len(block.Transactions()), s.MgasPerSecond,
|
||||||
|
|
@ -128,8 +127,11 @@ Total: %v
|
||||||
common.PrettyDuration(s.StorageReads), s.StorageLoaded,
|
common.PrettyDuration(s.StorageReads), s.StorageLoaded,
|
||||||
common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates+s.StorageCommits+s.StorageUpdates),
|
common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates+s.StorageCommits+s.StorageUpdates),
|
||||||
common.PrettyDuration(s.TrieDBCommit+s.SnapshotCommit), common.PrettyDuration(s.BlockWrite),
|
common.PrettyDuration(s.TrieDBCommit+s.SnapshotCommit), common.PrettyDuration(s.BlockWrite),
|
||||||
common.PrettyDuration(s.TotalTime), s.StateReadCacheStats, s.StatePrefetchCacheStats)
|
common.PrettyDuration(s.TotalTime), s.StateReadCacheStats)
|
||||||
for _, line := range strings.Split(msg, "\n") {
|
for _, line := range strings.Split(msg, "\n") {
|
||||||
|
if line == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
log.Info(line)
|
log.Info(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,6 @@ type ReaderStats struct {
|
||||||
AccountCacheMiss int64
|
AccountCacheMiss int64
|
||||||
StorageCacheHit int64
|
StorageCacheHit int64
|
||||||
StorageCacheMiss int64
|
StorageCacheMiss int64
|
||||||
|
|
||||||
// Disk stats
|
|
||||||
AccountDiskHit int64
|
|
||||||
AccountDiskMiss int64
|
|
||||||
StorageDiskHit int64
|
|
||||||
StorageDiskMiss int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements fmt.Stringer, returning string format statistics.
|
// String implements fmt.Stringer, returning string format statistics.
|
||||||
|
|
@ -105,26 +99,16 @@ func (s ReaderStats) String() string {
|
||||||
var (
|
var (
|
||||||
accountCacheHitRate float64
|
accountCacheHitRate float64
|
||||||
storageCacheHitRate float64
|
storageCacheHitRate float64
|
||||||
accountDiskHitRate float64
|
|
||||||
storageDiskHitRate float64
|
|
||||||
)
|
)
|
||||||
if s.AccountCacheHit > 0 {
|
if s.AccountCacheHit > 0 {
|
||||||
accountCacheHitRate = float64(s.AccountCacheHit) / float64(s.AccountCacheHit+s.AccountCacheMiss) * 100
|
accountCacheHitRate = float64(s.AccountCacheHit) / float64(s.AccountCacheHit+s.AccountCacheMiss) * 100
|
||||||
}
|
}
|
||||||
if s.AccountDiskHit > 0 {
|
|
||||||
accountDiskHitRate = float64(s.AccountDiskHit) / float64(s.AccountDiskHit+s.AccountDiskMiss) * 100
|
|
||||||
}
|
|
||||||
if s.StorageCacheHit > 0 {
|
if s.StorageCacheHit > 0 {
|
||||||
storageCacheHitRate = float64(s.StorageCacheHit) / float64(s.StorageCacheHit+s.StorageCacheMiss) * 100
|
storageCacheHitRate = float64(s.StorageCacheHit) / float64(s.StorageCacheHit+s.StorageCacheMiss) * 100
|
||||||
}
|
}
|
||||||
if s.StorageDiskHit > 0 {
|
|
||||||
storageDiskHitRate = float64(s.StorageDiskHit) / float64(s.StorageDiskHit+s.StorageDiskMiss) * 100
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf("Reader statistics\n")
|
msg := fmt.Sprintf("Reader statistics\n")
|
||||||
msg += fmt.Sprintf("account: cache (hit: %d, miss: %d, rate: %.2f)\n", s.AccountCacheHit, s.AccountCacheMiss, accountCacheHitRate)
|
msg += fmt.Sprintf("account: hit: %d, miss: %d, rate: %.2f\n", s.AccountCacheHit, s.AccountCacheMiss, accountCacheHitRate)
|
||||||
msg += fmt.Sprintf("account: disk (hit: %d, miss: %d, rate: %.2f)\n", s.AccountDiskHit, s.AccountDiskMiss, accountDiskHitRate)
|
msg += fmt.Sprintf("storage: hit: %d, miss: %d, rate: %.2f\n", s.StorageCacheHit, s.StorageCacheMiss, storageCacheHitRate)
|
||||||
msg += fmt.Sprintf("storage: cache (hit: %d, miss: %d, rate: %.2f)\n", s.StorageCacheHit, s.StorageCacheMiss, storageCacheHitRate)
|
|
||||||
msg += fmt.Sprintf("storage: disk (hit: %d, miss: %d, rate: %.2f)\n", s.StorageDiskHit, s.StorageDiskMiss, storageDiskHitRate)
|
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -564,11 +548,6 @@ type readerWithCacheStats struct {
|
||||||
accountCacheMiss atomic.Int64
|
accountCacheMiss atomic.Int64
|
||||||
storageCacheHit atomic.Int64
|
storageCacheHit atomic.Int64
|
||||||
storageCacheMiss atomic.Int64
|
storageCacheMiss atomic.Int64
|
||||||
|
|
||||||
accountDiskHit atomic.Int64
|
|
||||||
accountDiskMiss atomic.Int64
|
|
||||||
storageDiskHit atomic.Int64
|
|
||||||
storageDiskMiss atomic.Int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newReaderWithCacheStats constructs the reader with additional statistics tracked.
|
// newReaderWithCacheStats constructs the reader with additional statistics tracked.
|
||||||
|
|
@ -591,14 +570,6 @@ func (r *readerWithCacheStats) Account(addr common.Address) (*types.StateAccount
|
||||||
r.accountCacheHit.Add(1)
|
r.accountCacheHit.Add(1)
|
||||||
} else {
|
} else {
|
||||||
r.accountCacheMiss.Add(1)
|
r.accountCacheMiss.Add(1)
|
||||||
|
|
||||||
// If the account was read from the underlying storage, count
|
|
||||||
// the presence statistics.
|
|
||||||
if account == nil {
|
|
||||||
r.accountDiskMiss.Add(1)
|
|
||||||
} else {
|
|
||||||
r.accountDiskHit.Add(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return account, nil
|
return account, nil
|
||||||
}
|
}
|
||||||
|
|
@ -617,14 +588,6 @@ func (r *readerWithCacheStats) Storage(addr common.Address, slot common.Hash) (c
|
||||||
r.storageCacheHit.Add(1)
|
r.storageCacheHit.Add(1)
|
||||||
} else {
|
} else {
|
||||||
r.storageCacheMiss.Add(1)
|
r.storageCacheMiss.Add(1)
|
||||||
|
|
||||||
// If the slot was read from the underlying storage, count
|
|
||||||
// the presence statistics.
|
|
||||||
if value == (common.Hash{}) {
|
|
||||||
r.storageDiskMiss.Add(1)
|
|
||||||
} else {
|
|
||||||
r.storageDiskHit.Add(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return value, nil
|
return value, nil
|
||||||
}
|
}
|
||||||
|
|
@ -636,10 +599,5 @@ func (r *readerWithCacheStats) GetStats() ReaderStats {
|
||||||
AccountCacheMiss: r.accountCacheMiss.Load(),
|
AccountCacheMiss: r.accountCacheMiss.Load(),
|
||||||
StorageCacheHit: r.storageCacheHit.Load(),
|
StorageCacheHit: r.storageCacheHit.Load(),
|
||||||
StorageCacheMiss: r.storageCacheMiss.Load(),
|
StorageCacheMiss: r.storageCacheMiss.Load(),
|
||||||
|
|
||||||
AccountDiskHit: r.accountDiskHit.Load(),
|
|
||||||
AccountDiskMiss: r.accountDiskMiss.Load(),
|
|
||||||
StorageDiskHit: r.storageDiskHit.Load(),
|
|
||||||
StorageDiskMiss: r.storageDiskMiss.Load(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue