Skip to content

Commit f4735fd

Browse files
committed
core: update
1 parent 0882c4b commit f4735fd

File tree

2 files changed

+6
-46
lines changed

2 files changed

+6
-46
lines changed

core/blockchain_stats.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ DB commit: %v
119119
Block write: %v
120120
Total: %v
121121
122-
%s
123122
%s
124123
##############################
125124
`, block.Number(), block.Hash(), len(block.Transactions()), s.MgasPerSecond,
@@ -128,8 +127,11 @@ Total: %v
128127
common.PrettyDuration(s.StorageReads), s.StorageLoaded,
129128
common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates+s.StorageCommits+s.StorageUpdates),
130129
common.PrettyDuration(s.TrieDBCommit+s.SnapshotCommit), common.PrettyDuration(s.BlockWrite),
131-
common.PrettyDuration(s.TotalTime), s.StateReadCacheStats, s.StatePrefetchCacheStats)
130+
common.PrettyDuration(s.TotalTime), s.StateReadCacheStats)
132131
for _, line := range strings.Split(msg, "\n") {
132+
if line == "" {
133+
continue
134+
}
133135
log.Info(line)
134136
}
135137
}

core/state/reader.go

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -92,39 +92,23 @@ type ReaderStats struct {
9292
AccountCacheMiss int64
9393
StorageCacheHit int64
9494
StorageCacheMiss int64
95-
96-
// Disk stats
97-
AccountDiskHit int64
98-
AccountDiskMiss int64
99-
StorageDiskHit int64
100-
StorageDiskMiss int64
10195
}
10296

10397
// String implements fmt.Stringer, returning string format statistics.
10498
func (s ReaderStats) String() string {
10599
var (
106100
accountCacheHitRate float64
107101
storageCacheHitRate float64
108-
accountDiskHitRate float64
109-
storageDiskHitRate float64
110102
)
111103
if s.AccountCacheHit > 0 {
112104
accountCacheHitRate = float64(s.AccountCacheHit) / float64(s.AccountCacheHit+s.AccountCacheMiss) * 100
113105
}
114-
if s.AccountDiskHit > 0 {
115-
accountDiskHitRate = float64(s.AccountDiskHit) / float64(s.AccountDiskHit+s.AccountDiskMiss) * 100
116-
}
117106
if s.StorageCacheHit > 0 {
118107
storageCacheHitRate = float64(s.StorageCacheHit) / float64(s.StorageCacheHit+s.StorageCacheMiss) * 100
119108
}
120-
if s.StorageDiskHit > 0 {
121-
storageDiskHitRate = float64(s.StorageDiskHit) / float64(s.StorageDiskHit+s.StorageDiskMiss) * 100
122-
}
123109
msg := fmt.Sprintf("Reader statistics\n")
124-
msg += fmt.Sprintf("account: cache (hit: %d, miss: %d, rate: %.2f)\n", s.AccountCacheHit, s.AccountCacheMiss, accountCacheHitRate)
125-
msg += fmt.Sprintf("account: disk (hit: %d, miss: %d, rate: %.2f)\n", s.AccountDiskHit, s.AccountDiskMiss, accountDiskHitRate)
126-
msg += fmt.Sprintf("storage: cache (hit: %d, miss: %d, rate: %.2f)\n", s.StorageCacheHit, s.StorageCacheMiss, storageCacheHitRate)
127-
msg += fmt.Sprintf("storage: disk (hit: %d, miss: %d, rate: %.2f)\n", s.StorageDiskHit, s.StorageDiskMiss, storageDiskHitRate)
110+
msg += fmt.Sprintf("account: hit: %d, miss: %d, rate: %.2f\n", s.AccountCacheHit, s.AccountCacheMiss, accountCacheHitRate)
111+
msg += fmt.Sprintf("storage: hit: %d, miss: %d, rate: %.2f\n", s.StorageCacheHit, s.StorageCacheMiss, storageCacheHitRate)
128112
return msg
129113
}
130114

@@ -564,11 +548,6 @@ type readerWithCacheStats struct {
564548
accountCacheMiss atomic.Int64
565549
storageCacheHit atomic.Int64
566550
storageCacheMiss atomic.Int64
567-
568-
accountDiskHit atomic.Int64
569-
accountDiskMiss atomic.Int64
570-
storageDiskHit atomic.Int64
571-
storageDiskMiss atomic.Int64
572551
}
573552

574553
// newReaderWithCacheStats constructs the reader with additional statistics tracked.
@@ -591,14 +570,6 @@ func (r *readerWithCacheStats) Account(addr common.Address) (*types.StateAccount
591570
r.accountCacheHit.Add(1)
592571
} else {
593572
r.accountCacheMiss.Add(1)
594-
595-
// If the account was read from the underlying storage, count
596-
// the presence statistics.
597-
if account == nil {
598-
r.accountDiskMiss.Add(1)
599-
} else {
600-
r.accountDiskHit.Add(1)
601-
}
602573
}
603574
return account, nil
604575
}
@@ -617,14 +588,6 @@ func (r *readerWithCacheStats) Storage(addr common.Address, slot common.Hash) (c
617588
r.storageCacheHit.Add(1)
618589
} else {
619590
r.storageCacheMiss.Add(1)
620-
621-
// If the slot was read from the underlying storage, count
622-
// the presence statistics.
623-
if value == (common.Hash{}) {
624-
r.storageDiskMiss.Add(1)
625-
} else {
626-
r.storageDiskHit.Add(1)
627-
}
628591
}
629592
return value, nil
630593
}
@@ -636,10 +599,5 @@ func (r *readerWithCacheStats) GetStats() ReaderStats {
636599
AccountCacheMiss: r.accountCacheMiss.Load(),
637600
StorageCacheHit: r.storageCacheHit.Load(),
638601
StorageCacheMiss: r.storageCacheMiss.Load(),
639-
640-
AccountDiskHit: r.accountDiskHit.Load(),
641-
AccountDiskMiss: r.accountDiskMiss.Load(),
642-
StorageDiskHit: r.storageDiskHit.Load(),
643-
StorageDiskMiss: r.storageDiskMiss.Load(),
644602
}
645603
}

0 commit comments

Comments
 (0)