mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
ethdb/pebble: avoid copy array in loops
This commit is contained in:
parent
3aa874bed2
commit
0907a185ac
1 changed files with 6 additions and 6 deletions
|
|
@ -488,11 +488,11 @@ func (d *Database) meter(refresh time.Duration, namespace string) {
|
||||||
writeDelayCounts[i%2] = writeDelayCount
|
writeDelayCounts[i%2] = writeDelayCount
|
||||||
compTimes[i%2] = compTime
|
compTimes[i%2] = compTime
|
||||||
|
|
||||||
for _, levelMetrics := range stats.Levels {
|
for _, level := range &stats.Levels {
|
||||||
nWrite += int64(levelMetrics.BytesCompacted)
|
nWrite += int64(level.BytesCompacted)
|
||||||
nWrite += int64(levelMetrics.BytesFlushed)
|
nWrite += int64(level.BytesFlushed)
|
||||||
compWrite += int64(levelMetrics.BytesCompacted)
|
compWrite += int64(level.BytesCompacted)
|
||||||
compRead += int64(levelMetrics.BytesRead)
|
compRead += int64(level.BytesRead)
|
||||||
}
|
}
|
||||||
|
|
||||||
nWrite += int64(stats.WAL.BytesWritten)
|
nWrite += int64(stats.WAL.BytesWritten)
|
||||||
|
|
@ -540,7 +540,7 @@ func (d *Database) meter(refresh time.Duration, namespace string) {
|
||||||
d.level0CompGauge.Update(level0CompCount)
|
d.level0CompGauge.Update(level0CompCount)
|
||||||
d.seekCompGauge.Update(stats.Compact.ReadCount)
|
d.seekCompGauge.Update(stats.Compact.ReadCount)
|
||||||
|
|
||||||
for i, level := range stats.Levels {
|
for i, level := range &stats.Levels {
|
||||||
// Append metrics for additional layers
|
// Append metrics for additional layers
|
||||||
if i >= len(d.levelsGauge) {
|
if i >= len(d.levelsGauge) {
|
||||||
d.levelsGauge = append(d.levelsGauge, metrics.GetOrRegisterGauge(namespace+fmt.Sprintf("tables/level%v", i), nil))
|
d.levelsGauge = append(d.levelsGauge, metrics.GetOrRegisterGauge(namespace+fmt.Sprintf("tables/level%v", i), nil))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue