MEM_set(SWAP_TOTAL, ul_int, SwapTotal)
MEM_set(SWAP_USED, ul_int, derived_swap_used)
+#undef setDECL
+#undef MEM_set
+#undef HST_set
+
// ___ Results 'Get' Support ||||||||||||||||||||||||||||||||||||||||||||||||||
MEM_get(SWAP_TOTAL, SwapTotal)
MEM_get(SWAP_USED, derived_swap_used)
+#undef getDECL
+#undef MEM_get
+#undef HST_get
+
// ___ Controlling Table ||||||||||||||||||||||||||||||||||||||||||||||||||||||
enum meminfo_item PROCPS_MEMINFO_logical_end = PROCPS_MEMINFO_SWAP_USED + 1;
#undef setNAME
-#undef setDECL
-#undef MEM_set
-#undef HST_set
#undef getNAME
-#undef getDECL
-#undef MEM_get
-#undef HST_get
#undef RS
#undef RG
+
// ___ Private Functions ||||||||||||||||||||||||||||||||||||||||||||||||||||||
static inline void assign_results (
// ___ Public Functions |||||||||||||||||||||||||||||||||||||||||||||||||||||||
+// --- standard required functions --------------------------------------------
+
/*
* procps_meminfo_new:
*
} // end: procps_meminfo_unref
+// --- variable interface functions -------------------------------------------
+
PROCPS_EXPORT signed long procps_meminfo_get (
struct procps_meminfo *info,
enum meminfo_item item)
sav_secs = cur_secs;
}
- if (item < PROCPS_MEMINFO_logical_end)
- return Item_table[item].getsfunc(info);
- return -EINVAL;
+ return Item_table[item].getsfunc(info);
} // end: procps_meminfo_get
PROCPS_MEMINFO_SWAP_USED // ul_int
};
-struct procps_meminfo;
struct meminfo_result {
enum meminfo_item item;
union {
- signed int s_int;
+ signed int s_int;
unsigned long ul_int;
} result;
};
PROCPS_PIDS_VM_USED, // sl_int
PROCPS_PIDS_VSIZE_PGS, // ul_int
PROCPS_PIDS_WCHAN_ADDR, // ul_int
- PROCPS_PIDS_WCHAN_NAME, // str
+ PROCPS_PIDS_WCHAN_NAME // str
};
enum pids_fetch_type {
};
-struct procps_pidsinfo;
-
struct pids_result {
enum pids_item item;
union {
- char s_ch;
- int s_int;
- unsigned int u_int;
- long sl_int;
- unsigned long ul_int;
- unsigned long long ull_int;
- char * str;
- char ** strv;
+ signed char s_ch;
+ signed int s_int;
+ unsigned int u_int;
+ signed long sl_int;
+ unsigned long ul_int;
+ unsigned long long ull_int;
+ char *str;
+ char **strv;
} result;
};
stack -> head [ rel_enum ] . result . type
+struct procps_pidsinfo;
+
int procps_pids_new (struct procps_pidsinfo **info, enum pids_item *items, int numitems);
int procps_pids_ref (struct procps_pidsinfo *info);
int procps_pids_unref (struct procps_pidsinfo **info);
// ___ Public Functions |||||||||||||||||||||||||||||||||||||||||||||||||||||||
+// --- standard required functions --------------------------------------------
+
/*
* procps_slabinfo_new():
*
/* do a priming read here for the following potential benefits: |
1) see if that caller's permissions were sufficient (root) |
- 2) make delta results potentially useful, even is 1st time | */
+ 2) make delta results potentially useful, even if 1st time | */
if ((rc = read_slabinfo_failed(p))) {
procps_slabinfo_unref(&p);
return rc;
} // end: procps_slabinfo_unref
+// --- variable interface functions -------------------------------------------
+
PROCPS_EXPORT signed long procps_slabinfo_get (
struct procps_slabinfo *info,
enum slabinfo_item item)
qsort_r(stacks, numstacked, sizeof(void *), (QSR_t)Item_table[p->item].sortfunc, &parms);
return stacks;
- #undef QSORT_r
} // end: procps_slabinfo_sort
struct slabinfo_result {
enum slabinfo_item item;
union {
- signed int s_int;
- unsigned int u_int;
- unsigned long ul_int;
- char * str;
+ signed int s_int;
+ unsigned int u_int;
+ unsigned long ul_int;
+ char *str;
} result;
};
SYSsetH(SYS_DELTA_PROC_CREATED, s_int, procs_created)
setDECL(SYS_DELTA_PROC_RUNNING) { (void)T; R->result.s_int = S->new.procs_running - S->old.procs_running; }
+#undef setDECL
+#undef TIC_set
+#undef SYS_set
+#undef TICsetH
+#undef SYSsetH
+
// ___ Results 'Get' Support ||||||||||||||||||||||||||||||||||||||||||||||||||
SYSgetH(SYS_DELTA_PROC_CREATED, procs_created)
getDECL(SYS_DELTA_PROC_RUNNING) { return I->sys_hist.new.procs_running - I->sys_hist.old.procs_running; }
+#undef getDECL
+#undef TIC_get
+#undef SYS_get
+#undef TICgetH
+#undef SYSgetH
+
// ___ Controlling Table ||||||||||||||||||||||||||||||||||||||||||||||||||||||
enum stat_item PROCPS_STAT_logical_end = PROCPS_STAT_SYS_DELTA_PROC_RUNNING + 1;
#undef setNAME
-#undef setDECL
-#undef TIC_set
-#undef SYS_set
-#undef TICsetH
-#undef SYSsetH
#undef getNAME
-#undef getDECL
-#undef TIC_get
-#undef SYS_get
-#undef TICgetH
-#undef SYSgetH
#undef RS
#undef RG
( and be careful, this libnuma call returns the highest node id in use, )
( NOT an actual number of nodes - some of those 'slots' might be unused ) */
info->nodes.total = info->our_max_node() + 1;
+
if (!info->nodes.hist.n_alloc
|| !(info->nodes.total < info->nodes.hist.n_alloc)) {
info->nodes.hist.n_alloc = info->nodes.total + NEWOLD_INCR;
// forget all of the prior node statistics & anticipate unassigned slots
memset(info->nodes.hist.tics, 0, info->nodes.hist.n_alloc * sizeof(struct hist_tic));
nod_ptr = info->nodes.hist.tics;
- for (i = 0; i < info->cpus.hist.n_alloc; i++) {
+ for (i = 0; i < info->nodes.total; i++) {
nod_ptr->id = nod_ptr->numa_node = PROCPS_STAT_NODE_INVALID;
++nod_ptr;
}
// ___ Public Functions |||||||||||||||||||||||||||||||||||||||||||||||||||||||
+// --- standard required functions --------------------------------------------
+
/*
* procps_stat_new:
*
} // end: procps_stat_unref
+// --- variable interface functions -------------------------------------------
+
PROCPS_EXPORT signed long long procps_stat_get (
struct procps_statinfo *info,
enum stat_item item)
time_t cur_secs;
int rc;
+ if (info == NULL)
+ return -EINVAL;
+ if (item < 0 || item >= PROCPS_STAT_logical_end)
+ return -EINVAL;
+
/* no sense reading the stat with every call from a program like vmstat
who chooses not to use the much more efficient 'select' function ... */
cur_secs = time(NULL);
sav_secs = cur_secs;
}
- if (item < PROCPS_STAT_logical_end)
- return Item_table[item].getsfunc(info);
- return -EINVAL;
+ return Item_table[item].getsfunc(info);
} // end: procps_stat_get
PROCPS_STAT_SYS_DELTA_INTERRUPTS, // s_int
PROCPS_STAT_SYS_DELTA_PROC_BLOCKED, // s_int
PROCPS_STAT_SYS_DELTA_PROC_CREATED, // s_int
- PROCPS_STAT_SYS_DELTA_PROC_RUNNING, // s_int
+ PROCPS_STAT_SYS_DELTA_PROC_RUNNING // s_int
};
enum stat_reap_type {
struct stat_result {
enum stat_item item;
union {
- signed int s_int;
- signed long sl_int;
- unsigned long ul_int;
+ signed int s_int;
+ signed long sl_int;
+ unsigned long ul_int;
unsigned long long ull_int;
} result;
};
// ___ Public Functions |||||||||||||||||||||||||||||||||||||||||||||||||||||||
+// --- standard required functions --------------------------------------------
+
/*
* procps_vmstat_new:
*
} // end: procps_vmstat_unref
+// --- variable interface functions -------------------------------------------
+
PROCPS_EXPORT signed long procps_vmstat_get (
struct procps_vmstat *info,
enum vmstat_item item)
sav_secs = cur_secs;
}
- if (item < PROCPS_VMSTAT_logical_end)
- return Item_table[item].getsfunc(info);
- return -EINVAL;
+ return Item_table[item].getsfunc(info);
} // end: procps_vmstat_get
struct vmstat_result {
enum vmstat_item item;
union {
- signed long sl_int;
- unsigned long ul_int;
+ signed long sl_int;
+ unsigned long ul_int;
} result;
};