| 关键词: nbsp unsigned long time children system memory total 信息 当前 |
[cpp] view plaincopyprint?#include <vector> #include "sys/config.h" SYS_NAMESPACE_BEGIN /*** * 用来获取系统、内核和进程的各类实时信息,如CPU和内存数据 */ class CInfo { public: /*** * 系统当前实时信息 */ typedef struct { long uptime_second; /* Seconds since boot */ unsigned long average_load[3]; /* 1, 5, and 15 minute load averages */ unsigned long ram_total; /* Total usable main memory size */ unsigned long ram_free; /* Available memory size */ unsigned long ram_shared; /* Amount of shared memory */ unsigned long ram_buffer; /* Memory used by buffers */ unsigned long swap_total; /* Total swap space size */ unsigned long swap_free; /* swap space still available */ unsigned short process_number; /* Number of current processes */ }sys_info_t; /*** * 当前进程时间信息 */ typedef struct { long user_time; /* user time */ long system_time; /* system time */ long user_time_children; /* user time of children */ long system_time_children; /* system time of children */ }process_time_t; /*** * 当前系统CPU信息 */ 声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除 |