You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by hu...@apache.org on 2022/10/26 05:15:58 UTC
[incubator-kvrocks] branch unstable updated: Add support of showing `used_memory_startup` (#1044)
This is an automated email from the ASF dual-hosted git repository.
hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new edb85fe8 Add support of showing `used_memory_startup` (#1044)
edb85fe8 is described below
commit edb85fe8aff90aa44f7d205d63c68ace63c26723
Author: AntiTopQuark <An...@outlook.com>
AuthorDate: Wed Oct 26 13:15:53 2022 +0800
Add support of showing `used_memory_startup` (#1044)
---
src/server/server.cc | 3 ++-
src/server/server.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/server/server.cc b/src/server/server.cc
index 29a2d028..02127f47 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -186,7 +186,7 @@ Status Server::Start() {
}
}
});
-
+ memory_startup_use_ = Stats::GetMemoryRSS();
LOG(INFO) << "Ready to accept connections";
return Status::OK();
@@ -818,6 +818,7 @@ void Server::GetMemoryInfo(std::string *info) {
string_stream << "used_memory_human:" << used_memory_rss_human << "\r\n";
string_stream << "used_memory_lua:" << memory_lua << "\r\n";
string_stream << "used_memory_lua_human:" << used_memory_lua_human << "\r\n";
+ string_stream << "used_memory_startup:" << memory_startup_use_ << "\r\n";
*info = string_stream.str();
}
diff --git a/src/server/server.h b/src/server/server.h
index 715edc96..c539c267 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -281,6 +281,9 @@ class Server {
TaskRunner task_runner_;
std::vector<std::unique_ptr<WorkerThread>> worker_threads_;
std::unique_ptr<ReplicationThread> replication_thread_;
+
+ // memory
+ int64_t memory_startup_use_ = 0;
};
extern Server *srv;