mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-21 22:24:32 +00:00
cmd/utils: relinquish GC cache to read cache in archive mode (#18991)
This commit is contained in:
parent
2772e096b4
commit
f19422e1c7
4 changed files with 13 additions and 13 deletions
|
|
@ -298,7 +298,7 @@ var (
|
|||
CacheGCFlag = &cli.IntFlag{
|
||||
Name: "cache-gc",
|
||||
Aliases: []string{"cache.gc"},
|
||||
Usage: "Percentage of cache memory allowance to use for trie pruning",
|
||||
Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)",
|
||||
Value: 25,
|
||||
Category: flags.PerfCategory,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ type StorageSize float64
|
|||
|
||||
// String implements the stringer interface.
|
||||
func (s StorageSize) String() string {
|
||||
if s > 1000000 {
|
||||
return fmt.Sprintf("%.2f mB", s/1000000)
|
||||
} else if s > 1000 {
|
||||
return fmt.Sprintf("%.2f kB", s/1000)
|
||||
if s > 1048576 {
|
||||
return fmt.Sprintf("%.2f MiB", s/1048576)
|
||||
} else if s > 1024 {
|
||||
return fmt.Sprintf("%.2f KiB", s/1024)
|
||||
} else {
|
||||
return fmt.Sprintf("%.2f B", s)
|
||||
}
|
||||
|
|
@ -38,10 +38,10 @@ func (s StorageSize) String() string {
|
|||
// TerminalString implements log.TerminalStringer, formatting a string for console
|
||||
// output during logging.
|
||||
func (s StorageSize) TerminalString() string {
|
||||
if s > 1000000 {
|
||||
return fmt.Sprintf("%.2fmB", s/1000000)
|
||||
} else if s > 1000 {
|
||||
return fmt.Sprintf("%.2fkB", s/1000)
|
||||
if s > 1048576 {
|
||||
return fmt.Sprintf("%.2fMiB", s/1048576)
|
||||
} else if s > 1024 {
|
||||
return fmt.Sprintf("%.2fKiB", s/1024)
|
||||
} else {
|
||||
return fmt.Sprintf("%.2fB", s)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ func TestStorageSizeString(t *testing.T) {
|
|||
size StorageSize
|
||||
str string
|
||||
}{
|
||||
{2381273, "2.38 mB"},
|
||||
{2192, "2.19 kB"},
|
||||
{2381273, "2.27 MiB"},
|
||||
{2192, "2.14 KiB"},
|
||||
{12, "12.00 B"},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2123,7 +2123,7 @@ const statsReportLimit = 8 * time.Second
|
|||
|
||||
// report prints statistics if some number of blocks have been processed
|
||||
// or more than a few seconds have passed since the last message.
|
||||
func (st *insertStats) report(chain []*types.Block, index int, cache common.StorageSize) {
|
||||
func (st *insertStats) report(chain []*types.Block, index int, dirty common.StorageSize) {
|
||||
// Fetch the timings for the batch
|
||||
var (
|
||||
now = mclock.Now()
|
||||
|
|
@ -2138,7 +2138,7 @@ func (st *insertStats) report(chain []*types.Block, index int, cache common.Stor
|
|||
context := []interface{}{
|
||||
"blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000,
|
||||
"elapsed", common.PrettyDuration(elapsed), "mgasps", float64(st.usedGas) * 1000 / float64(elapsed),
|
||||
"number", end.Number(), "hash", end.Hash(), "cache", cache,
|
||||
"number", end.Number(), "hash", end.Hash(), "dirty", dirty,
|
||||
}
|
||||
if st.queued > 0 {
|
||||
context = append(context, []interface{}{"queued", st.queued}...)
|
||||
|
|
|
|||
Loading…
Reference in a new issue