Skip to content

Commit

Permalink
Add support of showing used_memory_startup (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiTopQuark authored Oct 26, 2022
1 parent 91ef4a9 commit edb85fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Status Server::Start() {
}
}
});

memory_startup_use_ = Stats::GetMemoryRSS();
LOG(INFO) << "Ready to accept connections";

return Status::OK();
Expand Down Expand Up @@ -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();
}

Expand Down
3 changes: 3 additions & 0 deletions src/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit edb85fe

Please sign in to comment.