1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

add meminfo

This commit is contained in:
winlin 2014-04-20 00:15:26 +08:00
parent 15aea4d9b3
commit a5f4f6bd14
5 changed files with 208 additions and 12 deletions

View file

@ -260,6 +260,42 @@ extern SrsProcSystemStat* srs_get_system_proc_stat();
// the deamon st-thread will update it.
extern void srs_update_proc_stat();
// @see: cat /proc/meminfo
struct SrsMemInfo
{
// whether the data is ok.
bool ok;
// the time in ms when sample.
int64_t sample_time;
// the percent of usage. 0.153 is 15.3%.
float percent_ram;
float percent_swap;
// MemActive = MemTotal - MemFree
int64_t MemActive;
// RealInUse = MemActive - Buffers - Cached
int64_t RealInUse;
// NotInUse = MemTotal - RealInUse
// = MemTotal - MemActive + Buffers + Cached
// = MemTotal - MemTotal + MemFree + Buffers + Cached
// = MemFree + Buffers + Cached
int64_t NotInUse;
int64_t MemTotal;
int64_t MemFree;
int64_t Buffers;
int64_t Cached;
int64_t SwapTotal;
int64_t SwapFree;
SrsMemInfo();
};
// get system meminfo, use cache to avoid performance problem.
extern SrsMemInfo* srs_get_meminfo();
// the deamon st-thread will update it.
extern void srs_update_meminfo();
// @see: cat /proc/cpuinfo
struct SrsCpuInfo
{