您当前的位置: 首页 >  linux

DS小龙哥

暂无认证

  • 4浏览

    0关注

    679博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Linux系统下获取系统的内存使用情况(C语言代码)

DS小龙哥 发布时间:2020-08-31 00:53:00 ,浏览量:4

一、功能介绍

通过sysinfo函数获取系统内存的使用情况。

sysinfo函数的帮助页如下:

wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c$ man sysinfo
SYSINFO(2)                           Linux Programmer's Manual                          SYSINFO(2)

NAME
       sysinfo - return system information

SYNOPSIS
       #include 

       int sysinfo(struct sysinfo *info);

DESCRIPTION
       sysinfo() returns certain statistics on memory and swap usage, as well as the load average.

       Until Linux 2.3.16, sysinfo() returned information in the following structure:

           struct sysinfo {
               long uptime;             /* Seconds since boot */
               unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
               unsigned long totalram;  /* Total usable main memory size */
               unsigned long freeram;   /* Available memory size */
               unsigned long sharedram; /* Amount o
关注
打赏
1664009229
查看更多评论
立即登录/注册

微信扫码登录

0.0486s