Implement native sigar_proc_cpu_get function
This commit is contained in:
1 parent
171f2e021e
commit
93ef97aaa8
10 files changed
+139
-106
No files matched your search
@@ -33,18 +33,30 @@ typedef unsigned __int32 sigar_uint32_t;
|
||||
|
||||
typedef unsigned __int64 sigar_uint64_t;
|
||||
|
||||
typedef __int32 sigar_int32_t;
|
||||
|
||||
typedef __int64 sigar_int64_t;
|
||||
|
||||
#elif ULONG_MAX > 4294967295UL
|
||||
|
||||
typedef unsigned int sigar_uint32_t;
|
||||
|
||||
typedef unsigned long sigar_uint64_t;
|
||||
|
||||
typedef int sigar_int32_t;
|
||||
|
||||
typedef long sigar_int64_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned int sigar_uint32_t;
|
||||
|
||||
typedef unsigned long long sigar_uint64_t;
|
||||
|
||||
typedef int sigar_int32_t;
|
||||
|
||||
typedef long long sigar_int64_t;
|
||||
|
||||
#endif
|
||||
|
||||
#define SIGAR_FIELD_NOTIMPL -1
|
||||
@@ -272,6 +284,20 @@ typedef struct {
|
||||
SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
|
||||
sigar_proc_time_t *proctime);
|
||||
|
||||
typedef struct {
|
||||
/* must match sigar_proc_time_t fields */
|
||||
sigar_uint64_t
|
||||
start_time,
|
||||
user,
|
||||
sys,
|
||||
total;
|
||||
sigar_uint64_t last_time;
|
||||
double percent;
|
||||
} sigar_proc_cpu_t;
|
||||
|
||||
SIGAR_DECLARE(int) sigar_proc_cpu_get(sigar_t *sigar, sigar_pid_t pid,
|
||||
sigar_proc_cpu_t *proccpu);
|
||||
|
||||
#define SIGAR_PROC_NAME_LEN 128
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
char errbuf[256]; \
|
||||
char *ifconf_buf; \
|
||||
int ifconf_len; \
|
||||
char *self_path
|
||||
char *self_path; \
|
||||
sigar_cache_t *proc_cpu
|
||||
|
||||
#if defined(WIN32)
|
||||
# define SIGAR_INLINE __inline
|
||||
|
||||
Reference in new issue
Block a user