⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memusage.c

📁 用于2维的射线追踪
💻 C
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>#ifdef __APPLE__	#include <malloc/malloc.h>#else	#include <malloc.h>#endif#include "memusage.h"/** \brief get the current memory usage in MBytes */#ifdef __APPLE__/*float get_mem_usage (void) {   task_basic_info_data_t ti;   mach_msg_type_number_t count;   vm_statistics_data_t vm_info;   vm_size_t       vsize, rsize;   task_t          a_task = mach_task_self();   count = TASK_BASIC_INFO_COUNT;   task_info(a_task, TASK_BASIC_INFO, (task_info_t) & ti, &count);   rsize = ti.resident_size;   vsize = ti.virtual_size;   return((float)(rsize / (1024. * 1024.)));}*/float get_mem_usage (void) {   malloc_statistics_t memusage;   return ((float)(memusage.size_in_use)/1024.);}#elsefloat get_mem_usage (void) {	struct mallinfo m_info;	m_info = mallinfo();	return((float)(m_info.uordblks+m_info.usmblks)/(1024.*1024.));}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -