return 0;
}
+// --------------------------------------------------------------------------------------------------------------------
+// vm.stats.sys.v_swtch
+
+int do_vm_stats_sys_v_swtch(int update_every, usec_t dt) {
+ static int mib[4] = {0, 0, 0, 0};
+ u_int ctxt_number;
+
+ if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_swtch", mib, ctxt_number))) {
+ error("DISABLED: system.ctxt chart");
+ error("DISABLED: vm.stats.sys.v_swtch module");
+ return 1;
+ } else {
+ static RRDSET *st = NULL;
+ static RRDDIM *rd = NULL;
+
+ st = rrdset_find_bytype_localhost("system", "ctxt");
+ if (unlikely(!st)) {
+ st = rrdset_create_localhost("system",
+ "ctxt",
+ NULL,
+ "processes",
+ NULL,
+ "CPU Context Switches",
+ "context switches/s",
+ 800,
+ update_every,
+ RRDSET_TYPE_LINE
+ );
+
+ rd = rrddim_add(st, "switches", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd, ctxt_number);
+ rrdset_done(st);
+ }
+
+ return 0;
+}
+
// --------------------------------------------------------------------------------------------------------------------
// old sources
#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_context = -1, do_forks = -1, do_disk_io = -1, do_swap = -1, do_ram = -1, do_swapio = -1,
+ static int 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_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_icmp6_neighbor = -1, do_icmp6_types = -1, do_space = -1, do_inodes = -1, do_uptime = -1;
if (unlikely(do_uptime == -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);
do_swap = config_get_boolean("plugin:freebsd:sysctl", "system swap", 1);
// --------------------------------------------------------------------
- if (likely(do_context)) {
- if (unlikely(GETSYSCTL_BY_NAME("vm.stats.sys.v_swtch", u_int_data))) {
- do_context = 0;
- error("DISABLED: system.ctxt");
- } else {
-
- st = rrdset_find_bytype_localhost("system", "ctxt");
- if (unlikely(!st)) {
- st = rrdset_create_localhost("system", "ctxt", NULL, "processes", NULL, "CPU Context Switches", "context switches/s", 800, update_every, RRDSET_TYPE_LINE);
-
- rrddim_add(st, "switches", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- }
- else rrdset_next(st);
-
- rrddim_set(st, "switches", u_int_data);
- rrdset_done(st);
- }
- }
-
- // --------------------------------------------------------------------
-
if (likely(do_forks)) {
if (unlikely(GETSYSCTL_BY_NAME("vm.stats.vm.v_forks", u_int_data))) {
do_forks = 0;
{ .name = "hw.intrcnt", .dim = "hw_intrcnt", .enabled = 1, .func = do_hw_intcnt },
{ .name = "vm.stats.sys.v_intr", .dim = "dev_intrcnt", .enabled = 1, .func = do_vm_stats_sys_v_intr },
{ .name = "vm.stats.sys.v_soft", .dim = "dev_intrcnt", .enabled = 1, .func = do_vm_stats_sys_v_soft },
+ { .name = "vm.stats.sys.v_swtch", .dim = "dev_intrcnt", .enabled = 1, .func = do_vm_stats_sys_v_swtch },
// the terminator of this array
{ .name = NULL, .dim = NULL, .enabled = 0, .func = NULL }