summaryrefslogtreecommitdiff
path: root/usr.bin/systat/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/systat/cpu.c')
-rw-r--r--usr.bin/systat/cpu.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/usr.bin/systat/cpu.c b/usr.bin/systat/cpu.c
index 22f525fd626..66ee9fbff63 100644
--- a/usr.bin/systat/cpu.c
+++ b/usr.bin/systat/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.7 2018/09/26 17:23:13 cheloha Exp $ */
+/* $OpenBSD: cpu.c,v 1.8 2018/10/05 18:56:57 cheloha Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
@@ -50,7 +50,6 @@
#include <sys/sched.h>
#include <sys/sysctl.h>
-#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
@@ -100,7 +99,6 @@ field_view views_cpu[] = {
};
int cpu_count;
-int *cpu_online;
int64_t *cpu_states;
int64_t **cpu_tm;
int64_t **cpu_old;
@@ -158,13 +156,8 @@ cpu_info(void)
for (i = 0; i < cpu_count; i++) {
cpu_time_mib[2] = i;
tmpstate = cpu_states + (CPUSTATES * i);
- if (sysctl(cpu_time_mib, 3, cpu_tm[i], &size, NULL, 0) < 0) {
- if (errno != ENODEV)
- error("sysctl KERN_CPTIME2");
- cpu_online[i] = 0;
- continue;
- }
- cpu_online[i] = 1;
+ if (sysctl(cpu_time_mib, 3, cpu_tm[i], &size, NULL, 0) < 0)
+ error("sysctl KERN_CPTIME2");
percentages(CPUSTATES, tmpstate, cpu_tm[i],
cpu_old[i], cpu_diff[i]);
}
@@ -207,8 +200,6 @@ initcpu(void)
mib[1] = HW_NCPU;
if (sysctl(mib, 2, &cpu_count, &size, NULL, 0) == -1)
return (-1);
- if ((cpu_online = calloc(cpu_count, sizeof(*cpu_online))) == NULL)
- return (-1);
if ((cpu_states = calloc(cpu_count,
CPUSTATES * sizeof(int64_t))) == NULL)
return (-1);
@@ -255,21 +246,6 @@ initcpu(void)
return; \
} while (0)
-#define ADD_OFFLINE_CPU(v) do { \
- if (cur >= dispstart && cur < end) { \
- print_fld_size(FLD_CPU_CPU, (v)); \
- print_fld_str(FLD_CPU_USR, "-"); \
- print_fld_str(FLD_CPU_NIC, "-"); \
- print_fld_str(FLD_CPU_SYS, "-"); \
- print_fld_str(FLD_CPU_SPIN, "-"); \
- print_fld_str(FLD_CPU_INT, "-"); \
- print_fld_str(FLD_CPU_IDLE, "-"); \
- end_line(); \
- } \
- if (++cur >= end) \
- return; \
-} while (0)
-
void
print_cpu(void)
{
@@ -282,10 +258,6 @@ print_cpu(void)
end = num_disp;
for (c = 0; c < cpu_count; c++) {
- if (!cpu_online[c]) {
- ADD_OFFLINE_CPU(c);
- continue;
- }
states = cpu_states + (CPUSTATES * c);
for (i = 0; i < CPUSTATES; i++)