diff --git a/proc/libprocps.sym b/proc/libprocps.sym index 655e8eec..7f4c30b0 100644 --- a/proc/libprocps.sym +++ b/proc/libprocps.sym @@ -62,14 +62,14 @@ global: procps_stat_read_jiffs; procps_stat_ref; procps_stat_unref; - procps_stat_get_cpu; - procps_stat_get_cpu_chain; - procps_stat_get_jiffs; - procps_stat_get_jiffs_all; - procps_stat_get_jiffs_hist; - procps_stat_get_jiffs_hist_all; - procps_stat_get_sys; - procps_stat_get_sys_chain; + procps_stat_cpu_get; + procps_stat_cpu_getstack; + procps_stat_jiffs_get; + procps_stat_jiffs_hist_get; + procps_stat_jiffs_fill; + procps_stat_jiffs_hist_fill; + procps_stat_sys_get; + procps_stat_sys_getstack; procps_uptime; procps_uptime_sprint; procps_uptime_sprint_short; diff --git a/proc/readstat.c b/proc/readstat.c index 64ca2324..8dfa5047 100644 --- a/proc/readstat.c +++ b/proc/readstat.c @@ -1,12 +1,31 @@ +/* + * libprocps - Library to read proc filesystem + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ -#include +#include +#include +#include #include #include -#include -#include -#include +#include + #include -#include +#include + #include #include "procps-private.h" @@ -33,8 +52,8 @@ struct procps_stat { struct stat_data data; int jiff_hists_alloc; int jiff_hists_inuse; - struct procps_jiffs_private *jiff_hists; struct procps_jiffs_private cpu_summary; + struct procps_jiffs_private *jiff_hists; }; @@ -58,8 +77,8 @@ PROCPS_EXPORT int procps_stat_new ( v->refcount = 1; v->stat_fd = -1; -/* v->jiff_hists_alloc = 0; unecessary with calloc */ -/* v->jiff_hists_inuse = 0; but serves as reminder */ +/* v->jiff_hists_alloc = 0; unnecessary with calloc, */ +/* v->jiff_hists_inuse = 0; but serves as a reminder */ *info = v; return 0; } @@ -177,7 +196,7 @@ PROCPS_EXPORT int procps_stat_unref ( return (*info)->refcount; } -PROCPS_EXPORT jiff procps_stat_get_cpu ( +PROCPS_EXPORT jiff procps_stat_cpu_get ( struct procps_stat *info, enum procps_cpu_item item) { @@ -202,59 +221,63 @@ PROCPS_EXPORT jiff procps_stat_get_cpu ( return info->data.cpu.guest; case PROCPS_CPU_GNICE: return info->data.cpu.gnice; + default: + return 0; } - return 0; } -PROCPS_EXPORT int procps_get_cpu_chain ( +PROCPS_EXPORT int procps_stat_cpu_getstack ( struct procps_stat *info, - struct procps_cpu_result *item) + struct stat_result *these) { - if (item == NULL) + if (these == NULL) return -EINVAL; - do { - switch (item->item) { + for (;;) { + switch (these->item) { case PROCPS_CPU_USER: - item->result = info->data.cpu.user; + these->result.jiff = info->data.cpu.user; break; case PROCPS_CPU_NICE: - item->result = info->data.cpu.nice; + these->result.jiff = info->data.cpu.nice; break; case PROCPS_CPU_SYSTEM: - item->result = info->data.cpu.system; + these->result.jiff = info->data.cpu.system; break; case PROCPS_CPU_IDLE: - item->result = info->data.cpu.idle; + these->result.jiff = info->data.cpu.idle; break; case PROCPS_CPU_IOWAIT: - item->result = info->data.cpu.iowait; + these->result.jiff = info->data.cpu.iowait; break; case PROCPS_CPU_IRQ: - item->result = info->data.cpu.irq; + these->result.jiff = info->data.cpu.irq; break; case PROCPS_CPU_SIRQ: - item->result = info->data.cpu.sirq; + these->result.jiff = info->data.cpu.sirq; break; case PROCPS_CPU_STOLEN: - item->result = info->data.cpu.stolen; + these->result.jiff = info->data.cpu.stolen; break; case PROCPS_CPU_GUEST: - item->result = info->data.cpu.guest; + these->result.jiff = info->data.cpu.guest; break; case PROCPS_CPU_GNICE: - item->result = info->data.cpu.gnice; + these->result.jiff = info->data.cpu.gnice; break; + case PROCPS_CPU_noop: + // don't disturb potential user data in the result struct + break; + case PROCPS_CPU_stack_end: + return 0; default: return -EINVAL; } - item = item->next; - } while (item); - - return 0; + ++these; + } } -PROCPS_EXPORT unsigned int procps_stat_get_sys ( +PROCPS_EXPORT unsigned int procps_stat_sys_get ( struct procps_stat *info, enum procps_stat_item item) { @@ -271,44 +294,48 @@ PROCPS_EXPORT unsigned int procps_stat_get_sys ( return info->data.procs_blocked; case PROCPS_STAT_PROCS_RUN: return info->data.procs_running; + default: + return 0; } - return 0; } -PROCPS_EXPORT int procps_stat_get_sys_chain ( +PROCPS_EXPORT int procps_stat_sys_getstack ( struct procps_stat *info, - struct procps_sys_result *item) + struct stat_result *these) { - if (item == NULL) + if (these == NULL) return -EINVAL; - do { - switch (item->item) { + for (;;) { + switch (these->item) { case PROCPS_STAT_INTR: - item->result = info->data.intr; + these->result.u_int = info->data.intr; break; case PROCPS_STAT_CTXT: - item->result = info->data.ctxt; + these->result.u_int = info->data.ctxt; break; case PROCPS_STAT_BTIME: - item->result = info->data.btime; + these->result.u_int = info->data.btime; break; case PROCPS_STAT_PROCS: - item->result = info->data.procs; + these->result.u_int = info->data.procs; break; case PROCPS_STAT_PROCS_BLK: - item->result = info->data.procs_blocked; + these->result.u_int = info->data.procs_blocked; break; case PROCPS_STAT_PROCS_RUN: - item->result = info->data.procs_running; + these->result.u_int = info->data.procs_running; break; + case PROCPS_STAT_noop: + // don't disturb potential user data in the result struct + break; + case PROCPS_STAT_stack_end: + return 0; default: return -EINVAL; } - item = item->next; - } while (item); - - return 0; + ++these; + } } /* @@ -405,14 +432,14 @@ reap_em_again: } /* - * procps_stat_get_jiffs: + * procps_stat_jiffs_get: * * Return the designated cpu data in the caller supplied structure. * A negative 'which' denotes the cpu_summary, not a real cpu. * * This function deals only with the 'current' jiffs counts. */ -PROCPS_EXPORT int procps_stat_get_jiffs ( +PROCPS_EXPORT int procps_stat_jiffs_get ( struct procps_stat *info, struct procps_jiffs *item, int which) @@ -440,27 +467,30 @@ PROCPS_EXPORT int procps_stat_get_jiffs ( } /* - * procps_stat_get_jiffs_all: + * procps_stat_jiffs_fill: * - * Return all available cpu data in the caller supplied structures, - * up to the lesser of numitems or total available. + * Refresh available cpu data, then return all cpu data in the caller + * supplied structures, up to the lesser of numitems or total available. * * We tolerate a numitems greater than the total available, and * the caller had better tolerate fewer returned than requested. * * This function deals only with the 'current' jiffs counts. */ -PROCPS_EXPORT int procps_stat_get_jiffs_all ( +PROCPS_EXPORT int procps_stat_jiffs_fill ( struct procps_stat *info, struct procps_jiffs *item, int numitems) { - int i; + int i, rc; if (info == NULL || item == NULL) return -EINVAL; + if ((rc = procps_stat_read_jiffs(info)) < 0) + return rc; if (!info->jiff_hists_inuse) return -1; + for (i = 0; i < info->jiff_hists_inuse && i < numitems; i++) { // note, we're just copying the 'new' portion of our procps_jiffs_private memcpy(item + i, info->jiff_hists + i, sizeof(struct procps_jiffs)); @@ -469,14 +499,14 @@ PROCPS_EXPORT int procps_stat_get_jiffs_all ( } /* - * procps_stat_get_jiffs_hist: + * procps_stat_jiffs_hist_get: * * Return the designated cpu data in the caller supplied structure. * A negative 'which' denotes the cpu_summary, not a real cpu. * * This function provides both 'new' and 'old' jiffs counts. */ -PROCPS_EXPORT int procps_stat_get_jiffs_hist ( +PROCPS_EXPORT int procps_stat_jiffs_hist_get ( struct procps_stat *info, struct procps_jiffs_hist *item, int which) @@ -502,27 +532,30 @@ PROCPS_EXPORT int procps_stat_get_jiffs_hist ( } /* - * procps_stat_get_jiffs_hist_all: + * procps_stat_jiffs_hist_fill: * - * Return all available cpu data in the caller supplied structures, - * up to the lesser of numitems or total available. + * Refresh available cpu data, then return all cpu data in the caller + * supplied structures, up to the lesser of numitems or total available. * * We tolerate a numitems greater than the total available, and * the caller had better tolerate fewer returned than requested. * * This function provides both 'new' and 'old' jiffs counts. */ -PROCPS_EXPORT int procps_stat_get_jiffs_hist_all ( +PROCPS_EXPORT int procps_stat_jiffs_hist_fill ( struct procps_stat *info, struct procps_jiffs_hist *item, int numitems) { - int i; + int i, rc; if (info == NULL || item == NULL) return -EINVAL; + if ((rc = procps_stat_read_jiffs(info)) < 0) + return rc; if (!info->jiff_hists_inuse) return -1; + for (i = 0; i < info->jiff_hists_inuse && i < numitems; i++) { memcpy(item + i, info->jiff_hists + i, sizeof(struct procps_jiffs_hist)); } diff --git a/proc/readstat.h b/proc/readstat.h index 5904a803..ebebeaf5 100644 --- a/proc/readstat.h +++ b/proc/readstat.h @@ -23,35 +23,33 @@ __BEGIN_DECLS enum procps_cpu_item { - PROCPS_CPU_USER, - PROCPS_CPU_NICE, - PROCPS_CPU_SYSTEM, - PROCPS_CPU_IDLE, - PROCPS_CPU_IOWAIT, - PROCPS_CPU_IRQ, - PROCPS_CPU_SIRQ, - PROCPS_CPU_STOLEN, - PROCPS_CPU_GUEST, - PROCPS_CPU_GNICE + PROCPS_CPU_USER, // jiff + PROCPS_CPU_NICE, // jiff + PROCPS_CPU_SYSTEM, // jiff + PROCPS_CPU_IDLE, // jiff + PROCPS_CPU_IOWAIT, // jiff + PROCPS_CPU_IRQ, // jiff + PROCPS_CPU_SIRQ, // jiff + PROCPS_CPU_STOLEN, // jiff + PROCPS_CPU_GUEST, // jiff + PROCPS_CPU_GNICE, // jiff + PROCPS_CPU_noop, // n/a + PROCPS_CPU_stack_end // n/a }; enum procps_stat_item { - PROCPS_STAT_INTR, - PROCPS_STAT_CTXT, - PROCPS_STAT_BTIME, - PROCPS_STAT_PROCS, - PROCPS_STAT_PROCS_BLK, - PROCPS_STAT_PROCS_RUN + PROCPS_STAT_INTR, // u_int + PROCPS_STAT_CTXT, // u_int + PROCPS_STAT_BTIME, // u_int + PROCPS_STAT_PROCS, // u_int + PROCPS_STAT_PROCS_BLK, // u_int + PROCPS_STAT_PROCS_RUN, // u_int + PROCPS_STAT_noop, // n/a + PROCPS_STAT_stack_end // n/a }; typedef unsigned long long jiff; -struct procps_cpu_result { - enum procps_cpu_item item; - jiff result; - struct procps_cpu_result *next; -}; - struct procps_jiffs { jiff user, nice, system, idle, iowait, irq, sirq, stolen, guest, gnice; }; @@ -62,10 +60,13 @@ struct procps_jiffs_hist { int id; }; -struct procps_sys_result { - enum procps_stat_item item; - int result; - struct procps_sys_result *next; +struct stat_result { + int item; + union { + unsigned int u_int; + jiff jiff; + } result; + struct stat_result *next; }; struct procps_stat; @@ -77,15 +78,41 @@ int procps_stat_read_jiffs (struct procps_stat *info); int procps_stat_ref (struct procps_stat *info); int procps_stat_unref (struct procps_stat **info); -jiff procps_stat_get_cpu (struct procps_stat *info, enum procps_cpu_item item); -int procps_stat_get_cpu_chain (struct procps_stat *info, struct procps_cpu_result *item); -int procps_stat_get_jiffs (struct procps_stat *info, struct procps_jiffs *item, int which); -int procps_stat_get_jiffs_all (struct procps_stat *info, struct procps_jiffs *item, int numitems); -int procps_stat_get_jiffs_hist (struct procps_stat *info, struct procps_jiffs_hist *item, int which); -int procps_stat_get_jiffs_hist_all (struct procps_stat *info, struct procps_jiffs_hist *item, int numitems); +jiff procps_stat_cpu_get ( + struct procps_stat *info, + enum procps_cpu_item item); -unsigned int procps_stat_get_sys (struct procps_stat *info, enum procps_stat_item item); -int procps_stat_get_sys_chain (struct procps_stat *info, struct procps_sys_result *item); +int procps_stat_cpu_getstack ( + struct procps_stat *info, + struct stat_result *item); + +int procps_stat_jiffs_get ( + struct procps_stat *info, + struct procps_jiffs *item, + int which); + +int procps_stat_jiffs_hist_get ( + struct procps_stat *info, + struct procps_jiffs_hist *item, + int which); + +int procps_stat_jiffs_fill ( + struct procps_stat *info, + struct procps_jiffs *item, + int numitems); + +int procps_stat_jiffs_hist_fill ( + struct procps_stat *info, + struct procps_jiffs_hist *item, + int numitems); + +unsigned int procps_stat_sys_get ( + struct procps_stat *info, + enum procps_stat_item item); + +int procps_stat_sys_getstack ( + struct procps_stat *info, + struct stat_result *item); __END_DECLS #endif diff --git a/ps/output.c b/ps/output.c index c8da63cb..48719f3b 100644 --- a/ps/output.c +++ b/ps/output.c @@ -105,7 +105,7 @@ static void get_boot_time(void) if (procps_stat_read(sys_info,0) < 0) xerrx(EXIT_FAILURE, _("Unable to read system stat information")); - boot_time = procps_stat_get_sys(sys_info, PROCPS_STAT_BTIME); + boot_time = procps_stat_sys_get(sys_info, PROCPS_STAT_BTIME); procps_stat_unref(&sys_info); } diff --git a/top/top.c b/top/top.c index 465f181d..4589b6c7 100644 --- a/top/top.c +++ b/top/top.c @@ -2394,15 +2394,13 @@ static void cpus_refresh (void) { Cpu_jiffs = alloc_c(totSLOT * sizeof(struct procps_jiffs_hist)); } - // 1st, snapshot the proc/stat cpu jiffs - if (procps_stat_read_jiffs(Cpu_ctx) < 0) + // 1st, retrieve all of the actual cpu jiffs + // 'hist_fill' also implies 'read', saving us one more call + Cpu_faux_cnt = procps_stat_jiffs_hist_fill(Cpu_ctx, Cpu_jiffs, sumSLOT); + if (Cpu_faux_cnt < 0) error_exit(N_txt(LIB_errorcpu_txt)); // 2nd, retrieve just the cpu summary jiffs - if (procps_stat_get_jiffs_hist(Cpu_ctx, &Cpu_jiffs[sumSLOT], -1) < 0) - error_exit(N_txt(LIB_errorcpu_txt)); - // 3rd, retrieve all of the actual cpu jiffs - Cpu_faux_cnt = procps_stat_get_jiffs_hist_all(Cpu_ctx, Cpu_jiffs, sumSLOT); - if (Cpu_faux_cnt < 0) + if (procps_stat_jiffs_hist_get(Cpu_ctx, &Cpu_jiffs[sumSLOT], -1) < 0) error_exit(N_txt(LIB_errorcpu_txt)); #ifndef NUMA_DISABLE diff --git a/vmstat.c b/vmstat.c index 919076e6..978d8a6e 100644 --- a/vmstat.c +++ b/vmstat.c @@ -259,16 +259,16 @@ static void new_format(void) strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr); } /* Do the initial fill */ - cpu_use[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_USER) + - procps_stat_get_cpu(sys_info, PROCPS_CPU_NICE); - cpu_sys[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_SYSTEM); - procps_stat_get_cpu(sys_info, PROCPS_CPU_IRQ) + - procps_stat_get_cpu(sys_info, PROCPS_CPU_SIRQ); - cpu_idl[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_IDLE); - cpu_iow[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_IOWAIT); - cpu_sto[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_STOLEN); - intr[tog] = procps_stat_get_sys(sys_info, PROCPS_STAT_INTR); - ctxt[tog] = procps_stat_get_sys(sys_info, PROCPS_STAT_CTXT); + cpu_use[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_USER) + + procps_stat_cpu_get(sys_info, PROCPS_CPU_NICE); + cpu_sys[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_SYSTEM); + procps_stat_cpu_get(sys_info, PROCPS_CPU_IRQ) + + procps_stat_cpu_get(sys_info, PROCPS_CPU_SIRQ); + cpu_idl[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_IDLE); + cpu_iow[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_IOWAIT); + cpu_sto[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_STOLEN); + intr[tog] = procps_stat_sys_get(sys_info, PROCPS_STAT_INTR); + ctxt[tog] = procps_stat_sys_get(sys_info, PROCPS_STAT_CTXT); pgpgin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN); pgpgout[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT); pswpin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN); @@ -282,8 +282,8 @@ static void new_format(void) divo2 = Div / 2UL; printf(w_option ? wide_format : format, - procps_stat_get_sys(sys_info, PROCPS_STAT_PROCS_RUN), - procps_stat_get_sys(sys_info, PROCPS_STAT_PROCS_BLK), + procps_stat_sys_get(sys_info, PROCPS_STAT_PROCS_RUN), + procps_stat_sys_get(sys_info, PROCPS_STAT_PROCS_BLK), unitConvert(procps_meminfo_get(mem_info, PROCPS_SWAP_USED)), unitConvert(procps_meminfo_get(mem_info, PROCPS_MEM_FREE)), unitConvert(procps_meminfo_get(mem_info, (a_option?PROCPS_MEM_INACTIVE:PROCPS_MEM_BUFFERS))), @@ -321,16 +321,16 @@ static void new_format(void) xerrx(EXIT_FAILURE, _("Unable to read vmstat information")); - cpu_use[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_USER) + - procps_stat_get_cpu(sys_info, PROCPS_CPU_NICE); - cpu_sys[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_SYSTEM); - procps_stat_get_cpu(sys_info, PROCPS_CPU_IRQ) + - procps_stat_get_cpu(sys_info, PROCPS_CPU_SIRQ); - cpu_idl[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_IDLE); - cpu_iow[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_IOWAIT); - cpu_sto[tog] = procps_stat_get_cpu(sys_info, PROCPS_CPU_STOLEN); - intr[tog] = procps_stat_get_sys(sys_info, PROCPS_STAT_INTR); - ctxt[tog] = procps_stat_get_sys(sys_info, PROCPS_STAT_CTXT); + cpu_use[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_USER) + + procps_stat_cpu_get(sys_info, PROCPS_CPU_NICE); + cpu_sys[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_SYSTEM); + procps_stat_cpu_get(sys_info, PROCPS_CPU_IRQ) + + procps_stat_cpu_get(sys_info, PROCPS_CPU_SIRQ); + cpu_idl[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_IDLE); + cpu_iow[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_IOWAIT); + cpu_sto[tog] = procps_stat_cpu_get(sys_info, PROCPS_CPU_STOLEN); + intr[tog] = procps_stat_sys_get(sys_info, PROCPS_STAT_INTR); + ctxt[tog] = procps_stat_sys_get(sys_info, PROCPS_STAT_CTXT); pgpgin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN); pgpgout[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT); pswpin[tog] = procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN); @@ -366,8 +366,8 @@ static void new_format(void) if (!Div) Div = 1, didl = 1; divo2 = Div / 2UL; printf(w_option ? wide_format : format, - procps_stat_get_sys(sys_info, PROCPS_STAT_PROCS_RUN), - procps_stat_get_sys(sys_info, PROCPS_STAT_PROCS_BLK), + procps_stat_sys_get(sys_info, PROCPS_STAT_PROCS_RUN), + procps_stat_sys_get(sys_info, PROCPS_STAT_PROCS_BLK), unitConvert(procps_meminfo_get(mem_info, PROCPS_SWAP_USED)), unitConvert(procps_meminfo_get(mem_info, PROCPS_MEM_FREE)), unitConvert(procps_meminfo_get(mem_info, @@ -761,24 +761,24 @@ static void sum_format(void) mem_info, PROCPS_SWAP_USED)), szDataUnit); printf(_("%13lu %s free swap\n"), unitConvert(procps_meminfo_get( mem_info, PROCPS_SWAP_FREE)), szDataUnit); - printf(_("%13lld non-nice user cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_USER)); - printf(_("%13lld nice user cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_NICE)); - printf(_("%13lld system cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_SYSTEM)); - printf(_("%13lld idle cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_IDLE)); - printf(_("%13lld IO-wait cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_IOWAIT)); - printf(_("%13lld IRQ cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_IRQ)); - printf(_("%13lld softirq cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_SIRQ)); - printf(_("%13lld stolen cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_STOLEN)); - printf(_("%13lld non-nice guest cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_GUEST)); - printf(_("%13lld nice guest cpu ticks\n"), procps_stat_get_cpu(sys_info, PROCPS_CPU_GNICE)); + printf(_("%13lld non-nice user cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_USER)); + printf(_("%13lld nice user cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_NICE)); + printf(_("%13lld system cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_SYSTEM)); + printf(_("%13lld idle cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_IDLE)); + printf(_("%13lld IO-wait cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_IOWAIT)); + printf(_("%13lld IRQ cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_IRQ)); + printf(_("%13lld softirq cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_SIRQ)); + printf(_("%13lld stolen cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_STOLEN)); + printf(_("%13lld non-nice guest cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_GUEST)); + printf(_("%13lld nice guest cpu ticks\n"), procps_stat_cpu_get(sys_info, PROCPS_CPU_GNICE)); printf(_("%13lu pages paged in\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGIN)); printf(_("%13lu pages paged out\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PGPGOUT)); printf(_("%13lu pages swapped in\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPIN)); printf(_("%13lu pages swapped out\n"), procps_vmstat_get(vm_info, PROCPS_VMSTAT_PSWPOUT)); - printf(_("%13u interrupts\n"), procps_stat_get_sys(sys_info, PROCPS_STAT_INTR)); - printf(_("%13u CPU context switches\n"), procps_stat_get_sys(sys_info, PROCPS_STAT_CTXT)); - printf(_("%13u boot time\n"), procps_stat_get_sys(sys_info, PROCPS_STAT_BTIME)); - printf(_("%13u forks\n"), procps_stat_get_sys(sys_info, PROCPS_STAT_PROCS)); + printf(_("%13u interrupts\n"), procps_stat_sys_get(sys_info, PROCPS_STAT_INTR)); + printf(_("%13u CPU context switches\n"), procps_stat_sys_get(sys_info, PROCPS_STAT_CTXT)); + printf(_("%13u boot time\n"), procps_stat_sys_get(sys_info, PROCPS_STAT_BTIME)); + printf(_("%13u forks\n"), procps_stat_sys_get(sys_info, PROCPS_STAT_PROCS)); } static void fork_format(void) @@ -792,7 +792,7 @@ static void fork_format(void) xerrx(EXIT_FAILURE, _("Unable to read system stat information")); - printf(_("%13u forks\n"), procps_stat_get_sys(sys_info, PROCPS_STAT_PROCS)); + printf(_("%13u forks\n"), procps_stat_sys_get(sys_info, PROCPS_STAT_PROCS)); } static int winhi(void)