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

add cpuinfo

This commit is contained in:
winlin 2014-04-19 23:18:00 +08:00
parent 951a93ab86
commit 15aea4d9b3
4 changed files with 230 additions and 51 deletions

View file

@ -40,7 +40,11 @@ extern void srs_update_system_time_ms();
// @see: man getrusage
struct SrsRusage
{
// whether the data is ok.
bool ok;
// the time in ms when sample.
int64_t sample_time;
rusage r;
SrsRusage();
@ -56,6 +60,10 @@ struct SrsProcSelfStat
{
// 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;
// pid %d The process ID.
int pid;
@ -203,6 +211,10 @@ struct SrsProcSystemStat
{
// 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;
// always be cpu
char label[32];
@ -248,4 +260,21 @@ extern SrsProcSystemStat* srs_get_system_proc_stat();
// the deamon st-thread will update it.
extern void srs_update_proc_stat();
// @see: cat /proc/cpuinfo
struct SrsCpuInfo
{
// whether the data is ok.
bool ok;
// The number of processors configured.
int nb_processors;
// The number of processors currently online (available).
int nb_processors_online;
SrsCpuInfo();
};
// get system cpu info, use cache to avoid performance problem.
extern SrsCpuInfo* srs_get_cpuinfo();
#endif