X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Ffreebsd_sysctl.c;h=ed84cb777a3d8baa68ee82b18e7e1a74769717f8;hb=2dc4b3d89cf602e616d6a3d51fce5dfbab5930da;hp=7e1b72fee5ae079b8daf4db1f38d1a810fa0e3d5;hpb=98c99c7de02c880daa00d425bb64542fb45f0a18;p=netdata.git diff --git a/src/freebsd_sysctl.c b/src/freebsd_sysctl.c index 7e1b72fe..ed84cb77 100644 --- a/src/freebsd_sysctl.c +++ b/src/freebsd_sysctl.c @@ -26,6 +26,9 @@ #include #include +// -------------------------------------------------------------------------------------------------------------------- +// common definitions and variables + #define KILO_FACTOR 1024 #define MEGA_FACTOR 1048576 // 1024 * 1024 #define GIGA_FACTOR 1073741824 // 1024 * 1024 * 1024 @@ -33,6 +36,7 @@ #define MAX_INT_DIGITS 10 // maximum number of digits for int int system_pagesize = PAGE_SIZE; +int number_of_cpus = 1; // -------------------------------------------------------------------------------------------------------------------- // FreeBSD plugin initialization @@ -45,6 +49,16 @@ int freebsd_plugin_init() return 1; } + if (unlikely(GETSYSCTL_BY_NAME("kern.smp.cpus", number_of_cpus))) { + error("FREEBSD: can't get number of cpus"); + return 1; + } + + if (unlikely(!number_of_cpus)) { + error("FREEBSD: wrong number of cpus"); + return 1; + } + return 0; } @@ -58,7 +72,7 @@ int do_vm_loadavg(int update_every, usec_t dt){ static usec_t next_loadavg_dt = 0; if (next_loadavg_dt <= dt) { - static int mib[2] = {0,0}; + static int mib[2] = {0, 0}; struct loadavg sysload; if (unlikely(GETSYSCTL_SIMPLE("vm.loadavg", mib, sysload))) { @@ -111,9 +125,9 @@ int do_vm_vmtotal(int update_every, usec_t dt) { static int do_all_processes = -1, do_processes = -1, do_committed = -1; if (unlikely(do_all_processes == -1)) { - do_all_processes = config_get_boolean("plugin:freebsd:vm.vmtotal", "enable total processes", 1); - do_processes = config_get_boolean("plugin:freebsd:vm.vmtotal", "processes running", 1); - do_committed = config_get_boolean("plugin:freebsd:vm.vmtotal", "committed memory", 1); + do_all_processes = config_get_boolean("plugin:freebsd:vm.vmtotal", "enable total processes", 1); + do_processes = config_get_boolean("plugin:freebsd:vm.vmtotal", "processes running", 1); + do_committed = config_get_boolean("plugin:freebsd:vm.vmtotal", "committed memory", 1); } if (likely(do_all_processes | do_processes | do_committed)) { @@ -241,6 +255,9 @@ int do_kern_cp_time(int update_every, usec_t dt) { error("DISABLED: kern.cp_time module"); return 1; } else { + + // -------------------------------------------------------------------- + static RRDSET *st = NULL; static RRDDIM *rd_nice = NULL, *rd_system = NULL, *rd_user = NULL, *rd_interrupt = NULL, *rd_idle = NULL; @@ -256,11 +273,11 @@ int do_kern_cp_time(int update_every, usec_t dt) { RRDSET_TYPE_STACKED ); - rd_nice = rrddim_add(st, "nice", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rd_system = rrddim_add(st, "system", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rd_user = rrddim_add(st, "user", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rd_interrupt = rrddim_add(st, "interrupt", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rd_idle = rrddim_add(st, "idle", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + rd_nice = rrddim_add(st, "nice", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + rd_system = rrddim_add(st, "system", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + rd_user = rrddim_add(st, "user", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + rd_interrupt = rrddim_add(st, "interrupt", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + rd_idle = rrddim_add(st, "idle", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); rrddim_hide(st, "idle"); } else rrdset_next(st); @@ -273,6 +290,275 @@ int do_kern_cp_time(int update_every, usec_t dt) { rrdset_done(st); } } + + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +// kern.cp_times + +int do_kern_cp_times(int update_every, usec_t dt) { + if (unlikely(CPUSTATES != 5)) { + error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES); + error("DISABLED: cpu.cpuXX charts"); + error("DISABLED: kern.cp_times module"); + return 1; + } else { + static int mib[2] = {0, 0}; + long cp_time[CPUSTATES]; + static long *pcpu_cp_time = NULL; + + pcpu_cp_time = reallocz(pcpu_cp_time, sizeof(cp_time) * number_of_cpus); + if (unlikely(GETSYSCTL_WSIZE("kern.cp_times", mib, pcpu_cp_time, sizeof(cp_time) * number_of_cpus))) { + error("DISABLED: cpu.cpuXX charts"); + error("DISABLED: kern.cp_times module"); + return 1; + } else { + + // -------------------------------------------------------------------- + + int i; + static struct cpu_chart { + char cpuid[MAX_INT_DIGITS + 4]; + RRDSET *st; + RRDDIM *rd_user; + RRDDIM *rd_nice; + RRDDIM *rd_system; + RRDDIM *rd_interrupt; + RRDDIM *rd_idle; + } *all_cpu_charts = NULL; + + all_cpu_charts = reallocz(all_cpu_charts, sizeof(struct cpu_chart) * number_of_cpus); + + for (i = 0; i < number_of_cpus; i++) { + if (unlikely(!all_cpu_charts[i].st)) { + snprintfz(all_cpu_charts[i].cpuid, MAX_INT_DIGITS, "cpu%d", i); + all_cpu_charts[i].st = rrdset_create_localhost("cpu", + all_cpu_charts[i].cpuid, + NULL, + "utilization", + "cpu.cpu", + "Core utilization", + "percentage", + 1000, + update_every, + RRDSET_TYPE_STACKED + ); + + all_cpu_charts[i].rd_nice = rrddim_add(all_cpu_charts[i].st, "nice", NULL, 1, 1, + RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + all_cpu_charts[i].rd_system = rrddim_add(all_cpu_charts[i].st, "system", NULL, 1, 1, + RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + all_cpu_charts[i].rd_user = rrddim_add(all_cpu_charts[i].st, "user", NULL, 1, 1, + RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + all_cpu_charts[i].rd_interrupt = rrddim_add(all_cpu_charts[i].st, "interrupt", NULL, 1, 1, + RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + all_cpu_charts[i].rd_idle = rrddim_add(all_cpu_charts[i].st, "idle", NULL, 1, 1, + RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); + rrddim_hide(all_cpu_charts[i].st, "idle"); + } else rrdset_next(all_cpu_charts[i].st); + + rrddim_set_by_pointer(all_cpu_charts[i].st, all_cpu_charts[i].rd_nice, pcpu_cp_time[i * 5 + 1]); + rrddim_set_by_pointer(all_cpu_charts[i].st, all_cpu_charts[i].rd_system, pcpu_cp_time[i * 5 + 2]); + rrddim_set_by_pointer(all_cpu_charts[i].st, all_cpu_charts[i].rd_user, pcpu_cp_time[i * 5 + 0]); + rrddim_set_by_pointer(all_cpu_charts[i].st, all_cpu_charts[i].rd_interrupt, pcpu_cp_time[i * 5 + 3]); + rrddim_set_by_pointer(all_cpu_charts[i].st, all_cpu_charts[i].rd_idle, pcpu_cp_time[i * 5 + 4]); + rrdset_done(all_cpu_charts[i].st); + } + } + } + + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +// hw.intrcnt + +int do_hw_intcnt(int update_every, usec_t dt) { + static int mib_hw_intrcnt[2] = {0, 0}; + size_t intrcnt_size; + int i; + + if (unlikely(GETSYSCTL_SIZE("hw.intrcnt", mib_hw_intrcnt, intrcnt_size))) { + error("DISABLED: system.intr chart"); + error("DISABLED: system.interrupts chart"); + error("DISABLED: hw.intrcnt module"); + return 1; + } else { + unsigned long nintr = 0; + static unsigned long *intrcnt = NULL; + unsigned long long totalintr = 0; + + nintr = intrcnt_size / sizeof(u_long); + intrcnt = reallocz(intrcnt, nintr * sizeof(u_long)); + if (unlikely(GETSYSCTL_WSIZE("hw.intrcnt", mib_hw_intrcnt, intrcnt, nintr * sizeof(u_long)))) { + error("DISABLED: system.intr chart"); + error("DISABLED: system.interrupts chart"); + error("DISABLED: hw.intrcnt module"); + return 1; + } else { + for (i = 0; i < nintr; i++) + totalintr += intrcnt[i]; + + // -------------------------------------------------------------------- + + static RRDSET *st_intr = NULL; + static RRDDIM *rd_intr = NULL; + + if (unlikely(!st_intr)) { + st_intr = rrdset_create_localhost("system", + "intr", + NULL, + "interrupts", + NULL, + "Total Hardware Interrupts", + "interrupts/s", + 900, + update_every, + RRDSET_TYPE_LINE + ); + rrdset_flag_set(st_intr, RRDSET_FLAG_DETAIL); + + rd_intr = rrddim_add(st_intr, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + } else + rrdset_next(st_intr); + + rrddim_set_by_pointer(st_intr, rd_intr, totalintr); + rrdset_done(st_intr); + + // -------------------------------------------------------------------- + + size_t size; + static int mib_hw_intrnames[2] = {0, 0}; + static char *intrnames = NULL; + + size = nintr * (MAXCOMLEN + 1); + intrnames = reallocz(intrnames, size); + if (unlikely(GETSYSCTL_WSIZE("hw.intrnames", mib_hw_intrnames, intrnames, size))) { + error("DISABLED: system.intr chart"); + error("DISABLED: system.interrupts chart"); + error("DISABLED: hw.intrcnt module"); + return 1; + } else { + + // -------------------------------------------------------------------- + + static RRDSET *st_interrupts = NULL; + RRDDIM *rd_interrupts = NULL; + void *p; + + if (unlikely(!st_interrupts)) + st_interrupts = rrdset_create_localhost("system", + "interrupts", + NULL, + "interrupts", + NULL, + "System interrupts", + "interrupts/s", + 1000, + update_every, + RRDSET_TYPE_STACKED + ); + else + rrdset_next(st_interrupts); + + for (i = 0; i < nintr; i++) { + p = intrnames + i * (MAXCOMLEN + 1); + if (unlikely((intrcnt[i] != 0) && (*(char *) p != 0))) { + rd_interrupts = rrddim_find(st_interrupts, p); + if (unlikely(!rd_interrupts)) + rd_interrupts = rrddim_add(st_interrupts, p, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_set_by_pointer(st_interrupts, rd_interrupts, intrcnt[i]); + } + } + rrdset_done(st_interrupts); + } + } + } + + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +// vm.stats.sys.v_intr + +int do_vm_stats_sys_v_intr(int update_every, usec_t dt) { + static int mib[4] = {0, 0, 0, 0}; + u_int int_number; + + if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_intr", mib, int_number))) { + error("DISABLED: system.dev_intr chart"); + error("DISABLED: vm.stats.sys.v_intr module"); + return 1; + } else { + + // -------------------------------------------------------------------- + + static RRDSET *st = NULL; + static RRDDIM *rd = NULL; + + st = rrdset_find_bytype_localhost("system", "dev_intr"); + if (unlikely(!st)) { + st = rrdset_create_localhost("system", + "dev_intr", + NULL, + "interrupts", + NULL, + "Device Interrupts", + "interrupts/s", + 1000, + update_every, + RRDSET_TYPE_LINE + ); + + rd = rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + } + else rrdset_next(st); + + rrddim_set_by_pointer(st, rd, int_number); + rrdset_done(st); + } + + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +// vm.stats.sys.v_soft + +int do_vm_stats_sys_v_soft(int update_every, usec_t dt) { + static int mib[4] = {0, 0, 0, 0}; + u_int soft_intr_number; + + if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_soft", mib, soft_intr_number))) { + error("DISABLED: system.dev_intr chart"); + error("DISABLED: vm.stats.sys.v_soft module"); + return 1; + } else { + static RRDSET *st = NULL; + static RRDDIM *rd = NULL; + + if (unlikely(!st)) { + st = rrdset_create_localhost("system", + "soft_intr", + NULL, + "interrupts", + NULL, + "Software Interrupts", + "interrupts/s", + 1100, + update_every, + RRDSET_TYPE_LINE + ); + + rd = rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + } + else rrdset_next(st); + + rrddim_set_by_pointer(st, rd, soft_intr_number); + rrdset_done(st); + } + + return 0; } // -------------------------------------------------------------------------------------------------------------------- @@ -285,9 +571,9 @@ int do_kern_cp_time(int update_every, usec_t dt) { #define IFA_DATA(s) (((struct if_data *)ifa->ifa_data)->ifi_ ## s) int do_freebsd_sysctl_old(int update_every, usec_t dt) { - static int do_cpu_cores = -1, do_interrupts = -1, do_context = -1, do_forks = -1, do_disk_io = -1, do_swap = -1, do_ram = -1, do_swapio = -1, + static int do_context = -1, do_forks = -1, do_disk_io = -1, do_swap = -1, do_ram = -1, do_swapio = -1, do_pgfaults = -1, do_ipc_semaphores = -1, do_ipc_shared_mem = -1, do_ipc_msg_queues = -1, - do_dev_intr = -1, do_soft_intr = -1, do_netisr = -1, do_netisr_per_core = -1, do_bandwidth = -1, + do_netisr = -1, do_netisr_per_core = -1, do_bandwidth = -1, do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1, do_ecn = -1, do_tcpext_syscookies = -1, do_tcpext_ofo = -1, do_tcpext_connaborts = -1, do_udp_packets = -1, do_udp_errors = -1, do_icmp_packets = -1, do_icmpmsg = -1, @@ -297,10 +583,6 @@ int do_freebsd_sysctl_old(int update_every, usec_t dt) { do_icmp6_neighbor = -1, do_icmp6_types = -1, do_space = -1, do_inodes = -1, do_uptime = -1; if (unlikely(do_uptime == -1)) { - do_cpu_cores = config_get_boolean("plugin:freebsd:sysctl", "per cpu core utilization", 1); - do_interrupts = config_get_boolean("plugin:freebsd:sysctl", "cpu interrupts", 1); - do_dev_intr = config_get_boolean("plugin:freebsd:sysctl", "device interrupts", 1); - do_soft_intr = config_get_boolean("plugin:freebsd:sysctl", "software interrupts", 1); do_context = config_get_boolean("plugin:freebsd:sysctl", "context switches", 1); do_forks = config_get_boolean("plugin:freebsd:sysctl", "processes started", 1); do_disk_io = config_get_boolean("plugin:freebsd:sysctl", "stats for all disks", 1); @@ -349,32 +631,16 @@ int do_freebsd_sysctl_old(int update_every, usec_t dt) { RRDSET *st; RRDDIM *rd; + int ncpus; int i, n; void *p; int common_error = 0; size_t size; char title[4096 + 1]; - // NEEDED BY: do_cpu_cores - long cp_time[CPUSTATES]; - - // NEEDED BY: du_cpu_cores, do_netisr, do_netisr_per_core - int ncpus; - - // NEEDED BY: do_cpu_cores - static long *pcpu_cp_time = NULL; - char cpuid[MAX_INT_DIGITS + 1]; - // NEEDED BY: do_context, do_forks u_int u_int_data; - // NEEDED BY: do_interrupts - size_t intrcnt_size; - unsigned long nintr = 0; - static unsigned long *intrcnt = NULL; - static char *intrnames = NULL; - unsigned long long totalintr = 0; - // NEEDED BY: do_disk_io #define BINTIME_SCALE 5.42101086242752217003726400434970855712890625e-17 // this is 1000/2^64 int numdevs; @@ -495,152 +761,6 @@ int do_freebsd_sysctl_old(int update_every, usec_t dt) { // -------------------------------------------------------------------- - if (likely(do_cpu_cores)) { - if (unlikely(CPUSTATES != 5)) { - error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES); - do_cpu_cores = 0; - error("DISABLED: cpu.cpuXX"); - } else { - if (unlikely(GETSYSCTL_BY_NAME("kern.smp.cpus", ncpus))) { - do_cpu_cores = 0; - error("DISABLED: cpu.cpuXX"); - } else { - pcpu_cp_time = reallocz(pcpu_cp_time, sizeof(cp_time) * ncpus); - if (unlikely(getsysctl_by_name("kern.cp_times", pcpu_cp_time, sizeof(cp_time) * ncpus))) { - do_cpu_cores = 0; - error("DISABLED: cpu.cpuXX"); - } else { - for (i = 0; i < ncpus; i++) { - snprintfz(cpuid, MAX_INT_DIGITS, "cpu%d", i); - st = rrdset_find_bytype_localhost("cpu", cpuid); - if (unlikely(!st)) { - st = rrdset_create_localhost("cpu", cpuid, NULL, "utilization", "cpu.cpu", "Core utilization", - "percentage", 1000, update_every, RRDSET_TYPE_STACKED); - - rrddim_add(st, "nice", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rrddim_add(st, "system", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rrddim_add(st, "user", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rrddim_add(st, "interrupt", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rrddim_add(st, "idle", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); - rrddim_hide(st, "idle"); - } else - rrdset_next(st); - - rrddim_set(st, "nice", pcpu_cp_time[i * 5 + 1]); - rrddim_set(st, "system", pcpu_cp_time[i * 5 + 2]); - rrddim_set(st, "user", pcpu_cp_time[i * 5 + 0]); - rrddim_set(st, "interrupt", pcpu_cp_time[i * 5 + 3]); - rrddim_set(st, "idle", pcpu_cp_time[i * 5 + 4]); - rrdset_done(st); - } - } - } - } - } - - // -------------------------------------------------------------------- - - if (likely(do_interrupts)) { - if (unlikely(sysctlbyname("hw.intrcnt", NULL, &intrcnt_size, NULL, 0) == -1)) { - error("FREEBSD: sysctl(hw.intrcnt...) failed: %s", strerror(errno)); - do_interrupts = 0; - error("DISABLED: system.intr"); - } else { - nintr = intrcnt_size / sizeof(u_long); - intrcnt = reallocz(intrcnt, nintr * sizeof(u_long)); - if (unlikely(getsysctl_by_name("hw.intrcnt", intrcnt, nintr * sizeof(u_long)))){ - do_interrupts = 0; - error("DISABLED: system.intr"); - } else { - for (i = 0; i < nintr; i++) - totalintr += intrcnt[i]; - - st = rrdset_find_bytype_localhost("system", "intr"); - if (unlikely(!st)) { - st = rrdset_create_localhost("system", "intr", NULL, "interrupts", NULL, "Total Hardware Interrupts", "interrupts/s", 900, update_every, RRDSET_TYPE_LINE); - rrdset_flag_set(st, RRDSET_FLAG_DETAIL); - - rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } - else rrdset_next(st); - - rrddim_set(st, "interrupts", totalintr); - rrdset_done(st); - - // -------------------------------------------------------------------- - - size = nintr * (MAXCOMLEN +1); - intrnames = reallocz(intrnames, size); - if (unlikely(getsysctl_by_name("hw.intrnames", intrnames, size))) { - do_interrupts = 0; - error("DISABLED: system.intr"); - } else { - st = rrdset_find_bytype_localhost("system", "interrupts"); - if (unlikely(!st)) - st = rrdset_create_localhost("system", "interrupts", NULL, "interrupts", NULL, "System interrupts", "interrupts/s", - 1000, update_every, RRDSET_TYPE_STACKED); - else - rrdset_next(st); - - for (i = 0; i < nintr; i++) { - p = intrnames + i * (MAXCOMLEN + 1); - if (unlikely((intrcnt[i] != 0) && (*(char*)p != 0))) { - rd = rrddim_find(st, p); - if (unlikely(!rd)) - rd = rrddim_add(st, p, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - rrddim_set_by_pointer(st, rd, intrcnt[i]); - } - } - rrdset_done(st); - } - } - } - } - - // -------------------------------------------------------------------- - - if (likely(do_dev_intr)) { - if (unlikely(GETSYSCTL_BY_NAME("vm.stats.sys.v_intr", u_int_data))) { - do_dev_intr = 0; - error("DISABLED: system.dev_intr"); - } else { - - st = rrdset_find_bytype_localhost("system", "dev_intr"); - if (unlikely(!st)) { - st = rrdset_create_localhost("system", "dev_intr", NULL, "interrupts", NULL, "Device Interrupts", "interrupts/s", 1000, update_every, RRDSET_TYPE_LINE); - - rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } - else rrdset_next(st); - - rrddim_set(st, "interrupts", u_int_data); - rrdset_done(st); - } - } - - // -------------------------------------------------------------------- - - if (likely(do_soft_intr)) { - if (unlikely(GETSYSCTL_BY_NAME("vm.stats.sys.v_soft", u_int_data))) { - do_soft_intr = 0; - error("DISABLED: system.dev_intr"); - } else { - - st = rrdset_find_bytype_localhost("system", "soft_intr"); - if (unlikely(!st)) { - st = rrdset_create_localhost("system", "soft_intr", NULL, "interrupts", NULL, "Software Interrupts", "interrupts/s", 1100, update_every, RRDSET_TYPE_LINE); - - rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } - else rrdset_next(st); - - rrddim_set(st, "interrupts", u_int_data); - rrdset_done(st); - } - } - - // -------------------------------------------------------------------- - if (likely(do_context)) { if (unlikely(GETSYSCTL_BY_NAME("vm.stats.sys.v_swtch", u_int_data))) { do_context = 0;