@cryptotaxi247 / netdata-1 / commits / 2dc4b3d89

Separate vm.stats.sys.v_soft module

Vladimir Kobal committed Mar 9, 2017 at 01:59 UTC 2dc4b3d89cf602e616d6a3d51fce5dfbab5930da
3 files changed +42 -23
src/freebsd_sysctl.c
+40 -23
@@ -522,6 +522,45 @@ int do_vm_stats_sys_v_intr(int update_every, usec_t dt) {
522 return 0;
523 }
524
525 +// --------------------------------------------------------------------------------------------------------------------
526 +// vm.stats.sys.v_soft
527 +
528 +int do_vm_stats_sys_v_soft(int update_every, usec_t dt) {
529 + static int mib[4] = {0, 0, 0, 0};
530 + u_int soft_intr_number;
531 +
532 + if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_soft", mib, soft_intr_number))) {
533 + error("DISABLED: system.dev_intr chart");
534 + error("DISABLED: vm.stats.sys.v_soft module");
535 + return 1;
536 + } else {
537 + static RRDSET *st = NULL;
538 + static RRDDIM *rd = NULL;
539 +
540 + if (unlikely(!st)) {
541 + st = rrdset_create_localhost("system",
542 + "soft_intr",
543 + NULL,
544 + "interrupts",
545 + NULL,
546 + "Software Interrupts",
547 + "interrupts/s",
548 + 1100,
549 + update_every,
550 + RRDSET_TYPE_LINE
551 + );
552 +
553 + rd = rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
554 + }
555 + else rrdset_next(st);
556 +
557 + rrddim_set_by_pointer(st, rd, soft_intr_number);
558 + rrdset_done(st);
559 + }
560 +
561 + return 0;
562 +}
563 +
564 // --------------------------------------------------------------------------------------------------------------------
565 // old sources
566
@@ -534,7 +573,7 @@ int do_vm_stats_sys_v_intr(int update_every, usec_t dt) {
573 int do_freebsd_sysctl_old(int update_every, usec_t dt) {
574 static int do_context = -1, do_forks = -1, do_disk_io = -1, do_swap = -1, do_ram = -1, do_swapio = -1,
575 do_pgfaults = -1, do_ipc_semaphores = -1, do_ipc_shared_mem = -1, do_ipc_msg_queues = -1,
537 - do_soft_intr = -1, do_netisr = -1, do_netisr_per_core = -1, do_bandwidth = -1,
576 + do_netisr = -1, do_netisr_per_core = -1, do_bandwidth = -1,
577 do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1,
578 do_ecn = -1, do_tcpext_syscookies = -1, do_tcpext_ofo = -1, do_tcpext_connaborts = -1,
579 do_udp_packets = -1, do_udp_errors = -1, do_icmp_packets = -1, do_icmpmsg = -1,
@@ -544,7 +583,6 @@ int do_freebsd_sysctl_old(int update_every, usec_t dt) {
583 do_icmp6_neighbor = -1, do_icmp6_types = -1, do_space = -1, do_inodes = -1, do_uptime = -1;
584
585 if (unlikely(do_uptime == -1)) {
547 - do_soft_intr = config_get_boolean("plugin:freebsd:sysctl", "software interrupts", 1);
586 do_context = config_get_boolean("plugin:freebsd:sysctl", "context switches", 1);
587 do_forks = config_get_boolean("plugin:freebsd:sysctl", "processes started", 1);
588 do_disk_io = config_get_boolean("plugin:freebsd:sysctl", "stats for all disks", 1);
@@ -723,27 +761,6 @@ int do_freebsd_sysctl_old(int update_every, usec_t dt) {
761
762 // --------------------------------------------------------------------
763
726 - if (likely(do_soft_intr)) {
727 - if (unlikely(GETSYSCTL_BY_NAME("vm.stats.sys.v_soft", u_int_data))) {
728 - do_soft_intr = 0;
729 - error("DISABLED: system.dev_intr");
730 - } else {
731 -
732 - st = rrdset_find_bytype_localhost("system", "soft_intr");
733 - if (unlikely(!st)) {
734 - st = rrdset_create_localhost("system", "soft_intr", NULL, "interrupts", NULL, "Software Interrupts", "interrupts/s", 1100, update_every, RRDSET_TYPE_LINE);
735 -
736 - rrddim_add(st, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
737 - }
738 - else rrdset_next(st);
739 -
740 - rrddim_set(st, "interrupts", u_int_data);
741 - rrdset_done(st);
742 - }
743 - }
744 -
745 - // --------------------------------------------------------------------
746 -
764 if (likely(do_context)) {
765 if (unlikely(GETSYSCTL_BY_NAME("vm.stats.sys.v_swtch", u_int_data))) {
766 do_context = 0;
src/plugin_freebsd.c
+1
@@ -22,6 +22,7 @@ static struct freebsd_module {
22 { .name = "kern.cp_times", .dim = "cp_times", .enabled = 1, .func = do_kern_cp_times },
23 { .name = "hw.intrcnt", .dim = "hw_intrcnt", .enabled = 1, .func = do_hw_intcnt },
24 { .name = "vm.stats.sys.v_intr", .dim = "dev_intrcnt", .enabled = 1, .func = do_vm_stats_sys_v_intr },
25 + { .name = "vm.stats.sys.v_soft", .dim = "dev_intrcnt", .enabled = 1, .func = do_vm_stats_sys_v_soft },
26
27 // the terminator of this array
28 { .name = NULL, .dim = NULL, .enabled = 0, .func = NULL }
src/plugin_freebsd.h
+1
@@ -13,6 +13,7 @@ extern int do_kern_cp_time(int update_every, usec_t dt);
13 extern int do_kern_cp_times(int update_every, usec_t dt);
14 extern int do_hw_intcnt(int update_every, usec_t dt);
15 extern int do_vm_stats_sys_v_intr(int update_every, usec_t dt);
16 +extern int do_vm_stats_sys_v_soft(int update_every, usec_t dt);
17 extern int do_freebsd_sysctl_old(int update_every, usec_t dt);
18
19 #define GETSYSCTL_MIB(name, mib) getsysctl_mib(name, mib, sizeof(mib)/sizeof(int))