47 #if defined (COSMOS_LINUX_OS)    48 #include <sys/times.h>    49 #include <sys/vtimes.h>    50 #include <sys/sysinfo.h>    53 #include <sys/resource.h>    56 #if defined (COSMOS_WIN_OS)    70 class DeviceCpuWindows
    77     double CalculateCPULoad(
unsigned long long idleTicks, 
unsigned long long totalTicks);
    78     unsigned long long FileTimeToInt64(
const FILETIME & ft);
    80     double getVirtualMemoryUsed();
    81     double getVirtualMemoryTotal();
    82     pid_t getPidOf(
string processName);
    88 #if defined(COSMOS_LINUX_OS)   100     float load1minAverage;
   101     int numProcessors = 0;
   105     double getLoad1minAverage();
   106     float getPercentUseForCurrentProcess();
   107     float getPercentUseForCurrentProcessOverLifetime();
   108     void initCpuUtilization();
   109     double getVirtualMemoryUsed();
   110     double getVirtualMemoryTotal();
   111     double getVirtualMemoryFree();
   112     string getCurrentProcessName();
   113     string getHostName();
   117     double getMemoryUsed();
   118     double getMemoryTotal();
   119     pid_t getPidOf(
string processName);
   120     double getMemoryUsedOf(
string processName);
   121     float getPercentCpuOf(
string processName);
   122     int32_t getCpuCount();
   123     int32_t getBootCount();
   130             string pid, comm, state, ppid, pgrp, session, tty_nr;
   131             string tpgid, flags, minflt, cminflt, majflt, cmajflt;
   132             string utime, stime, cutime, cstime, priority, nice;
   133             string O, itrealvalue, starttime;
   146         bool fileExists = 
false;
   148         procPidStat(
string processName);
   155         string cpu, user, nice, system, idle, iowait, irq, softirq, steal,guest, guest_nice;
   159     float getPercentMemoryOf(
string processName);
   165 #if defined(COSMOS_MAC_OS)   176     float load1minAverage;
   177     int numProcessors = 0;
   181     double getLoad1minAverage();
   182     float getPercentUseForCurrentProcess();
   183     float getPercentUseForCurrentProcessOverLifetime();
   184     void initCpuUtilization();
   185     double getVirtualMemoryUsed();
   186     double getVirtualMemoryTotal();
   187     double getVirtualMemoryFree();
   188     string getCurrentProcessName();
   189     string getHostName();
   193     double getMemoryUsed();
   194     double getMemoryTotal();
   195     pid_t getPidOf(
string processName);
   196     double getMemoryUsedOf(
string processName);
   197     float getPercentCpuOf(
string processName);
   203             string pid, comm, state, ppid, pgrp, session, tty_nr;
   204             string tpgid, flags, minflt, cminflt, majflt, cmajflt;
   205             string utime, stime, cutime, cstime, priority, nice;
   206             string O, itrealvalue, starttime;
   219         bool fileExists = 
false;
   221         procPidStat(
string processName);
   228         string cpu, user, nice, system, idle, iowait, irq, softirq, steal,guest, guest_nice;
   232     float getPercentMemoryOf(
string processName);
   261     uint16_t getCpuCount();
   262     uint32_t getUptime();
   263     uint16_t getBootCount();
   264     double getVirtualMemoryTotal();
   265     double getVirtualMemoryUsed();
   266     double getVirtualMemoryFree();
   267     double getVirtualMemoryUsedPercent();
   268     double getPercentUseForCurrentProcess();
   269     string getHostName();
   272     double BytesToKiB(
double bytes);
   273     double BytesToMiB(
double bytes);
   274     double BytesToMB(
double bytes);
   276 #if defined(COSMOS_LINUX_OS)   277     DeviceCpuLinux cpuLinux;
   280 #if defined(COSMOS_MAC_OS)   284 #if defined(COSMOS_WIN_OS)   285     DeviceCpuWindows cpuWin;
   288     double getVirtualMemoryUsedKiB();
   289     double getVirtualMemoryUsedMiB();
   291     double getVirtualMemoryUsedMB();
   292     double getMemoryUsed();
   293     double getMemoryTotal();
   294     double getMemoryUsedKiB();
   295     double getMemoryUsedMiB();
   296     double getMemoryTotalKiB();
   297     double getMemoryTotalMiB();
   298     double getMemoryUsedMB();
   299     double getMemoryTotalMB();
   300     pid_t getPidOf(
string processName);
   301     pid_t getMemoryUsedOf(
string processName);
   302     float getPercentCpuOf(
string processName);
   303     float getPercentMemoryOf(
string processName);
   307 #endif // DEVICECPU_H double virtualMemoryFree
Definition: devicecpu.h:254
double memoryBuffers
Definition: devicecpu.h:251
double virtualMemoryTotal
Definition: devicecpu.h:253
int numProcessors
Definition: devicecpu.h:245
Definition: devicecpu.h:239
double memoryUsed
Definition: devicecpu.h:248
Headers and definitions common to all COSMOS. 
double load
Definition: devicecpu.h:255
double memoryFree
Definition: devicecpu.h:250
double virtualMemoryUsed
Definition: devicecpu.h:252
string processName
Definition: devicecpu.h:246
DeviceCpu cpu
Definition: agent_example.cpp:58
stringlib include file A library providing functions for handling various types of string...
string hostName
Definition: devicecpu.h:247
double percentUseForCurrentProcess
Definition: devicecpu.h:244
double memoryTotal
Definition: devicecpu.h:249