feat: add rss record

This commit is contained in:
2026-04-16 21:43:11 +08:00
parent 296bd8e07a
commit 876cb5ebe2
3 changed files with 35 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
#include <Cubed/map_table.hpp>
#include <Cubed/tools/cubed_assert.hpp>
#include <Cubed/tools/log.hpp>
#include <Cubed/tools/memory_used.hpp>
#include <Cubed/tools/perlin_noise.hpp>
#include <exception>
@@ -161,10 +162,11 @@ void App::update() {
if (fps_time_count >= 1.0f) {
fps = static_cast<int>(frame_count / fps_time_count);
std::string title = "Cubed FPS: " + std::to_string(fps);
DebugCollector::get().report("fps", std::string{"FPS: " + std::to_string(fps)});
glfwSetWindowTitle(m_window.get_glfw_window(), title.c_str());
frame_count = 0;
fps_time_count = 0.0f;
DebugCollector::get().report("fps", std::string{"FPS: " + std::to_string(fps)});
DebugCollector::get().report("rss", std::format("RSS: {}mb", get_current_rss() / (1024 * 1024)));
}
m_texture_manager.update();
m_world.update(delta_time);

View File

@@ -17,7 +17,7 @@ void DebugCollector::init_text() {
Text fps_text("fps");
Text player_pos_text("player_pos");
Text rendered_chunk_text("rendered_chunk");
Text rss_text("rss");
version_text
.position(0.0f, 100.0f)
.scale(0.8f)
@@ -34,6 +34,10 @@ void DebugCollector::init_text() {
.text("Rendered Chunk: 0")
.scale(0.8f)
.position(0.0, 200.0f);
rss_text
.text("RSS: 0mb")
.scale(0.8f)
.position(0.0f, 300.0f);
std::string os;
Text os_text("os");
@@ -54,6 +58,7 @@ void DebugCollector::init_text() {
m_texts.insert({player_pos_text.uuid(), std::move(player_pos_text)});
m_texts.insert({rendered_chunk_text.uuid(), std::move(rendered_chunk_text)});
m_texts.insert({os_text.uuid(), std::move(os_text)});
m_texts.insert({rss_text.uuid(), std::move(rss_text)});
}
std::unordered_map<std::size_t, Text>& DebugCollector::all_texts() {