diff options
author | Javier Peletier <jm@epiclabs.io> | 2018-03-05 23:00:03 +0800 |
---|---|---|
committer | Javier Peletier <jm@epiclabs.io> | 2018-03-05 23:00:03 +0800 |
commit | 13b566e06e9aae28bddde431c7d53a335272411a (patch) | |
tree | b649ab64ca2c00327500aed5c826d5a6f454a6cf /swarm/storage/dbstore.go | |
parent | 1e72271f571f916691c5c18b8f0c4c5f7e0445c3 (diff) | |
parent | 1548518644071c8fa8eb98a8cb8a8c4603400acb (diff) | |
download | go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.tar go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.tar.gz go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.tar.bz2 go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.tar.lz go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.tar.xz go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.tar.zst go-tangerine-13b566e06e9aae28bddde431c7d53a335272411a.zip |
accounts/abi: Add one-parameter event test case from enriquefynn/unpack_one_arg_event
Diffstat (limited to 'swarm/storage/dbstore.go')
-rw-r--r-- | swarm/storage/dbstore.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/swarm/storage/dbstore.go b/swarm/storage/dbstore.go index 46a5c16cc..421bb061d 100644 --- a/swarm/storage/dbstore.go +++ b/swarm/storage/dbstore.go @@ -33,11 +33,18 @@ import ( "sync" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/rlp" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/iterator" ) +//metrics variables +var ( + gcCounter = metrics.NewRegisteredCounter("storage.db.dbstore.gc.count", nil) + dbStoreDeleteCounter = metrics.NewRegisteredCounter("storage.db.dbstore.rm.count", nil) +) + const ( defaultDbCapacity = 5000000 defaultRadius = 0 // not yet used @@ -255,6 +262,7 @@ func (s *DbStore) collectGarbage(ratio float32) { // actual gc for i := 0; i < gcnt; i++ { if s.gcArray[i].value <= cutval { + gcCounter.Inc(1) s.delete(s.gcArray[i].idx, s.gcArray[i].idxKey) } } @@ -383,6 +391,7 @@ func (s *DbStore) delete(idx uint64, idxKey []byte) { batch := new(leveldb.Batch) batch.Delete(idxKey) batch.Delete(getDataKey(idx)) + dbStoreDeleteCounter.Inc(1) s.entryCnt-- batch.Put(keyEntryCnt, U64ToBytes(s.entryCnt)) s.db.Write(batch) |