summaryrefslogtreecommitdiffstats
path: root/source/WebAdmin.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-07-29 10:59:10 +0200
committermadmaxoft <github@xoft.cz>2013-07-29 10:59:10 +0200
commit20e7221c7cc54af13d047306b8b1e6fc2d834f29 (patch)
treea908285520af56c2bb43fb36c9bba57367c8364a /source/WebAdmin.cpp
parentFixed formatting in LuaScript.* (diff)
downloadcuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.tar
cuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.tar.gz
cuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.tar.bz2
cuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.tar.lz
cuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.tar.xz
cuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.tar.zst
cuberite-20e7221c7cc54af13d047306b8b1e6fc2d834f29.zip
Diffstat (limited to '')
-rw-r--r--source/WebAdmin.cpp39
1 files changed, 8 insertions, 31 deletions
diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp
index 11a5bd379..3d04ce8f3 100644
--- a/source/WebAdmin.cpp
+++ b/source/WebAdmin.cpp
@@ -243,36 +243,13 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
Content += "\n<p><a href='" + BaseURL + "'>Go back</a></p>";
}
- // mem usage
-#ifndef _WIN32
- rusage resource_usage;
- if (getrusage(RUSAGE_SELF, &resource_usage) != 0)
- {
- ReplaceString( Template, AString("{MEM}"), "Error :(" );
- }
- else
- {
- AString MemUsage;
- Printf(MemUsage, "%0.2f", ((double)resource_usage.ru_maxrss / 1024 / 1024) );
- ReplaceString(Template, AString("{MEM}"), MemUsage);
- }
-#else
- HANDLE hProcess = GetCurrentProcess();
- PROCESS_MEMORY_COUNTERS pmc;
- if( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc) ) )
- {
- AString MemUsage;
- Printf(MemUsage, "%0.2f", (pmc.WorkingSetSize / 1024.f / 1024.f) );
- ReplaceString( Template, "{MEM}", MemUsage );
- }
-#endif
- // end mem usage
-
- ReplaceString( Template, "{USERNAME}", r->username_ );
- ReplaceString( Template, "{MENU}", Menu );
- ReplaceString( Template, "{PLUGIN_NAME}", FoundPlugin );
- ReplaceString( Template, "{CONTENT}", Content );
- ReplaceString( Template, "{TITLE}", "MCServer" );
+ AString MemUsage = GetMemoryUsage();
+ ReplaceString(Template, "{MEM}", MemUsage);
+ ReplaceString(Template, "{USERNAME}", r->username_);
+ ReplaceString(Template, "{MENU}", Menu);
+ ReplaceString(Template, "{PLUGIN_NAME}", FoundPlugin);
+ ReplaceString(Template, "{CONTENT}", Content);
+ ReplaceString(Template, "{TITLE}", "MCServer");
AString NumChunks;
Printf(NumChunks, "%d", cRoot::Get()->GetTotalChunkCount());
@@ -436,7 +413,7 @@ AString cWebAdmin::GetBaseURL( const AStringVector& a_URLSplit )
-AString cWebAdmin::GetMemoryUsage() const
+AString cWebAdmin::GetMemoryUsage(void)
{
AString MemUsage;
#ifndef _WIN32