perf: add more log
This commit is contained in:
parent
73477bd0fc
commit
91e3a3ea1f
@ -228,7 +228,22 @@ func HasTrieNode(db ethdb.KeyValueReader, owner common.Hash, path []byte, hash c
|
||||
func ReadTrieNode(db ethdb.KeyValueReader, owner common.Hash, path []byte, hash common.Hash, scheme string) []byte {
|
||||
switch scheme {
|
||||
case HashScheme:
|
||||
return ReadLegacyTrieNode(db, hash)
|
||||
var (
|
||||
blob []byte
|
||||
start time.Time
|
||||
)
|
||||
start = time.Now()
|
||||
blob = ReadLegacyTrieNode(db, hash)
|
||||
if owner == (common.Hash{}) {
|
||||
if metrics.EnabledExpensive {
|
||||
rawdbGetAccountTrieNodeTimer.UpdateSince(start)
|
||||
}
|
||||
} else {
|
||||
if metrics.EnabledExpensive {
|
||||
rawdbGetStorageTrieNodeTimer.UpdateSince(start)
|
||||
}
|
||||
}
|
||||
return blob
|
||||
case PathScheme:
|
||||
var (
|
||||
blob []byte
|
||||
|
@ -111,12 +111,18 @@ func New(file string, cache int, handles int, namespace string, readonly bool) (
|
||||
func NewCustom(file string, namespace string, customize func(options *opt.Options)) (*Database, error) {
|
||||
options := configureOptions(customize)
|
||||
logger := log.New("database", file)
|
||||
usedCache := options.GetBlockCacheCapacity() + options.GetWriteBuffer()*2
|
||||
logCtx := []interface{}{"cache", common.StorageSize(usedCache), "handles", options.GetOpenFilesCacheCapacity()}
|
||||
// usedCache := options.GetBlockCacheCapacity() + options.GetWriteBuffer()*2
|
||||
logCtx := []interface{}{"handles", options.GetOpenFilesCacheCapacity()}
|
||||
if options.ReadOnly {
|
||||
logCtx = append(logCtx, "readonly", "true")
|
||||
}
|
||||
logger.Info("Allocated cache and file handles", logCtx...)
|
||||
if options.BlockCacheCapacity != 0 {
|
||||
logCtx = append(logCtx, "block_cache_size", common.StorageSize(options.BlockCacheCapacity))
|
||||
}
|
||||
if options.WriteBuffer != 0 {
|
||||
logCtx = append(logCtx, "memory_table_size", common.StorageSize(options.WriteBuffer))
|
||||
}
|
||||
logger.Info("Level db Allocated cache and file handles", logCtx...)
|
||||
|
||||
// Open the db and recover any potential corruptions
|
||||
db, err := leveldb.OpenFile(file, options)
|
||||
@ -313,6 +319,8 @@ func (db *Database) meter(refresh time.Duration, namespace string) {
|
||||
merr = err
|
||||
continue
|
||||
}
|
||||
fmt.Printf("loop print level db stats db_metrics=\n%v\n", stats)
|
||||
db.log.Info("loop print level db stats", "stats", stats)
|
||||
// Iterate over all the leveldbTable rows, and accumulate the entries
|
||||
for j := 0; j < len(compactions[i%2]); j++ {
|
||||
compactions[i%2][j] = 0
|
||||
|
@ -183,8 +183,8 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
|
||||
memTableSize = maxMemTableSize - 1
|
||||
}
|
||||
|
||||
logger.Info("Allocated cache and file handles", "cache", common.StorageSize(cache*1024*1024),
|
||||
"handles", handles, "memory table", common.StorageSize(memTableSize))
|
||||
logger.Info("Pebble db Allocated cache and file handles", "handles", handles, "block_cache_size", common.StorageSize(cache*1024*1024),
|
||||
"memory_table_size", common.StorageSize(memTableSize))
|
||||
|
||||
db := &Database{
|
||||
fn: file,
|
||||
@ -544,6 +544,9 @@ func (d *Database) meter(refresh time.Duration, namespace string) {
|
||||
nonLevel0CompCount = int64(d.nonLevel0Comp.Load())
|
||||
level0CompCount = int64(d.level0Comp.Load())
|
||||
)
|
||||
fmt.Printf("loop print pebble db stats db_metrics=\n%v\n", stats)
|
||||
d.log.Info("loop print pebble db stats", "comp_time", compTime, "write_delay_count", writeDelayCount, "write_delay_time",
|
||||
writeDelayTime, "non_level0_comp_count", nonLevel0CompCount, "level0_comp_count", level0CompCount)
|
||||
writeDelayTimes[i%2] = writeDelayTime
|
||||
writeDelayCounts[i%2] = writeDelayCount
|
||||
compTimes[i%2] = compTime
|
||||
|
Loading…
Reference in New Issue
Block a user