summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-22 09:46:23 +0200
committermadmaxoft <github@xoft.cz>2013-09-22 09:46:23 +0200
commit19d5cc0e66b529fad0d54daf7ff1fd482813efa5 (patch)
treec365ce6e939e9cafcb03096aea38fa7c5ecbc214 /source
parentImplemented Apple-specific GetMemoryUsage. (diff)
downloadcuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.tar
cuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.tar.gz
cuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.tar.bz2
cuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.tar.lz
cuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.tar.xz
cuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.tar.zst
cuberite-19d5cc0e66b529fad0d54daf7ff1fd482813efa5.zip
Diffstat (limited to 'source')
-rw-r--r--source/WebAdmin.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp
index 65d50dbd9..e53fb84e6 100644
--- a/source/WebAdmin.cpp
+++ b/source/WebAdmin.cpp
@@ -451,14 +451,18 @@ int cWebAdmin::GetMemoryUsage(void)
}
return -1;
#elif defined (__APPLE__)
+ // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
- if (KERN_SUCCESS == task_info(mach_task_self(),
- TASK_BASIC_INFO, (task_info_t)&t_info,
- &t_info_count))
+ if (KERN_SUCCESS == task_info(
+ mach_task_self(),
+ TASK_BASIC_INFO,
+ (task_info_t)&t_info,
+ &t_info_count
+ ))
{
- return (int)(t_info.resident_size/1024);
+ return (int)(t_info.resident_size / 1024);
}
return -1;
#else