mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix(server): remove double decrement of obj_memory_usage. (#406)
Also, add timing stats to malloc-stats command. Signed-off-by: Roman Gershman <roman@dragonflydb.io> Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
b5cbed79d7
commit
ab72ff797c
2 changed files with 4 additions and 3 deletions
|
@ -419,8 +419,6 @@ tuple<PrimeIterator, ExpireIterator, bool> DbSlice::AddOrFind2(const Context& cn
|
|||
// Keep the entry but reset the object.
|
||||
size_t value_heap_size = existing->second.MallocUsed();
|
||||
db.stats.obj_memory_usage -= value_heap_size;
|
||||
if (existing->second.ObjType() == OBJ_STRING)
|
||||
db.stats.obj_memory_usage -= value_heap_size;
|
||||
|
||||
existing->second.Reset();
|
||||
events_.expired_keys++;
|
||||
|
|
|
@ -57,6 +57,8 @@ void MemoryCmd::Run(CmdArgList args) {
|
|||
|
||||
string MemoryCmd::MallocStats() {
|
||||
string str;
|
||||
|
||||
uint64_t start = absl::GetCurrentTimeNanos();
|
||||
absl::StrAppend(&str, "___ Begin mimalloc statistics ___\n");
|
||||
mi_stats_print_out(MiStatsCallback, &str);
|
||||
|
||||
|
@ -73,7 +75,8 @@ string MemoryCmd::MallocStats() {
|
|||
get<2>(k_v.first), " ", get<3>(k_v.first), "\n");
|
||||
}
|
||||
|
||||
absl::StrAppend(&str, "--- End mimalloc statistics ---\n");
|
||||
uint64_t delta = (absl::GetCurrentTimeNanos() - start) / 1000;
|
||||
absl::StrAppend(&str, "--- End mimalloc statistics, took ", delta, "us ---\n");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue