return information on overall system statistics;
#include <sys/sysinfo.h>
int sysinfo(struct sysinfo *info);
struct sysinfo{
long uptime;
......
unsigned long totalram;//Total useable main memorysize
unsigned long freeram;//Available memory size(可用页的个数)
......
};
usage:
struct sysinfo aa;
sysinfo(&aa);
printf(...,aa.freeram);
本文介绍了一个用于获取系统总体统计信息的C语言函数sysinfo。该函数通过传递一个struct sysinfo结构体指针来返回系统的运行时间、总内存大小及可用内存等关键指标。
3480

被折叠的 条评论
为什么被折叠?



