@@ -74,22 +74,22 @@ var (
74
74
snapSuccessfulRangeProofMeter = metrics.NewRegisteredMeter("state/snapshot/generation/proof/success", nil)
75
75
snapFailedRangeProofMeter = metrics.NewRegisteredMeter("state/snapshot/generation/proof/failure", nil)
76
76
77
- // snapAccountProveTimer measures time spent on the account proving
78
- snapAccountProveTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/account/prove", nil)
79
- // snapAccountTrieReadTimer measures time spent on the account trie iteration
80
- snapAccountTrieReadTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/account/trieread", nil)
81
- // snapAccountSnapReadTimer measues time spent on the snapshot account iteration
82
- snapAccountSnapReadTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/account/snapread", nil)
83
- // snapAccountWriteTimer measures time spent on writing/updating/deleting accounts
84
- snapAccountWriteTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/account/write", nil)
85
- // snapStorageProveTimer measures time spent on storage proving
86
- snapStorageProveTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/storage/prove", nil)
87
- // snapStorageTrieReadTimer measures time spent on the storage trie iteration
88
- snapStorageTrieReadTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/storage/trieread", nil)
89
- // snapStorageSnapReadTimer measures time spent on the snapshot storage iteration
90
- snapStorageSnapReadTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/storage/snapread", nil)
91
- // snapStorageWriteTimer measures time spent on writing/updating/deleting storages
92
- snapStorageWriteTimer = metrics.NewRegisteredTimer ("state/snapshot/generation/duration/storage/write", nil)
77
+ // snapAccountProveCounter measures time spent on the account proving
78
+ snapAccountProveCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/account/prove", nil)
79
+ // snapAccountTrieReadCounter measures time spent on the account trie iteration
80
+ snapAccountTrieReadCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/account/trieread", nil)
81
+ // snapAccountSnapReadCounter measues time spent on the snapshot account iteration
82
+ snapAccountSnapReadCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/account/snapread", nil)
83
+ // snapAccountWriteCounter measures time spent on writing/updating/deleting accounts
84
+ snapAccountWriteCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/account/write", nil)
85
+ // snapStorageProveCounter measures time spent on storage proving
86
+ snapStorageProveCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/storage/prove", nil)
87
+ // snapStorageTrieReadCounter measures time spent on the storage trie iteration
88
+ snapStorageTrieReadCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/storage/trieread", nil)
89
+ // snapStorageSnapReadCounter measures time spent on the snapshot storage iteration
90
+ snapStorageSnapReadCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/storage/snapread", nil)
91
+ // snapStorageWriteCounter measures time spent on writing/updating/deleting storages
92
+ snapStorageWriteCounter = metrics.NewRegisteredCounter ("state/snapshot/generation/duration/storage/write", nil)
93
93
)
94
94
95
95
// generatorStats is a collection of statistics gathered by the snapshot generator
@@ -301,15 +301,15 @@ func (dl *diskLayer) proveRange(stats *generatorStats, root common.Hash, prefix
301
301
}
302
302
// Update metrics for database iteration and merkle proving
303
303
if kind == "storage" {
304
- snapStorageSnapReadTimer.Update (time.Since(start))
304
+ snapStorageSnapReadCounter.Inc (time.Since(start).Nanoseconds( ))
305
305
} else {
306
- snapAccountSnapReadTimer.Update (time.Since(start))
306
+ snapAccountSnapReadCounter.Inc (time.Since(start).Nanoseconds( ))
307
307
}
308
308
defer func(start time.Time) {
309
309
if kind == "storage" {
310
- snapStorageProveTimer.Update (time.Since(start))
310
+ snapStorageProveCounter.Inc (time.Since(start).Nanoseconds( ))
311
311
} else {
312
- snapAccountProveTimer.Update (time.Since(start))
312
+ snapAccountProveCounter.Inc (time.Since(start).Nanoseconds( ))
313
313
}
314
314
}(time.Now())
315
315
@@ -512,9 +512,9 @@ func (dl *diskLayer) generateRange(root common.Hash, prefix []byte, kind string,
512
512
513
513
// Update metrics for counting trie iteration
514
514
if kind == "storage" {
515
- snapStorageTrieReadTimer.Update( time.Since(start) - internal)
515
+ snapStorageTrieReadCounter.Inc(( time.Since(start) - internal).Nanoseconds() )
516
516
} else {
517
- snapAccountTrieReadTimer.Update( time.Since(start) - internal)
517
+ snapAccountTrieReadCounter.Inc(( time.Since(start) - internal).Nanoseconds() )
518
518
}
519
519
logger.Debug("Regenerated state range", "root", root, "last", hexutil.Encode(last),
520
520
"count", count, "created", created, "updated", updated, "untouched", untouched, "deleted", deleted)
@@ -593,7 +593,7 @@ func (dl *diskLayer) generate(stats *generatorStats) {
593
593
if err := wipeKeyRange(dl.diskdb, "storage", prefix, nil, nil, keyLen, snapWipedStorageMeter, false); err != nil {
594
594
return err
595
595
}
596
- snapAccountWriteTimer.Update (time.Since(start))
596
+ snapAccountWriteCounter.Inc (time.Since(start).Nanoseconds( ))
597
597
return nil
598
598
}
599
599
// Retrieve the current account and flatten it into the internal format
@@ -643,17 +643,17 @@ func (dl *diskLayer) generate(stats *generatorStats) {
643
643
if err := wipeKeyRange(dl.diskdb, "storage", prefix, nil, nil, keyLen, snapWipedStorageMeter, false); err != nil {
644
644
return err
645
645
}
646
- snapAccountWriteTimer.Update (time.Since(start))
646
+ snapAccountWriteCounter.Inc (time.Since(start).Nanoseconds( ))
647
647
} else {
648
- snapAccountWriteTimer.Update (time.Since(start))
648
+ snapAccountWriteCounter.Inc (time.Since(start).Nanoseconds( ))
649
649
650
650
var storeMarker []byte
651
651
if accMarker != nil && bytes.Equal(accountHash[:], accMarker) && len(dl.genMarker) > common.HashLength {
652
652
storeMarker = dl.genMarker[common.HashLength:]
653
653
}
654
654
onStorage := func(key []byte, val []byte, write bool, delete bool) error {
655
655
defer func(start time.Time) {
656
- snapStorageWriteTimer.Update (time.Since(start))
656
+ snapStorageWriteCounter.Inc (time.Since(start).Nanoseconds( ))
657
657
}(time.Now())
658
658
659
659
if delete {
0 commit comments