X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fproc_vmstat.c;h=847487363e6b7218cb2cbc1b6ef4e9d463bcb216;hb=b2fadefcff3168d154d36549b4c8a0b622b733aa;hp=7e646427d1801345bdcca2a54554f4153434a769;hpb=d7a1f3c8494e0546fc4c31d22b390a87ea9bd21a;p=netdata.git diff --git a/src/proc_vmstat.c b/src/proc_vmstat.c index 7e646427..84748736 100644 --- a/src/proc_vmstat.c +++ b/src/proc_vmstat.c @@ -7,268 +7,62 @@ int do_proc_vmstat(int update_every, usec_t dt) { static int do_swapio = -1, do_io = -1, do_pgfaults = -1, do_numa = -1; static int has_numa = -1; - // static uint32_t hash_allocstall_dma = 0; - // static uint32_t hash_allocstall_dma32 = 0; - // static uint32_t hash_allocstall_movable = 0; - // static uint32_t hash_allocstall_normal = 0; - // static uint32_t hash_balloon_deflate = 0; - // static uint32_t hash_balloon_inflate = 0; - // static uint32_t hash_balloon_migrate = 0; - // static uint32_t hash_compact_daemon_wake = 0; - // static uint32_t hash_compact_fail = 0; - // static uint32_t hash_compact_free_scanned = 0; - // static uint32_t hash_compact_isolated = 0; - // static uint32_t hash_compact_migrate_scanned = 0; - // static uint32_t hash_compact_stall = 0; - // static uint32_t hash_compact_success = 0; - // static uint32_t hash_drop_pagecache = 0; - // static uint32_t hash_drop_slab = 0; - // static uint32_t hash_htlb_buddy_alloc_fail = 0; - // static uint32_t hash_htlb_buddy_alloc_success = 0; - // static uint32_t hash_kswapd_high_wmark_hit_quickly = 0; - // static uint32_t hash_kswapd_inodesteal = 0; - // static uint32_t hash_kswapd_low_wmark_hit_quickly = 0; - // static uint32_t hash_nr_active_anon = 0; - // static uint32_t hash_nr_active_file = 0; - // static uint32_t hash_nr_anon_pages = 0; - // static uint32_t hash_nr_anon_transparent_hugepages = 0; - // static uint32_t hash_nr_bounce = 0; - // static uint32_t hash_nr_dirtied = 0; - // static uint32_t hash_nr_dirty = 0; - // static uint32_t hash_nr_dirty_background_threshold = 0; - // static uint32_t hash_nr_dirty_threshold = 0; - // static uint32_t hash_nr_file_pages = 0; - // static uint32_t hash_nr_free_cma = 0; - // static uint32_t hash_nr_free_pages = 0; - // static uint32_t hash_nr_inactive_anon = 0; - // static uint32_t hash_nr_inactive_file = 0; - // static uint32_t hash_nr_isolated_anon = 0; - // static uint32_t hash_nr_isolated_file = 0; - // static uint32_t hash_nr_kernel_stack = 0; - // static uint32_t hash_nr_mapped = 0; - // static uint32_t hash_nr_mlock = 0; - // static uint32_t hash_nr_pages_scanned = 0; - // static uint32_t hash_nr_page_table_pages = 0; - // static uint32_t hash_nr_shmem = 0; - // static uint32_t hash_nr_shmem_hugepages = 0; - // static uint32_t hash_nr_shmem_pmdmapped = 0; - // static uint32_t hash_nr_slab_reclaimable = 0; - // static uint32_t hash_nr_slab_unreclaimable = 0; - // static uint32_t hash_nr_unevictable = 0; - // static uint32_t hash_nr_unstable = 0; - // static uint32_t hash_nr_vmscan_immediate_reclaim = 0; - // static uint32_t hash_nr_vmscan_write = 0; - // static uint32_t hash_nr_writeback = 0; - // static uint32_t hash_nr_writeback_temp = 0; - // static uint32_t hash_nr_written = 0; - // static uint32_t hash_nr_zone_active_anon = 0; - // static uint32_t hash_nr_zone_active_file = 0; - // static uint32_t hash_nr_zone_inactive_anon = 0; - // static uint32_t hash_nr_zone_inactive_file = 0; - // static uint32_t hash_nr_zone_unevictable = 0; - // static uint32_t hash_nr_zone_write_pending = 0; - // static uint32_t hash_nr_zspages = 0; - static uint32_t hash_numa_foreign = 0; - static uint32_t hash_numa_hint_faults = 0; - static uint32_t hash_numa_hint_faults_local = 0; - //static uint32_t hash_numa_hit = 0; - static uint32_t hash_numa_huge_pte_updates = 0; - static uint32_t hash_numa_interleave = 0; - static uint32_t hash_numa_local = 0; - //static uint32_t hash_numa_miss = 0; - static uint32_t hash_numa_other = 0; - static uint32_t hash_numa_pages_migrated = 0; - static uint32_t hash_numa_pte_updates = 0; - // static uint32_t hash_pageoutrun = 0; - // static uint32_t hash_pgactivate = 0; - // static uint32_t hash_pgalloc_dma = 0; - // static uint32_t hash_pgalloc_dma32 = 0; - // static uint32_t hash_pgalloc_movable = 0; - // static uint32_t hash_pgalloc_normal = 0; - // static uint32_t hash_pgdeactivate = 0; - static uint32_t hash_pgfault = 0; - // static uint32_t hash_pgfree = 0; - // static uint32_t hash_pginodesteal = 0; - // static uint32_t hash_pglazyfreed = 0; - static uint32_t hash_pgmajfault = 0; - // static uint32_t hash_pgmigrate_fail = 0; - // static uint32_t hash_pgmigrate_success = 0; - static uint32_t hash_pgpgin = 0; - static uint32_t hash_pgpgout = 0; - // static uint32_t hash_pgrefill = 0; - // static uint32_t hash_pgrotated = 0; - // static uint32_t hash_pgscan_direct = 0; - // static uint32_t hash_pgscan_direct_throttle = 0; - // static uint32_t hash_pgscan_kswapd = 0; - // static uint32_t hash_pgskip_dma = 0; - // static uint32_t hash_pgskip_dma32 = 0; - // static uint32_t hash_pgskip_movable = 0; - // static uint32_t hash_pgskip_normal = 0; - // static uint32_t hash_pgsteal_direct = 0; - // static uint32_t hash_pgsteal_kswapd = 0; - static uint32_t hash_pswpin = 0; - static uint32_t hash_pswpout = 0; - // static uint32_t hash_slabs_scanned = 0; - // static uint32_t hash_thp_collapse_alloc = 0; - // static uint32_t hash_thp_collapse_alloc_failed = 0; - // static uint32_t hash_thp_deferred_split_page = 0; - // static uint32_t hash_thp_fault_alloc = 0; - // static uint32_t hash_thp_fault_fallback = 0; - // static uint32_t hash_thp_file_alloc = 0; - // static uint32_t hash_thp_file_mapped = 0; - // static uint32_t hash_thp_split_page = 0; - // static uint32_t hash_thp_split_page_failed = 0; - // static uint32_t hash_thp_split_pmd = 0; - // static uint32_t hash_thp_zero_page_alloc = 0; - // static uint32_t hash_thp_zero_page_alloc_failed = 0; - // static uint32_t hash_unevictable_pgs_cleared = 0; - // static uint32_t hash_unevictable_pgs_culled = 0; - // static uint32_t hash_unevictable_pgs_mlocked = 0; - // static uint32_t hash_unevictable_pgs_munlocked = 0; - // static uint32_t hash_unevictable_pgs_rescued = 0; - // static uint32_t hash_unevictable_pgs_scanned = 0; - // static uint32_t hash_unevictable_pgs_stranded = 0; - // static uint32_t hash_workingset_activate = 0; - // static uint32_t hash_workingset_nodereclaim = 0; - // static uint32_t hash_workingset_refault = 0; - // static uint32_t hash_zone_reclaim_failed = 0; - - if(unlikely(do_swapio == -1)) { - do_swapio = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "swap i/o", CONFIG_ONDEMAND_ONDEMAND); + static ARL_BASE *arl_base = NULL; + static unsigned long long numa_foreign = 0ULL; + static unsigned long long numa_hint_faults = 0ULL; + static unsigned long long numa_hint_faults_local = 0ULL; + static unsigned long long numa_huge_pte_updates = 0ULL; + static unsigned long long numa_interleave = 0ULL; + static unsigned long long numa_local = 0ULL; + static unsigned long long numa_other = 0ULL; + static unsigned long long numa_pages_migrated = 0ULL; + static unsigned long long numa_pte_updates = 0ULL; + static unsigned long long pgfault = 0ULL; + static unsigned long long pgmajfault = 0ULL; + static unsigned long long pgpgin = 0ULL; + static unsigned long long pgpgout = 0ULL; + static unsigned long long pswpin = 0ULL; + static unsigned long long pswpout = 0ULL; + + if(unlikely(!arl_base)) { + do_swapio = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "swap i/o", CONFIG_BOOLEAN_AUTO); do_io = config_get_boolean("plugin:proc:/proc/vmstat", "disk i/o", 1); do_pgfaults = config_get_boolean("plugin:proc:/proc/vmstat", "memory page faults", 1); - do_numa = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "system-wide numa metric summary", CONFIG_ONDEMAND_ONDEMAND); - - // hash_allocstall_dma32 = simple_hash("allocstall_dma32"); - // hash_allocstall_dma = simple_hash("allocstall_dma"); - // hash_allocstall_movable = simple_hash("allocstall_movable"); - // hash_allocstall_normal = simple_hash("allocstall_normal"); - // hash_balloon_deflate = simple_hash("balloon_deflate"); - // hash_balloon_inflate = simple_hash("balloon_inflate"); - // hash_balloon_migrate = simple_hash("balloon_migrate"); - // hash_compact_daemon_wake = simple_hash("compact_daemon_wake"); - // hash_compact_fail = simple_hash("compact_fail"); - // hash_compact_free_scanned = simple_hash("compact_free_scanned"); - // hash_compact_isolated = simple_hash("compact_isolated"); - // hash_compact_migrate_scanned = simple_hash("compact_migrate_scanned"); - // hash_compact_stall = simple_hash("compact_stall"); - // hash_compact_success = simple_hash("compact_success"); - // hash_drop_pagecache = simple_hash("drop_pagecache"); - // hash_drop_slab = simple_hash("drop_slab"); - // hash_htlb_buddy_alloc_fail = simple_hash("htlb_buddy_alloc_fail"); - // hash_htlb_buddy_alloc_success = simple_hash("htlb_buddy_alloc_success"); - // hash_kswapd_high_wmark_hit_quickly = simple_hash("kswapd_high_wmark_hit_quickly"); - // hash_kswapd_inodesteal = simple_hash("kswapd_inodesteal"); - // hash_kswapd_low_wmark_hit_quickly = simple_hash("kswapd_low_wmark_hit_quickly"); - // hash_nr_active_anon = simple_hash("nr_active_anon"); - // hash_nr_active_file = simple_hash("nr_active_file"); - // hash_nr_anon_pages = simple_hash("nr_anon_pages"); - // hash_nr_anon_transparent_hugepages = simple_hash("nr_anon_transparent_hugepages"); - // hash_nr_bounce = simple_hash("nr_bounce"); - // hash_nr_dirtied = simple_hash("nr_dirtied"); - // hash_nr_dirty_background_threshold = simple_hash("nr_dirty_background_threshold"); - // hash_nr_dirty = simple_hash("nr_dirty"); - // hash_nr_dirty_threshold = simple_hash("nr_dirty_threshold"); - // hash_nr_file_pages = simple_hash("nr_file_pages"); - // hash_nr_free_cma = simple_hash("nr_free_cma"); - // hash_nr_free_pages = simple_hash("nr_free_pages"); - // hash_nr_inactive_anon = simple_hash("nr_inactive_anon"); - // hash_nr_inactive_file = simple_hash("nr_inactive_file"); - // hash_nr_isolated_anon = simple_hash("nr_isolated_anon"); - // hash_nr_isolated_file = simple_hash("nr_isolated_file"); - // hash_nr_kernel_stack = simple_hash("nr_kernel_stack"); - // hash_nr_mapped = simple_hash("nr_mapped"); - // hash_nr_mlock = simple_hash("nr_mlock"); - // hash_nr_pages_scanned = simple_hash("nr_pages_scanned"); - // hash_nr_page_table_pages = simple_hash("nr_page_table_pages"); - // hash_nr_shmem_hugepages = simple_hash("nr_shmem_hugepages"); - // hash_nr_shmem_pmdmapped = simple_hash("nr_shmem_pmdmapped"); - // hash_nr_shmem = simple_hash("nr_shmem"); - // hash_nr_slab_reclaimable = simple_hash("nr_slab_reclaimable"); - // hash_nr_slab_unreclaimable = simple_hash("nr_slab_unreclaimable"); - // hash_nr_unevictable = simple_hash("nr_unevictable"); - // hash_nr_unstable = simple_hash("nr_unstable"); - // hash_nr_vmscan_immediate_reclaim = simple_hash("nr_vmscan_immediate_reclaim"); - // hash_nr_vmscan_write = simple_hash("nr_vmscan_write"); - // hash_nr_writeback = simple_hash("nr_writeback"); - // hash_nr_writeback_temp = simple_hash("nr_writeback_temp"); - // hash_nr_written = simple_hash("nr_written"); - // hash_nr_zone_active_anon = simple_hash("nr_zone_active_anon"); - // hash_nr_zone_active_file = simple_hash("nr_zone_active_file"); - // hash_nr_zone_inactive_anon = simple_hash("nr_zone_inactive_anon"); - // hash_nr_zone_inactive_file = simple_hash("nr_zone_inactive_file"); - // hash_nr_zone_unevictable = simple_hash("nr_zone_unevictable"); - // hash_nr_zone_write_pending = simple_hash("nr_zone_write_pending"); - // hash_nr_zspages = simple_hash("nr_zspages"); - hash_numa_foreign = simple_hash("numa_foreign"); - hash_numa_hint_faults_local = simple_hash("numa_hint_faults_local"); - hash_numa_hint_faults = simple_hash("numa_hint_faults"); - //hash_numa_hit = simple_hash("numa_hit"); - hash_numa_huge_pte_updates = simple_hash("numa_huge_pte_updates"); - hash_numa_interleave = simple_hash("numa_interleave"); - hash_numa_local = simple_hash("numa_local"); - //hash_numa_miss = simple_hash("numa_miss"); - hash_numa_other = simple_hash("numa_other"); - hash_numa_pages_migrated = simple_hash("numa_pages_migrated"); - hash_numa_pte_updates = simple_hash("numa_pte_updates"); - // hash_pageoutrun = simple_hash("pageoutrun"); - // hash_pgactivate = simple_hash("pgactivate"); - // hash_pgalloc_dma32 = simple_hash("pgalloc_dma32"); - // hash_pgalloc_dma = simple_hash("pgalloc_dma"); - // hash_pgalloc_movable = simple_hash("pgalloc_movable"); - // hash_pgalloc_normal = simple_hash("pgalloc_normal"); - // hash_pgdeactivate = simple_hash("pgdeactivate"); - hash_pgfault = simple_hash("pgfault"); - // hash_pgfree = simple_hash("pgfree"); - // hash_pginodesteal = simple_hash("pginodesteal"); - // hash_pglazyfreed = simple_hash("pglazyfreed"); - hash_pgmajfault = simple_hash("pgmajfault"); - // hash_pgmigrate_fail = simple_hash("pgmigrate_fail"); - // hash_pgmigrate_success = simple_hash("pgmigrate_success"); - hash_pgpgin = simple_hash("pgpgin"); - hash_pgpgout = simple_hash("pgpgout"); - // hash_pgrefill = simple_hash("pgrefill"); - // hash_pgrotated = simple_hash("pgrotated"); - // hash_pgscan_direct = simple_hash("pgscan_direct"); - // hash_pgscan_direct_throttle = simple_hash("pgscan_direct_throttle"); - // hash_pgscan_kswapd = simple_hash("pgscan_kswapd"); - // hash_pgskip_dma32 = simple_hash("pgskip_dma32"); - // hash_pgskip_dma = simple_hash("pgskip_dma"); - // hash_pgskip_movable = simple_hash("pgskip_movable"); - // hash_pgskip_normal = simple_hash("pgskip_normal"); - // hash_pgsteal_direct = simple_hash("pgsteal_direct"); - // hash_pgsteal_kswapd = simple_hash("pgsteal_kswapd"); - hash_pswpin = simple_hash("pswpin"); - hash_pswpout = simple_hash("pswpout"); - // hash_slabs_scanned = simple_hash("slabs_scanned"); - // hash_thp_collapse_alloc_failed = simple_hash("thp_collapse_alloc_failed"); - // hash_thp_collapse_alloc = simple_hash("thp_collapse_alloc"); - // hash_thp_deferred_split_page = simple_hash("thp_deferred_split_page"); - // hash_thp_fault_alloc = simple_hash("thp_fault_alloc"); - // hash_thp_fault_fallback = simple_hash("thp_fault_fallback"); - // hash_thp_file_alloc = simple_hash("thp_file_alloc"); - // hash_thp_file_mapped = simple_hash("thp_file_mapped"); - // hash_thp_split_page_failed = simple_hash("thp_split_page_failed"); - // hash_thp_split_page = simple_hash("thp_split_page"); - // hash_thp_split_pmd = simple_hash("thp_split_pmd"); - // hash_thp_zero_page_alloc_failed = simple_hash("thp_zero_page_alloc_failed"); - // hash_thp_zero_page_alloc = simple_hash("thp_zero_page_alloc"); - // hash_unevictable_pgs_cleared = simple_hash("unevictable_pgs_cleared"); - // hash_unevictable_pgs_culled = simple_hash("unevictable_pgs_culled"); - // hash_unevictable_pgs_mlocked = simple_hash("unevictable_pgs_mlocked"); - // hash_unevictable_pgs_munlocked = simple_hash("unevictable_pgs_munlocked"); - // hash_unevictable_pgs_rescued = simple_hash("unevictable_pgs_rescued"); - // hash_unevictable_pgs_scanned = simple_hash("unevictable_pgs_scanned"); - // hash_unevictable_pgs_stranded = simple_hash("unevictable_pgs_stranded"); - // hash_workingset_activate = simple_hash("workingset_activate"); - // hash_workingset_nodereclaim = simple_hash("workingset_nodereclaim"); - // hash_workingset_refault = simple_hash("workingset_refault"); - // hash_zone_reclaim_failed = simple_hash("zone_reclaim_failed"); + do_numa = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "system-wide numa metric summary", CONFIG_BOOLEAN_AUTO); + + + arl_base = arl_create("vmstat", NULL, 60); + arl_expect(arl_base, "pgfault", &pgfault); + arl_expect(arl_base, "pgmajfault", &pgmajfault); + arl_expect(arl_base, "pgpgin", &pgpgin); + arl_expect(arl_base, "pgpgout", &pgpgout); + arl_expect(arl_base, "pswpin", &pswpin); + arl_expect(arl_base, "pswpout", &pswpout); + + if(do_numa == CONFIG_BOOLEAN_YES || (do_numa == CONFIG_BOOLEAN_AUTO && get_numa_node_count() >= 2)) { + arl_expect(arl_base, "numa_foreign", &numa_foreign); + arl_expect(arl_base, "numa_hint_faults_local", &numa_hint_faults_local); + arl_expect(arl_base, "numa_hint_faults", &numa_hint_faults); + arl_expect(arl_base, "numa_huge_pte_updates", &numa_huge_pte_updates); + arl_expect(arl_base, "numa_interleave", &numa_interleave); + arl_expect(arl_base, "numa_local", &numa_local); + arl_expect(arl_base, "numa_other", &numa_other); + arl_expect(arl_base, "numa_pages_migrated", &numa_pages_migrated); + arl_expect(arl_base, "numa_pte_updates", &numa_pte_updates); + } + else { + // Do not expect numa metrics when they are not needed. + // By not adding them, the ARL will stop processing the file + // when all the expected metrics are collected. + // Also ARL will not parse their values. + has_numa = 0; + do_numa = CONFIG_BOOLEAN_NO; + } } if(unlikely(!ff)) { char filename[FILENAME_MAX + 1]; - snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/proc/vmstat"); + snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/vmstat"); ff = procfile_open(config_get("plugin:proc:/proc/vmstat", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT); if(unlikely(!ff)) return 1; } @@ -276,293 +70,33 @@ int do_proc_vmstat(int update_every, usec_t dt) { ff = procfile_readall(ff); if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time - uint32_t lines = procfile_lines(ff), l; - - // unsigned long long allocstall_dma = 0ULL; - // unsigned long long allocstall_dma32 = 0ULL; - // unsigned long long allocstall_movable = 0ULL; - // unsigned long long allocstall_normal = 0ULL; - // unsigned long long balloon_deflate = 0ULL; - // unsigned long long balloon_inflate = 0ULL; - // unsigned long long balloon_migrate = 0ULL; - // unsigned long long compact_daemon_wake = 0ULL; - // unsigned long long compact_fail = 0ULL; - // unsigned long long compact_free_scanned = 0ULL; - // unsigned long long compact_isolated = 0ULL; - // unsigned long long compact_migrate_scanned = 0ULL; - // unsigned long long compact_stall = 0ULL; - // unsigned long long compact_success = 0ULL; - // unsigned long long drop_pagecache = 0ULL; - // unsigned long long drop_slab = 0ULL; - // unsigned long long htlb_buddy_alloc_fail = 0ULL; - // unsigned long long htlb_buddy_alloc_success = 0ULL; - // unsigned long long kswapd_high_wmark_hit_quickly = 0ULL; - // unsigned long long kswapd_inodesteal = 0ULL; - // unsigned long long kswapd_low_wmark_hit_quickly = 0ULL; - // unsigned long long nr_active_anon = 0ULL; - // unsigned long long nr_active_file = 0ULL; - // unsigned long long nr_anon_pages = 0ULL; - // unsigned long long nr_anon_transparent_hugepages = 0ULL; - // unsigned long long nr_bounce = 0ULL; - // unsigned long long nr_dirtied = 0ULL; - // unsigned long long nr_dirty = 0ULL; - // unsigned long long nr_dirty_background_threshold = 0ULL; - // unsigned long long nr_dirty_threshold = 0ULL; - // unsigned long long nr_file_pages = 0ULL; - // unsigned long long nr_free_cma = 0ULL; - // unsigned long long nr_free_pages = 0ULL; - // unsigned long long nr_inactive_anon = 0ULL; - // unsigned long long nr_inactive_file = 0ULL; - // unsigned long long nr_isolated_anon = 0ULL; - // unsigned long long nr_isolated_file = 0ULL; - // unsigned long long nr_kernel_stack = 0ULL; - // unsigned long long nr_mapped = 0ULL; - // unsigned long long nr_mlock = 0ULL; - // unsigned long long nr_pages_scanned = 0ULL; - // unsigned long long nr_page_table_pages = 0ULL; - // unsigned long long nr_shmem = 0ULL; - // unsigned long long nr_shmem_hugepages = 0ULL; - // unsigned long long nr_shmem_pmdmapped = 0ULL; - // unsigned long long nr_slab_reclaimable = 0ULL; - // unsigned long long nr_slab_unreclaimable = 0ULL; - // unsigned long long nr_unevictable = 0ULL; - // unsigned long long nr_unstable = 0ULL; - // unsigned long long nr_vmscan_immediate_reclaim = 0ULL; - // unsigned long long nr_vmscan_write = 0ULL; - // unsigned long long nr_writeback = 0ULL; - // unsigned long long nr_writeback_temp = 0ULL; - // unsigned long long nr_written = 0ULL; - // unsigned long long nr_zone_active_anon = 0ULL; - // unsigned long long nr_zone_active_file = 0ULL; - // unsigned long long nr_zone_inactive_anon = 0ULL; - // unsigned long long nr_zone_inactive_file = 0ULL; - // unsigned long long nr_zone_unevictable = 0ULL; - // unsigned long long nr_zone_write_pending = 0ULL; - // unsigned long long nr_zspages = 0ULL; - unsigned long long numa_foreign = 0ULL; - unsigned long long numa_hint_faults = 0ULL; - unsigned long long numa_hint_faults_local = 0ULL; - //unsigned long long numa_hit = 0ULL; - unsigned long long numa_huge_pte_updates = 0ULL; - unsigned long long numa_interleave = 0ULL; - unsigned long long numa_local = 0ULL; - //unsigned long long numa_miss = 0ULL; - unsigned long long numa_other = 0ULL; - unsigned long long numa_pages_migrated = 0ULL; - unsigned long long numa_pte_updates = 0ULL; - // unsigned long long pageoutrun = 0ULL; - // unsigned long long pgactivate = 0ULL; - // unsigned long long pgalloc_dma = 0ULL; - // unsigned long long pgalloc_dma32 = 0ULL; - // unsigned long long pgalloc_movable = 0ULL; - // unsigned long long pgalloc_normal = 0ULL; - // unsigned long long pgdeactivate = 0ULL; - unsigned long long pgfault = 0ULL; - // unsigned long long pgfree = 0ULL; - // unsigned long long pginodesteal = 0ULL; - // unsigned long long pglazyfreed = 0ULL; - unsigned long long pgmajfault = 0ULL; - // unsigned long long pgmigrate_fail = 0ULL; - // unsigned long long pgmigrate_success = 0ULL; - unsigned long long pgpgin = 0ULL; - unsigned long long pgpgout = 0ULL; - // unsigned long long pgrefill = 0ULL; - // unsigned long long pgrotated = 0ULL; - // unsigned long long pgscan_direct = 0ULL; - // unsigned long long pgscan_direct_throttle = 0ULL; - // unsigned long long pgscan_kswapd = 0ULL; - // unsigned long long pgskip_dma = 0ULL; - // unsigned long long pgskip_dma32 = 0ULL; - // unsigned long long pgskip_movable = 0ULL; - // unsigned long long pgskip_normal = 0ULL; - // unsigned long long pgsteal_direct = 0ULL; - // unsigned long long pgsteal_kswapd = 0ULL; - unsigned long long pswpin = 0ULL; - unsigned long long pswpout = 0ULL; - // unsigned long long slabs_scanned = 0ULL; - // unsigned long long thp_collapse_alloc = 0ULL; - // unsigned long long thp_collapse_alloc_failed = 0ULL; - // unsigned long long thp_deferred_split_page = 0ULL; - // unsigned long long thp_fault_alloc = 0ULL; - // unsigned long long thp_fault_fallback = 0ULL; - // unsigned long long thp_file_alloc = 0ULL; - // unsigned long long thp_file_mapped = 0ULL; - // unsigned long long thp_split_page = 0ULL; - // unsigned long long thp_split_page_failed = 0ULL; - // unsigned long long thp_split_pmd = 0ULL; - // unsigned long long thp_zero_page_alloc = 0ULL; - // unsigned long long thp_zero_page_alloc_failed = 0ULL; - // unsigned long long unevictable_pgs_cleared = 0ULL; - // unsigned long long unevictable_pgs_culled = 0ULL; - // unsigned long long unevictable_pgs_mlocked = 0ULL; - // unsigned long long unevictable_pgs_munlocked = 0ULL; - // unsigned long long unevictable_pgs_rescued = 0ULL; - // unsigned long long unevictable_pgs_scanned = 0ULL; - // unsigned long long unevictable_pgs_stranded = 0ULL; - // unsigned long long workingset_activate = 0ULL; - // unsigned long long workingset_nodereclaim = 0ULL; - // unsigned long long workingset_refault = 0ULL; - // unsigned long long zone_reclaim_failed = 0ULL; - - unsigned long long *ptr = NULL; + size_t lines = procfile_lines(ff), l; + arl_begin(arl_base); for(l = 0; l < lines ;l++) { - uint32_t words = procfile_linewords(ff, l); + size_t words = procfile_linewords(ff, l); if(unlikely(words < 2)) { - if(unlikely(words)) error("Cannot read /proc/vmstat line %u. Expected 2 params, read %u.", l, words); + if(unlikely(words)) error("Cannot read /proc/vmstat line %zu. Expected 2 params, read %zu.", l, words); continue; } - char *name = procfile_lineword(ff, l, 0); - char * value = procfile_lineword(ff, l, 1); - if(unlikely(!name || !*name || !value || !*value)) continue; - - uint32_t hash = simple_hash(name); - - if(unlikely(0)) ; - // else if(unlikely(hash == hash_allocstall_dma32 && strcmp(name, "allocstall_dma32") == 0)) ptr = &allocstall_dma32; - // else if(unlikely(hash == hash_allocstall_dma && strcmp(name, "allocstall_dma") == 0)) ptr = &allocstall_dma; - // else if(unlikely(hash == hash_allocstall_movable && strcmp(name, "allocstall_movable") == 0)) ptr = &allocstall_movable; - // else if(unlikely(hash == hash_allocstall_normal && strcmp(name, "allocstall_normal") == 0)) ptr = &allocstall_normal; - // else if(unlikely(hash == hash_balloon_deflate && strcmp(name, "balloon_deflate") == 0)) ptr = &balloon_deflate; - // else if(unlikely(hash == hash_balloon_inflate && strcmp(name, "balloon_inflate") == 0)) ptr = &balloon_inflate; - // else if(unlikely(hash == hash_balloon_migrate && strcmp(name, "balloon_migrate") == 0)) ptr = &balloon_migrate; - // else if(unlikely(hash == hash_compact_daemon_wake && strcmp(name, "compact_daemon_wake") == 0)) ptr = &compact_daemon_wake; - // else if(unlikely(hash == hash_compact_fail && strcmp(name, "compact_fail") == 0)) ptr = &compact_fail; - // else if(unlikely(hash == hash_compact_free_scanned && strcmp(name, "compact_free_scanned") == 0)) ptr = &compact_free_scanned; - // else if(unlikely(hash == hash_compact_isolated && strcmp(name, "compact_isolated") == 0)) ptr = &compact_isolated; - // else if(unlikely(hash == hash_compact_migrate_scanned && strcmp(name, "compact_migrate_scanned") == 0)) ptr = &compact_migrate_scanned; - // else if(unlikely(hash == hash_compact_stall && strcmp(name, "compact_stall") == 0)) ptr = &compact_stall; - // else if(unlikely(hash == hash_compact_success && strcmp(name, "compact_success") == 0)) ptr = &compact_success; - // else if(unlikely(hash == hash_drop_pagecache && strcmp(name, "drop_pagecache") == 0)) ptr = &drop_pagecache; - // else if(unlikely(hash == hash_drop_slab && strcmp(name, "drop_slab") == 0)) ptr = &drop_slab; - // else if(unlikely(hash == hash_htlb_buddy_alloc_fail && strcmp(name, "htlb_buddy_alloc_fail") == 0)) ptr = &htlb_buddy_alloc_fail; - // else if(unlikely(hash == hash_htlb_buddy_alloc_success && strcmp(name, "htlb_buddy_alloc_success") == 0)) ptr = &htlb_buddy_alloc_success; - // else if(unlikely(hash == hash_kswapd_high_wmark_hit_quickly && strcmp(name, "kswapd_high_wmark_hit_quickly") == 0)) ptr = &kswapd_high_wmark_hit_quickly; - // else if(unlikely(hash == hash_kswapd_inodesteal && strcmp(name, "kswapd_inodesteal") == 0)) ptr = &kswapd_inodesteal; - // else if(unlikely(hash == hash_kswapd_low_wmark_hit_quickly && strcmp(name, "kswapd_low_wmark_hit_quickly") == 0)) ptr = &kswapd_low_wmark_hit_quickly; - // else if(unlikely(hash == hash_nr_active_anon && strcmp(name, "nr_active_anon") == 0)) ptr = &nr_active_anon; - // else if(unlikely(hash == hash_nr_active_file && strcmp(name, "nr_active_file") == 0)) ptr = &nr_active_file; - // else if(unlikely(hash == hash_nr_anon_pages && strcmp(name, "nr_anon_pages") == 0)) ptr = &nr_anon_pages; - // else if(unlikely(hash == hash_nr_anon_transparent_hugepages && strcmp(name, "nr_anon_transparent_hugepages") == 0)) ptr = &nr_anon_transparent_hugepages; - // else if(unlikely(hash == hash_nr_bounce && strcmp(name, "nr_bounce") == 0)) ptr = &nr_bounce; - // else if(unlikely(hash == hash_nr_dirtied && strcmp(name, "nr_dirtied") == 0)) ptr = &nr_dirtied; - // else if(unlikely(hash == hash_nr_dirty_background_threshold && strcmp(name, "nr_dirty_background_threshold") == 0)) ptr = &nr_dirty_background_threshold; - // else if(unlikely(hash == hash_nr_dirty && strcmp(name, "nr_dirty") == 0)) ptr = &nr_dirty; - // else if(unlikely(hash == hash_nr_dirty_threshold && strcmp(name, "nr_dirty_threshold") == 0)) ptr = &nr_dirty_threshold; - // else if(unlikely(hash == hash_nr_file_pages && strcmp(name, "nr_file_pages") == 0)) ptr = &nr_file_pages; - // else if(unlikely(hash == hash_nr_free_cma && strcmp(name, "nr_free_cma") == 0)) ptr = &nr_free_cma; - // else if(unlikely(hash == hash_nr_free_pages && strcmp(name, "nr_free_pages") == 0)) ptr = &nr_free_pages; - // else if(unlikely(hash == hash_nr_inactive_anon && strcmp(name, "nr_inactive_anon") == 0)) ptr = &nr_inactive_anon; - // else if(unlikely(hash == hash_nr_inactive_file && strcmp(name, "nr_inactive_file") == 0)) ptr = &nr_inactive_file; - // else if(unlikely(hash == hash_nr_isolated_anon && strcmp(name, "nr_isolated_anon") == 0)) ptr = &nr_isolated_anon; - // else if(unlikely(hash == hash_nr_isolated_file && strcmp(name, "nr_isolated_file") == 0)) ptr = &nr_isolated_file; - // else if(unlikely(hash == hash_nr_kernel_stack && strcmp(name, "nr_kernel_stack") == 0)) ptr = &nr_kernel_stack; - // else if(unlikely(hash == hash_nr_mapped && strcmp(name, "nr_mapped") == 0)) ptr = &nr_mapped; - // else if(unlikely(hash == hash_nr_mlock && strcmp(name, "nr_mlock") == 0)) ptr = &nr_mlock; - // else if(unlikely(hash == hash_nr_pages_scanned && strcmp(name, "nr_pages_scanned") == 0)) ptr = &nr_pages_scanned; - // else if(unlikely(hash == hash_nr_page_table_pages && strcmp(name, "nr_page_table_pages") == 0)) ptr = &nr_page_table_pages; - // else if(unlikely(hash == hash_nr_shmem_hugepages && strcmp(name, "nr_shmem_hugepages") == 0)) ptr = &nr_shmem_hugepages; - // else if(unlikely(hash == hash_nr_shmem_pmdmapped && strcmp(name, "nr_shmem_pmdmapped") == 0)) ptr = &nr_shmem_pmdmapped; - // else if(unlikely(hash == hash_nr_shmem && strcmp(name, "nr_shmem") == 0)) ptr = &nr_shmem; - // else if(unlikely(hash == hash_nr_slab_reclaimable && strcmp(name, "nr_slab_reclaimable") == 0)) ptr = &nr_slab_reclaimable; - // else if(unlikely(hash == hash_nr_slab_unreclaimable && strcmp(name, "nr_slab_unreclaimable") == 0)) ptr = &nr_slab_unreclaimable; - // else if(unlikely(hash == hash_nr_unevictable && strcmp(name, "nr_unevictable") == 0)) ptr = &nr_unevictable; - // else if(unlikely(hash == hash_nr_unstable && strcmp(name, "nr_unstable") == 0)) ptr = &nr_unstable; - // else if(unlikely(hash == hash_nr_vmscan_immediate_reclaim && strcmp(name, "nr_vmscan_immediate_reclaim") == 0)) ptr = &nr_vmscan_immediate_reclaim; - // else if(unlikely(hash == hash_nr_vmscan_write && strcmp(name, "nr_vmscan_write") == 0)) ptr = &nr_vmscan_write; - // else if(unlikely(hash == hash_nr_writeback && strcmp(name, "nr_writeback") == 0)) ptr = &nr_writeback; - // else if(unlikely(hash == hash_nr_writeback_temp && strcmp(name, "nr_writeback_temp") == 0)) ptr = &nr_writeback_temp; - // else if(unlikely(hash == hash_nr_written && strcmp(name, "nr_written") == 0)) ptr = &nr_written; - // else if(unlikely(hash == hash_nr_zone_active_anon && strcmp(name, "nr_zone_active_anon") == 0)) ptr = &nr_zone_active_anon; - // else if(unlikely(hash == hash_nr_zone_active_file && strcmp(name, "nr_zone_active_file") == 0)) ptr = &nr_zone_active_file; - // else if(unlikely(hash == hash_nr_zone_inactive_anon && strcmp(name, "nr_zone_inactive_anon") == 0)) ptr = &nr_zone_inactive_anon; - // else if(unlikely(hash == hash_nr_zone_inactive_file && strcmp(name, "nr_zone_inactive_file") == 0)) ptr = &nr_zone_inactive_file; - // else if(unlikely(hash == hash_nr_zone_unevictable && strcmp(name, "nr_zone_unevictable") == 0)) ptr = &nr_zone_unevictable; - // else if(unlikely(hash == hash_nr_zone_write_pending && strcmp(name, "nr_zone_write_pending") == 0)) ptr = &nr_zone_write_pending; - // else if(unlikely(hash == hash_nr_zspages && strcmp(name, "nr_zspages") == 0)) ptr = &nr_zspages; - else if(unlikely(hash == hash_numa_foreign && strcmp(name, "numa_foreign") == 0)) ptr = &numa_foreign; - else if(unlikely(hash == hash_numa_hint_faults_local && strcmp(name, "numa_hint_faults_local") == 0)) ptr = &numa_hint_faults_local; - else if(unlikely(hash == hash_numa_hint_faults && strcmp(name, "numa_hint_faults") == 0)) ptr = &numa_hint_faults; - //else if(unlikely(hash == hash_numa_hit && strcmp(name, "numa_hit") == 0)) ptr = &numa_hit; - else if(unlikely(hash == hash_numa_huge_pte_updates && strcmp(name, "numa_huge_pte_updates") == 0)) ptr = &numa_huge_pte_updates; - else if(unlikely(hash == hash_numa_interleave && strcmp(name, "numa_interleave") == 0)) ptr = &numa_interleave; - else if(unlikely(hash == hash_numa_local && strcmp(name, "numa_local") == 0)) ptr = &numa_local; - //else if(unlikely(hash == hash_numa_miss && strcmp(name, "numa_miss") == 0)) ptr = &numa_miss; - else if(unlikely(hash == hash_numa_other && strcmp(name, "numa_other") == 0)) ptr = &numa_other; - else if(unlikely(hash == hash_numa_pages_migrated && strcmp(name, "numa_pages_migrated") == 0)) ptr = &numa_pages_migrated; - else if(unlikely(hash == hash_numa_pte_updates && strcmp(name, "numa_pte_updates") == 0)) ptr = &numa_pte_updates; - // else if(unlikely(hash == hash_pageoutrun && strcmp(name, "pageoutrun") == 0)) ptr = &pageoutrun; - // else if(unlikely(hash == hash_pgactivate && strcmp(name, "pgactivate") == 0)) ptr = &pgactivate; - // else if(unlikely(hash == hash_pgalloc_dma32 && strcmp(name, "pgalloc_dma32") == 0)) ptr = &pgalloc_dma32; - // else if(unlikely(hash == hash_pgalloc_dma && strcmp(name, "pgalloc_dma") == 0)) ptr = &pgalloc_dma; - // else if(unlikely(hash == hash_pgalloc_movable && strcmp(name, "pgalloc_movable") == 0)) ptr = &pgalloc_movable; - // else if(unlikely(hash == hash_pgalloc_normal && strcmp(name, "pgalloc_normal") == 0)) ptr = &pgalloc_normal; - // else if(unlikely(hash == hash_pgdeactivate && strcmp(name, "pgdeactivate") == 0)) ptr = &pgdeactivate; - else if(unlikely(hash == hash_pgfault && strcmp(name, "pgfault") == 0)) ptr = &pgfault; - // else if(unlikely(hash == hash_pgfree && strcmp(name, "pgfree") == 0)) ptr = &pgfree; - // else if(unlikely(hash == hash_pginodesteal && strcmp(name, "pginodesteal") == 0)) ptr = &pginodesteal; - // else if(unlikely(hash == hash_pglazyfreed && strcmp(name, "pglazyfreed") == 0)) ptr = &pglazyfreed; - else if(unlikely(hash == hash_pgmajfault && strcmp(name, "pgmajfault") == 0)) ptr = &pgmajfault; - // else if(unlikely(hash == hash_pgmigrate_fail && strcmp(name, "pgmigrate_fail") == 0)) ptr = &pgmigrate_fail; - // else if(unlikely(hash == hash_pgmigrate_success && strcmp(name, "pgmigrate_success") == 0)) ptr = &pgmigrate_success; - else if(unlikely(hash == hash_pgpgin && strcmp(name, "pgpgin") == 0)) ptr = &pgpgin; - else if(unlikely(hash == hash_pgpgout && strcmp(name, "pgpgout") == 0)) ptr = &pgpgout; - // else if(unlikely(hash == hash_pgrefill && strcmp(name, "pgrefill") == 0)) ptr = &pgrefill; - // else if(unlikely(hash == hash_pgrotated && strcmp(name, "pgrotated") == 0)) ptr = &pgrotated; - // else if(unlikely(hash == hash_pgscan_direct && strcmp(name, "pgscan_direct") == 0)) ptr = &pgscan_direct; - // else if(unlikely(hash == hash_pgscan_direct_throttle && strcmp(name, "pgscan_direct_throttle") == 0)) ptr = &pgscan_direct_throttle; - // else if(unlikely(hash == hash_pgscan_kswapd && strcmp(name, "pgscan_kswapd") == 0)) ptr = &pgscan_kswapd; - // else if(unlikely(hash == hash_pgskip_dma32 && strcmp(name, "pgskip_dma32") == 0)) ptr = &pgskip_dma32; - // else if(unlikely(hash == hash_pgskip_dma && strcmp(name, "pgskip_dma") == 0)) ptr = &pgskip_dma; - // else if(unlikely(hash == hash_pgskip_movable && strcmp(name, "pgskip_movable") == 0)) ptr = &pgskip_movable; - // else if(unlikely(hash == hash_pgskip_normal && strcmp(name, "pgskip_normal") == 0)) ptr = &pgskip_normal; - // else if(unlikely(hash == hash_pgsteal_direct && strcmp(name, "pgsteal_direct") == 0)) ptr = &pgsteal_direct; - // else if(unlikely(hash == hash_pgsteal_kswapd && strcmp(name, "pgsteal_kswapd") == 0)) ptr = &pgsteal_kswapd; - else if(unlikely(hash == hash_pswpin && strcmp(name, "pswpin") == 0)) ptr = &pswpin; - else if(unlikely(hash == hash_pswpout && strcmp(name, "pswpout") == 0)) ptr = &pswpout; - // else if(unlikely(hash == hash_slabs_scanned && strcmp(name, "slabs_scanned") == 0)) ptr = &slabs_scanned; - // else if(unlikely(hash == hash_thp_collapse_alloc_failed && strcmp(name, "thp_collapse_alloc_failed") == 0)) ptr = &thp_collapse_alloc_failed; - // else if(unlikely(hash == hash_thp_collapse_alloc && strcmp(name, "thp_collapse_alloc") == 0)) ptr = &thp_collapse_alloc; - // else if(unlikely(hash == hash_thp_deferred_split_page && strcmp(name, "thp_deferred_split_page") == 0)) ptr = &thp_deferred_split_page; - // else if(unlikely(hash == hash_thp_fault_alloc && strcmp(name, "thp_fault_alloc") == 0)) ptr = &thp_fault_alloc; - // else if(unlikely(hash == hash_thp_fault_fallback && strcmp(name, "thp_fault_fallback") == 0)) ptr = &thp_fault_fallback; - // else if(unlikely(hash == hash_thp_file_alloc && strcmp(name, "thp_file_alloc") == 0)) ptr = &thp_file_alloc; - // else if(unlikely(hash == hash_thp_file_mapped && strcmp(name, "thp_file_mapped") == 0)) ptr = &thp_file_mapped; - // else if(unlikely(hash == hash_thp_split_page_failed && strcmp(name, "thp_split_page_failed") == 0)) ptr = &thp_split_page_failed; - // else if(unlikely(hash == hash_thp_split_page && strcmp(name, "thp_split_page") == 0)) ptr = &thp_split_page; - // else if(unlikely(hash == hash_thp_split_pmd && strcmp(name, "thp_split_pmd") == 0)) ptr = &thp_split_pmd; - // else if(unlikely(hash == hash_thp_zero_page_alloc_failed && strcmp(name, "thp_zero_page_alloc_failed") == 0)) ptr = &thp_zero_page_alloc_failed; - // else if(unlikely(hash == hash_thp_zero_page_alloc && strcmp(name, "thp_zero_page_alloc") == 0)) ptr = &thp_zero_page_alloc; - // else if(unlikely(hash == hash_unevictable_pgs_cleared && strcmp(name, "unevictable_pgs_cleared") == 0)) ptr = &unevictable_pgs_cleared; - // else if(unlikely(hash == hash_unevictable_pgs_culled && strcmp(name, "unevictable_pgs_culled") == 0)) ptr = &unevictable_pgs_culled; - // else if(unlikely(hash == hash_unevictable_pgs_mlocked && strcmp(name, "unevictable_pgs_mlocked") == 0)) ptr = &unevictable_pgs_mlocked; - // else if(unlikely(hash == hash_unevictable_pgs_munlocked && strcmp(name, "unevictable_pgs_munlocked") == 0)) ptr = &unevictable_pgs_munlocked; - // else if(unlikely(hash == hash_unevictable_pgs_rescued && strcmp(name, "unevictable_pgs_rescued") == 0)) ptr = &unevictable_pgs_rescued; - // else if(unlikely(hash == hash_unevictable_pgs_scanned && strcmp(name, "unevictable_pgs_scanned") == 0)) ptr = &unevictable_pgs_scanned; - // else if(unlikely(hash == hash_unevictable_pgs_stranded && strcmp(name, "unevictable_pgs_stranded") == 0)) ptr = &unevictable_pgs_stranded; - // else if(unlikely(hash == hash_workingset_activate && strcmp(name, "workingset_activate") == 0)) ptr = &workingset_activate; - // else if(unlikely(hash == hash_workingset_nodereclaim && strcmp(name, "workingset_nodereclaim") == 0)) ptr = &workingset_nodereclaim; - // else if(unlikely(hash == hash_workingset_refault && strcmp(name, "workingset_refault") == 0)) ptr = &workingset_refault; - // else if(unlikely(hash == hash_zone_reclaim_failed && strcmp(name, "zone_reclaim_failed") == 0)) ptr = &zone_reclaim_failed; - - if(unlikely(ptr)) { - *ptr = str2ull(value); - ptr = NULL; - } + if(unlikely(arl_check(arl_base, + procfile_lineword(ff, l, 0), + procfile_lineword(ff, l, 1)))) break; } // -------------------------------------------------------------------- - if(pswpin || pswpout || do_swapio == CONFIG_ONDEMAND_YES) { - do_swapio = CONFIG_ONDEMAND_YES; + if(pswpin || pswpout || do_swapio == CONFIG_BOOLEAN_YES) { + do_swapio = CONFIG_BOOLEAN_YES; static RRDSET *st_swapio = NULL; if(unlikely(!st_swapio)) { - st_swapio = rrdset_create("system", "swapio", NULL, "swap", NULL, "Swap I/O", "kilobytes/s", 250, update_every, RRDSET_TYPE_AREA); + st_swapio = rrdset_create_localhost("system", "swapio", NULL, "swap", NULL, "Swap I/O", "kilobytes/s", 250 + , update_every, RRDSET_TYPE_AREA); - rrddim_add(st_swapio, "in", NULL, sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL); - rrddim_add(st_swapio, "out", NULL, -sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL); + rrddim_add(st_swapio, "in", NULL, sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_swapio, "out", NULL, -sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL); } else rrdset_next(st_swapio); @@ -576,10 +110,11 @@ int do_proc_vmstat(int update_every, usec_t dt) { if(do_io) { static RRDSET *st_io = NULL; if(unlikely(!st_io)) { - st_io = rrdset_create("system", "io", NULL, "disk", NULL, "Disk I/O", "kilobytes/s", 150, update_every, RRDSET_TYPE_AREA); + st_io = rrdset_create_localhost("system", "io", NULL, "disk", NULL, "Disk I/O", "kilobytes/s", 150 + , update_every, RRDSET_TYPE_AREA); - rrddim_add(st_io, "in", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_io, "out", NULL, -1, 1, RRDDIM_INCREMENTAL); + rrddim_add(st_io, "in", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_io, "out", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); } else rrdset_next(st_io); @@ -593,11 +128,12 @@ int do_proc_vmstat(int update_every, usec_t dt) { if(do_pgfaults) { static RRDSET *st_pgfaults = NULL; if(unlikely(!st_pgfaults)) { - st_pgfaults = rrdset_create("mem", "pgfaults", NULL, "system", NULL, "Memory Page Faults", "page faults/s", 500, update_every, RRDSET_TYPE_LINE); - st_pgfaults->isdetail = 1; + st_pgfaults = rrdset_create_localhost("mem", "pgfaults", NULL, "system", NULL, "Memory Page Faults" + , "page faults/s", 500, update_every, RRDSET_TYPE_LINE); + rrdset_flag_set(st_pgfaults, RRDSET_FLAG_DETAIL); - rrddim_add(st_pgfaults, "minor", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_pgfaults, "major", NULL, -1, 1, RRDDIM_INCREMENTAL); + rrddim_add(st_pgfaults, "minor", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_pgfaults, "major", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); } else rrdset_next(st_pgfaults); @@ -612,31 +148,32 @@ int do_proc_vmstat(int update_every, usec_t dt) { // check it only once. We check whether the node count is >= 2 because // single-node systems have uninteresting statistics (since all accesses // are local). - if(unlikely(has_numa == -1)) { - has_numa = (get_numa_node_count() >= 2 && - (numa_local || numa_foreign || numa_interleave || numa_other || numa_pte_updates || - numa_huge_pte_updates || numa_hint_faults || numa_hint_faults_local || numa_pages_migrated)) ? 1 : 0; - } + if(unlikely(has_numa == -1)) + has_numa = (numa_local || numa_foreign || numa_interleave || numa_other || numa_pte_updates || + numa_huge_pte_updates || numa_hint_faults || numa_hint_faults_local || numa_pages_migrated) ? 1 : 0; + + if(do_numa == CONFIG_BOOLEAN_YES || (do_numa == CONFIG_BOOLEAN_AUTO && has_numa)) { + do_numa = CONFIG_BOOLEAN_YES; - if(do_numa == CONFIG_ONDEMAND_YES || (do_numa == CONFIG_ONDEMAND_ONDEMAND && has_numa)) { static RRDSET *st_numa = NULL; if(unlikely(!st_numa)) { - st_numa = rrdset_create("mem", "numa", NULL, "numa", NULL, "NUMA events", "events/s", 800, update_every, RRDSET_TYPE_LINE); - st_numa->isdetail = 1; + st_numa = rrdset_create_localhost("mem", "numa", NULL, "numa", NULL, "NUMA events", "events/s", 800 + , update_every, RRDSET_TYPE_LINE); + rrdset_flag_set(st_numa, RRDSET_FLAG_DETAIL); // These depend on CONFIG_NUMA in the kernel. - rrddim_add(st_numa, "local", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "foreign", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "interleave", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "other", NULL, 1, 1, RRDDIM_INCREMENTAL); + rrddim_add(st_numa, "local", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "foreign", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "interleave", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "other", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); // The following stats depend on CONFIG_NUMA_BALANCING in the // kernel. - rrddim_add(st_numa, "pte updates", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "huge pte updates", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "hint faults", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "hint faults local", NULL, 1, 1, RRDDIM_INCREMENTAL); - rrddim_add(st_numa, "pages migrated", NULL, 1, 1, RRDDIM_INCREMENTAL); + rrddim_add(st_numa, "pte updates", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "huge pte updates", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "hint faults", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "hint faults local", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rrddim_add(st_numa, "pages migrated", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else rrdset_next(st_numa);