mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
option to disable runtime.ReadMemStats (#457)
* save * save * save * save
This commit is contained in:
parent
e304418d5a
commit
a8ce14e8cc
21
common/experiments.go
Normal file
21
common/experiments.go
Normal file
@ -0,0 +1,21 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var doMemstat = true
|
||||
|
||||
func init() {
|
||||
_, ok := os.LookupEnv("NO_MEMSTAT")
|
||||
if ok {
|
||||
doMemstat = false
|
||||
}
|
||||
}
|
||||
|
||||
func ReadMemStats(m *runtime.MemStats) {
|
||||
if doMemstat {
|
||||
runtime.ReadMemStats(m)
|
||||
}
|
||||
}
|
@ -400,7 +400,9 @@ func reducedict(ctx context.Context, trace bool, logPrefix, segmentFilePath stri
|
||||
default:
|
||||
case <-logEvery.C:
|
||||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
if lvl >= log.LvlInfo {
|
||||
common.ReadMemStats(&m)
|
||||
}
|
||||
log.Log(lvl, fmt.Sprintf("[%s] Replacement preprocessing", logPrefix),
|
||||
"processed", fmt.Sprintf("%.2f%%", 100*float64(outCount)/float64(datFile.count)),
|
||||
//"input", common.ByteCount(inputSize.Load()), "output", common.ByteCount(outputSize.Load()),
|
||||
@ -448,7 +450,7 @@ func reducedict(ctx context.Context, trace bool, logPrefix, segmentFilePath stri
|
||||
}
|
||||
|
||||
//var m runtime.MemStats
|
||||
//runtime.ReadMemStats(&m)
|
||||
//common.ReadMemStats(&m)
|
||||
//log.Info(fmt.Sprintf("[%s] Dictionary build done", logPrefix), "input", common.ByteCount(inputSize.Load()), "output", common.ByteCount(outputSize.Load()), "alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys))
|
||||
posMap := make(map[uint64]uint64)
|
||||
for _, m := range posMaps {
|
||||
|
@ -222,7 +222,7 @@ func loadFilesIntoBucket(logPrefix string, db kv.RwTx, bucket string, bufType in
|
||||
logArs = append(logArs, "current key", makeCurrentKeyStr(k))
|
||||
}
|
||||
|
||||
runtime.ReadMemStats(&m)
|
||||
common.ReadMemStats(&m)
|
||||
logArs = append(logArs, "alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys))
|
||||
log.Info(fmt.Sprintf("[%s] ETL [2/2] Loading", logPrefix), logArs...)
|
||||
}
|
||||
@ -273,12 +273,7 @@ func loadFilesIntoBucket(logPrefix string, db kv.RwTx, bucket string, bufType in
|
||||
}
|
||||
}
|
||||
|
||||
runtime.ReadMemStats(&m)
|
||||
log.Trace(
|
||||
fmt.Sprintf("[%s] ETL Load done", logPrefix),
|
||||
"bucket", bucket,
|
||||
"records", i,
|
||||
"alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys))
|
||||
log.Trace(fmt.Sprintf("[%s] ETL Load done", logPrefix), "bucket", bucket, "records", i)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ func FlushToDisk(b Buffer, tmpdir string, doFsync bool, lvl log.Lvl) (dataProvid
|
||||
defer func() {
|
||||
b.Reset() // run it after buf.flush and file.sync
|
||||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
if lvl >= log.LvlInfo {
|
||||
common.ReadMemStats(&m)
|
||||
}
|
||||
log.Log(lvl,
|
||||
"Flushed buffer file",
|
||||
"name", bufferFile.Name(),
|
||||
|
@ -143,7 +143,7 @@ func extractBucketIntoFiles(
|
||||
logArs = append(logArs, "current key", makeCurrentKeyStr(k))
|
||||
}
|
||||
|
||||
runtime.ReadMemStats(&m)
|
||||
common.ReadMemStats(&m)
|
||||
logArs = append(logArs, "alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys))
|
||||
log.Info(fmt.Sprintf("[%s] ETL [1/2] Extracting", logPrefix), logArs...)
|
||||
}
|
||||
|
@ -1676,8 +1676,7 @@ func (p *TxPool) logStats() {
|
||||
|
||||
//idsInMem := p.senders.idsCount()
|
||||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
|
||||
common.ReadMemStats(&m)
|
||||
ctx := []interface{}{
|
||||
//"baseFee", fmt.Sprintf("%d, %dm", protocolBaseFee, pendingBaseFee/1_000_000),
|
||||
"block", p.lastSeenBlock.Load(),
|
||||
|
Loading…
Reference in New Issue
Block a user