3 int do_proc_vmstat(int update_every, usec_t dt) {
6 static procfile *ff = NULL;
7 static int do_swapio = -1, do_io = -1, do_pgfaults = -1, do_numa = -1;
8 static int has_numa = -1;
10 // static uint32_t hash_allocstall_dma = 0;
11 // static uint32_t hash_allocstall_dma32 = 0;
12 // static uint32_t hash_allocstall_movable = 0;
13 // static uint32_t hash_allocstall_normal = 0;
14 // static uint32_t hash_balloon_deflate = 0;
15 // static uint32_t hash_balloon_inflate = 0;
16 // static uint32_t hash_balloon_migrate = 0;
17 // static uint32_t hash_compact_daemon_wake = 0;
18 // static uint32_t hash_compact_fail = 0;
19 // static uint32_t hash_compact_free_scanned = 0;
20 // static uint32_t hash_compact_isolated = 0;
21 // static uint32_t hash_compact_migrate_scanned = 0;
22 // static uint32_t hash_compact_stall = 0;
23 // static uint32_t hash_compact_success = 0;
24 // static uint32_t hash_drop_pagecache = 0;
25 // static uint32_t hash_drop_slab = 0;
26 // static uint32_t hash_htlb_buddy_alloc_fail = 0;
27 // static uint32_t hash_htlb_buddy_alloc_success = 0;
28 // static uint32_t hash_kswapd_high_wmark_hit_quickly = 0;
29 // static uint32_t hash_kswapd_inodesteal = 0;
30 // static uint32_t hash_kswapd_low_wmark_hit_quickly = 0;
31 // static uint32_t hash_nr_active_anon = 0;
32 // static uint32_t hash_nr_active_file = 0;
33 // static uint32_t hash_nr_anon_pages = 0;
34 // static uint32_t hash_nr_anon_transparent_hugepages = 0;
35 // static uint32_t hash_nr_bounce = 0;
36 // static uint32_t hash_nr_dirtied = 0;
37 // static uint32_t hash_nr_dirty = 0;
38 // static uint32_t hash_nr_dirty_background_threshold = 0;
39 // static uint32_t hash_nr_dirty_threshold = 0;
40 // static uint32_t hash_nr_file_pages = 0;
41 // static uint32_t hash_nr_free_cma = 0;
42 // static uint32_t hash_nr_free_pages = 0;
43 // static uint32_t hash_nr_inactive_anon = 0;
44 // static uint32_t hash_nr_inactive_file = 0;
45 // static uint32_t hash_nr_isolated_anon = 0;
46 // static uint32_t hash_nr_isolated_file = 0;
47 // static uint32_t hash_nr_kernel_stack = 0;
48 // static uint32_t hash_nr_mapped = 0;
49 // static uint32_t hash_nr_mlock = 0;
50 // static uint32_t hash_nr_pages_scanned = 0;
51 // static uint32_t hash_nr_page_table_pages = 0;
52 // static uint32_t hash_nr_shmem = 0;
53 // static uint32_t hash_nr_shmem_hugepages = 0;
54 // static uint32_t hash_nr_shmem_pmdmapped = 0;
55 // static uint32_t hash_nr_slab_reclaimable = 0;
56 // static uint32_t hash_nr_slab_unreclaimable = 0;
57 // static uint32_t hash_nr_unevictable = 0;
58 // static uint32_t hash_nr_unstable = 0;
59 // static uint32_t hash_nr_vmscan_immediate_reclaim = 0;
60 // static uint32_t hash_nr_vmscan_write = 0;
61 // static uint32_t hash_nr_writeback = 0;
62 // static uint32_t hash_nr_writeback_temp = 0;
63 // static uint32_t hash_nr_written = 0;
64 // static uint32_t hash_nr_zone_active_anon = 0;
65 // static uint32_t hash_nr_zone_active_file = 0;
66 // static uint32_t hash_nr_zone_inactive_anon = 0;
67 // static uint32_t hash_nr_zone_inactive_file = 0;
68 // static uint32_t hash_nr_zone_unevictable = 0;
69 // static uint32_t hash_nr_zone_write_pending = 0;
70 // static uint32_t hash_nr_zspages = 0;
71 static uint32_t hash_numa_foreign = 0;
72 static uint32_t hash_numa_hint_faults = 0;
73 static uint32_t hash_numa_hint_faults_local = 0;
74 //static uint32_t hash_numa_hit = 0;
75 static uint32_t hash_numa_huge_pte_updates = 0;
76 static uint32_t hash_numa_interleave = 0;
77 static uint32_t hash_numa_local = 0;
78 //static uint32_t hash_numa_miss = 0;
79 static uint32_t hash_numa_other = 0;
80 static uint32_t hash_numa_pages_migrated = 0;
81 static uint32_t hash_numa_pte_updates = 0;
82 // static uint32_t hash_pageoutrun = 0;
83 // static uint32_t hash_pgactivate = 0;
84 // static uint32_t hash_pgalloc_dma = 0;
85 // static uint32_t hash_pgalloc_dma32 = 0;
86 // static uint32_t hash_pgalloc_movable = 0;
87 // static uint32_t hash_pgalloc_normal = 0;
88 // static uint32_t hash_pgdeactivate = 0;
89 static uint32_t hash_pgfault = 0;
90 // static uint32_t hash_pgfree = 0;
91 // static uint32_t hash_pginodesteal = 0;
92 // static uint32_t hash_pglazyfreed = 0;
93 static uint32_t hash_pgmajfault = 0;
94 // static uint32_t hash_pgmigrate_fail = 0;
95 // static uint32_t hash_pgmigrate_success = 0;
96 static uint32_t hash_pgpgin = 0;
97 static uint32_t hash_pgpgout = 0;
98 // static uint32_t hash_pgrefill = 0;
99 // static uint32_t hash_pgrotated = 0;
100 // static uint32_t hash_pgscan_direct = 0;
101 // static uint32_t hash_pgscan_direct_throttle = 0;
102 // static uint32_t hash_pgscan_kswapd = 0;
103 // static uint32_t hash_pgskip_dma = 0;
104 // static uint32_t hash_pgskip_dma32 = 0;
105 // static uint32_t hash_pgskip_movable = 0;
106 // static uint32_t hash_pgskip_normal = 0;
107 // static uint32_t hash_pgsteal_direct = 0;
108 // static uint32_t hash_pgsteal_kswapd = 0;
109 static uint32_t hash_pswpin = 0;
110 static uint32_t hash_pswpout = 0;
111 // static uint32_t hash_slabs_scanned = 0;
112 // static uint32_t hash_thp_collapse_alloc = 0;
113 // static uint32_t hash_thp_collapse_alloc_failed = 0;
114 // static uint32_t hash_thp_deferred_split_page = 0;
115 // static uint32_t hash_thp_fault_alloc = 0;
116 // static uint32_t hash_thp_fault_fallback = 0;
117 // static uint32_t hash_thp_file_alloc = 0;
118 // static uint32_t hash_thp_file_mapped = 0;
119 // static uint32_t hash_thp_split_page = 0;
120 // static uint32_t hash_thp_split_page_failed = 0;
121 // static uint32_t hash_thp_split_pmd = 0;
122 // static uint32_t hash_thp_zero_page_alloc = 0;
123 // static uint32_t hash_thp_zero_page_alloc_failed = 0;
124 // static uint32_t hash_unevictable_pgs_cleared = 0;
125 // static uint32_t hash_unevictable_pgs_culled = 0;
126 // static uint32_t hash_unevictable_pgs_mlocked = 0;
127 // static uint32_t hash_unevictable_pgs_munlocked = 0;
128 // static uint32_t hash_unevictable_pgs_rescued = 0;
129 // static uint32_t hash_unevictable_pgs_scanned = 0;
130 // static uint32_t hash_unevictable_pgs_stranded = 0;
131 // static uint32_t hash_workingset_activate = 0;
132 // static uint32_t hash_workingset_nodereclaim = 0;
133 // static uint32_t hash_workingset_refault = 0;
134 // static uint32_t hash_zone_reclaim_failed = 0;
136 if(unlikely(do_swapio == -1)) {
137 do_swapio = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "swap i/o", CONFIG_ONDEMAND_ONDEMAND);
138 do_io = config_get_boolean("plugin:proc:/proc/vmstat", "disk i/o", 1);
139 do_pgfaults = config_get_boolean("plugin:proc:/proc/vmstat", "memory page faults", 1);
140 do_numa = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "system-wide numa metric summary", CONFIG_ONDEMAND_ONDEMAND);
142 // hash_allocstall_dma32 = simple_hash("allocstall_dma32");
143 // hash_allocstall_dma = simple_hash("allocstall_dma");
144 // hash_allocstall_movable = simple_hash("allocstall_movable");
145 // hash_allocstall_normal = simple_hash("allocstall_normal");
146 // hash_balloon_deflate = simple_hash("balloon_deflate");
147 // hash_balloon_inflate = simple_hash("balloon_inflate");
148 // hash_balloon_migrate = simple_hash("balloon_migrate");
149 // hash_compact_daemon_wake = simple_hash("compact_daemon_wake");
150 // hash_compact_fail = simple_hash("compact_fail");
151 // hash_compact_free_scanned = simple_hash("compact_free_scanned");
152 // hash_compact_isolated = simple_hash("compact_isolated");
153 // hash_compact_migrate_scanned = simple_hash("compact_migrate_scanned");
154 // hash_compact_stall = simple_hash("compact_stall");
155 // hash_compact_success = simple_hash("compact_success");
156 // hash_drop_pagecache = simple_hash("drop_pagecache");
157 // hash_drop_slab = simple_hash("drop_slab");
158 // hash_htlb_buddy_alloc_fail = simple_hash("htlb_buddy_alloc_fail");
159 // hash_htlb_buddy_alloc_success = simple_hash("htlb_buddy_alloc_success");
160 // hash_kswapd_high_wmark_hit_quickly = simple_hash("kswapd_high_wmark_hit_quickly");
161 // hash_kswapd_inodesteal = simple_hash("kswapd_inodesteal");
162 // hash_kswapd_low_wmark_hit_quickly = simple_hash("kswapd_low_wmark_hit_quickly");
163 // hash_nr_active_anon = simple_hash("nr_active_anon");
164 // hash_nr_active_file = simple_hash("nr_active_file");
165 // hash_nr_anon_pages = simple_hash("nr_anon_pages");
166 // hash_nr_anon_transparent_hugepages = simple_hash("nr_anon_transparent_hugepages");
167 // hash_nr_bounce = simple_hash("nr_bounce");
168 // hash_nr_dirtied = simple_hash("nr_dirtied");
169 // hash_nr_dirty_background_threshold = simple_hash("nr_dirty_background_threshold");
170 // hash_nr_dirty = simple_hash("nr_dirty");
171 // hash_nr_dirty_threshold = simple_hash("nr_dirty_threshold");
172 // hash_nr_file_pages = simple_hash("nr_file_pages");
173 // hash_nr_free_cma = simple_hash("nr_free_cma");
174 // hash_nr_free_pages = simple_hash("nr_free_pages");
175 // hash_nr_inactive_anon = simple_hash("nr_inactive_anon");
176 // hash_nr_inactive_file = simple_hash("nr_inactive_file");
177 // hash_nr_isolated_anon = simple_hash("nr_isolated_anon");
178 // hash_nr_isolated_file = simple_hash("nr_isolated_file");
179 // hash_nr_kernel_stack = simple_hash("nr_kernel_stack");
180 // hash_nr_mapped = simple_hash("nr_mapped");
181 // hash_nr_mlock = simple_hash("nr_mlock");
182 // hash_nr_pages_scanned = simple_hash("nr_pages_scanned");
183 // hash_nr_page_table_pages = simple_hash("nr_page_table_pages");
184 // hash_nr_shmem_hugepages = simple_hash("nr_shmem_hugepages");
185 // hash_nr_shmem_pmdmapped = simple_hash("nr_shmem_pmdmapped");
186 // hash_nr_shmem = simple_hash("nr_shmem");
187 // hash_nr_slab_reclaimable = simple_hash("nr_slab_reclaimable");
188 // hash_nr_slab_unreclaimable = simple_hash("nr_slab_unreclaimable");
189 // hash_nr_unevictable = simple_hash("nr_unevictable");
190 // hash_nr_unstable = simple_hash("nr_unstable");
191 // hash_nr_vmscan_immediate_reclaim = simple_hash("nr_vmscan_immediate_reclaim");
192 // hash_nr_vmscan_write = simple_hash("nr_vmscan_write");
193 // hash_nr_writeback = simple_hash("nr_writeback");
194 // hash_nr_writeback_temp = simple_hash("nr_writeback_temp");
195 // hash_nr_written = simple_hash("nr_written");
196 // hash_nr_zone_active_anon = simple_hash("nr_zone_active_anon");
197 // hash_nr_zone_active_file = simple_hash("nr_zone_active_file");
198 // hash_nr_zone_inactive_anon = simple_hash("nr_zone_inactive_anon");
199 // hash_nr_zone_inactive_file = simple_hash("nr_zone_inactive_file");
200 // hash_nr_zone_unevictable = simple_hash("nr_zone_unevictable");
201 // hash_nr_zone_write_pending = simple_hash("nr_zone_write_pending");
202 // hash_nr_zspages = simple_hash("nr_zspages");
203 hash_numa_foreign = simple_hash("numa_foreign");
204 hash_numa_hint_faults_local = simple_hash("numa_hint_faults_local");
205 hash_numa_hint_faults = simple_hash("numa_hint_faults");
206 //hash_numa_hit = simple_hash("numa_hit");
207 hash_numa_huge_pte_updates = simple_hash("numa_huge_pte_updates");
208 hash_numa_interleave = simple_hash("numa_interleave");
209 hash_numa_local = simple_hash("numa_local");
210 //hash_numa_miss = simple_hash("numa_miss");
211 hash_numa_other = simple_hash("numa_other");
212 hash_numa_pages_migrated = simple_hash("numa_pages_migrated");
213 hash_numa_pte_updates = simple_hash("numa_pte_updates");
214 // hash_pageoutrun = simple_hash("pageoutrun");
215 // hash_pgactivate = simple_hash("pgactivate");
216 // hash_pgalloc_dma32 = simple_hash("pgalloc_dma32");
217 // hash_pgalloc_dma = simple_hash("pgalloc_dma");
218 // hash_pgalloc_movable = simple_hash("pgalloc_movable");
219 // hash_pgalloc_normal = simple_hash("pgalloc_normal");
220 // hash_pgdeactivate = simple_hash("pgdeactivate");
221 hash_pgfault = simple_hash("pgfault");
222 // hash_pgfree = simple_hash("pgfree");
223 // hash_pginodesteal = simple_hash("pginodesteal");
224 // hash_pglazyfreed = simple_hash("pglazyfreed");
225 hash_pgmajfault = simple_hash("pgmajfault");
226 // hash_pgmigrate_fail = simple_hash("pgmigrate_fail");
227 // hash_pgmigrate_success = simple_hash("pgmigrate_success");
228 hash_pgpgin = simple_hash("pgpgin");
229 hash_pgpgout = simple_hash("pgpgout");
230 // hash_pgrefill = simple_hash("pgrefill");
231 // hash_pgrotated = simple_hash("pgrotated");
232 // hash_pgscan_direct = simple_hash("pgscan_direct");
233 // hash_pgscan_direct_throttle = simple_hash("pgscan_direct_throttle");
234 // hash_pgscan_kswapd = simple_hash("pgscan_kswapd");
235 // hash_pgskip_dma32 = simple_hash("pgskip_dma32");
236 // hash_pgskip_dma = simple_hash("pgskip_dma");
237 // hash_pgskip_movable = simple_hash("pgskip_movable");
238 // hash_pgskip_normal = simple_hash("pgskip_normal");
239 // hash_pgsteal_direct = simple_hash("pgsteal_direct");
240 // hash_pgsteal_kswapd = simple_hash("pgsteal_kswapd");
241 hash_pswpin = simple_hash("pswpin");
242 hash_pswpout = simple_hash("pswpout");
243 // hash_slabs_scanned = simple_hash("slabs_scanned");
244 // hash_thp_collapse_alloc_failed = simple_hash("thp_collapse_alloc_failed");
245 // hash_thp_collapse_alloc = simple_hash("thp_collapse_alloc");
246 // hash_thp_deferred_split_page = simple_hash("thp_deferred_split_page");
247 // hash_thp_fault_alloc = simple_hash("thp_fault_alloc");
248 // hash_thp_fault_fallback = simple_hash("thp_fault_fallback");
249 // hash_thp_file_alloc = simple_hash("thp_file_alloc");
250 // hash_thp_file_mapped = simple_hash("thp_file_mapped");
251 // hash_thp_split_page_failed = simple_hash("thp_split_page_failed");
252 // hash_thp_split_page = simple_hash("thp_split_page");
253 // hash_thp_split_pmd = simple_hash("thp_split_pmd");
254 // hash_thp_zero_page_alloc_failed = simple_hash("thp_zero_page_alloc_failed");
255 // hash_thp_zero_page_alloc = simple_hash("thp_zero_page_alloc");
256 // hash_unevictable_pgs_cleared = simple_hash("unevictable_pgs_cleared");
257 // hash_unevictable_pgs_culled = simple_hash("unevictable_pgs_culled");
258 // hash_unevictable_pgs_mlocked = simple_hash("unevictable_pgs_mlocked");
259 // hash_unevictable_pgs_munlocked = simple_hash("unevictable_pgs_munlocked");
260 // hash_unevictable_pgs_rescued = simple_hash("unevictable_pgs_rescued");
261 // hash_unevictable_pgs_scanned = simple_hash("unevictable_pgs_scanned");
262 // hash_unevictable_pgs_stranded = simple_hash("unevictable_pgs_stranded");
263 // hash_workingset_activate = simple_hash("workingset_activate");
264 // hash_workingset_nodereclaim = simple_hash("workingset_nodereclaim");
265 // hash_workingset_refault = simple_hash("workingset_refault");
266 // hash_zone_reclaim_failed = simple_hash("zone_reclaim_failed");
270 char filename[FILENAME_MAX + 1];
271 snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/proc/vmstat");
272 ff = procfile_open(config_get("plugin:proc:/proc/vmstat", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
273 if(unlikely(!ff)) return 1;
276 ff = procfile_readall(ff);
277 if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
279 uint32_t lines = procfile_lines(ff), l;
281 // unsigned long long allocstall_dma = 0ULL;
282 // unsigned long long allocstall_dma32 = 0ULL;
283 // unsigned long long allocstall_movable = 0ULL;
284 // unsigned long long allocstall_normal = 0ULL;
285 // unsigned long long balloon_deflate = 0ULL;
286 // unsigned long long balloon_inflate = 0ULL;
287 // unsigned long long balloon_migrate = 0ULL;
288 // unsigned long long compact_daemon_wake = 0ULL;
289 // unsigned long long compact_fail = 0ULL;
290 // unsigned long long compact_free_scanned = 0ULL;
291 // unsigned long long compact_isolated = 0ULL;
292 // unsigned long long compact_migrate_scanned = 0ULL;
293 // unsigned long long compact_stall = 0ULL;
294 // unsigned long long compact_success = 0ULL;
295 // unsigned long long drop_pagecache = 0ULL;
296 // unsigned long long drop_slab = 0ULL;
297 // unsigned long long htlb_buddy_alloc_fail = 0ULL;
298 // unsigned long long htlb_buddy_alloc_success = 0ULL;
299 // unsigned long long kswapd_high_wmark_hit_quickly = 0ULL;
300 // unsigned long long kswapd_inodesteal = 0ULL;
301 // unsigned long long kswapd_low_wmark_hit_quickly = 0ULL;
302 // unsigned long long nr_active_anon = 0ULL;
303 // unsigned long long nr_active_file = 0ULL;
304 // unsigned long long nr_anon_pages = 0ULL;
305 // unsigned long long nr_anon_transparent_hugepages = 0ULL;
306 // unsigned long long nr_bounce = 0ULL;
307 // unsigned long long nr_dirtied = 0ULL;
308 // unsigned long long nr_dirty = 0ULL;
309 // unsigned long long nr_dirty_background_threshold = 0ULL;
310 // unsigned long long nr_dirty_threshold = 0ULL;
311 // unsigned long long nr_file_pages = 0ULL;
312 // unsigned long long nr_free_cma = 0ULL;
313 // unsigned long long nr_free_pages = 0ULL;
314 // unsigned long long nr_inactive_anon = 0ULL;
315 // unsigned long long nr_inactive_file = 0ULL;
316 // unsigned long long nr_isolated_anon = 0ULL;
317 // unsigned long long nr_isolated_file = 0ULL;
318 // unsigned long long nr_kernel_stack = 0ULL;
319 // unsigned long long nr_mapped = 0ULL;
320 // unsigned long long nr_mlock = 0ULL;
321 // unsigned long long nr_pages_scanned = 0ULL;
322 // unsigned long long nr_page_table_pages = 0ULL;
323 // unsigned long long nr_shmem = 0ULL;
324 // unsigned long long nr_shmem_hugepages = 0ULL;
325 // unsigned long long nr_shmem_pmdmapped = 0ULL;
326 // unsigned long long nr_slab_reclaimable = 0ULL;
327 // unsigned long long nr_slab_unreclaimable = 0ULL;
328 // unsigned long long nr_unevictable = 0ULL;
329 // unsigned long long nr_unstable = 0ULL;
330 // unsigned long long nr_vmscan_immediate_reclaim = 0ULL;
331 // unsigned long long nr_vmscan_write = 0ULL;
332 // unsigned long long nr_writeback = 0ULL;
333 // unsigned long long nr_writeback_temp = 0ULL;
334 // unsigned long long nr_written = 0ULL;
335 // unsigned long long nr_zone_active_anon = 0ULL;
336 // unsigned long long nr_zone_active_file = 0ULL;
337 // unsigned long long nr_zone_inactive_anon = 0ULL;
338 // unsigned long long nr_zone_inactive_file = 0ULL;
339 // unsigned long long nr_zone_unevictable = 0ULL;
340 // unsigned long long nr_zone_write_pending = 0ULL;
341 // unsigned long long nr_zspages = 0ULL;
342 unsigned long long numa_foreign = 0ULL;
343 unsigned long long numa_hint_faults = 0ULL;
344 unsigned long long numa_hint_faults_local = 0ULL;
345 //unsigned long long numa_hit = 0ULL;
346 unsigned long long numa_huge_pte_updates = 0ULL;
347 unsigned long long numa_interleave = 0ULL;
348 unsigned long long numa_local = 0ULL;
349 //unsigned long long numa_miss = 0ULL;
350 unsigned long long numa_other = 0ULL;
351 unsigned long long numa_pages_migrated = 0ULL;
352 unsigned long long numa_pte_updates = 0ULL;
353 // unsigned long long pageoutrun = 0ULL;
354 // unsigned long long pgactivate = 0ULL;
355 // unsigned long long pgalloc_dma = 0ULL;
356 // unsigned long long pgalloc_dma32 = 0ULL;
357 // unsigned long long pgalloc_movable = 0ULL;
358 // unsigned long long pgalloc_normal = 0ULL;
359 // unsigned long long pgdeactivate = 0ULL;
360 unsigned long long pgfault = 0ULL;
361 // unsigned long long pgfree = 0ULL;
362 // unsigned long long pginodesteal = 0ULL;
363 // unsigned long long pglazyfreed = 0ULL;
364 unsigned long long pgmajfault = 0ULL;
365 // unsigned long long pgmigrate_fail = 0ULL;
366 // unsigned long long pgmigrate_success = 0ULL;
367 unsigned long long pgpgin = 0ULL;
368 unsigned long long pgpgout = 0ULL;
369 // unsigned long long pgrefill = 0ULL;
370 // unsigned long long pgrotated = 0ULL;
371 // unsigned long long pgscan_direct = 0ULL;
372 // unsigned long long pgscan_direct_throttle = 0ULL;
373 // unsigned long long pgscan_kswapd = 0ULL;
374 // unsigned long long pgskip_dma = 0ULL;
375 // unsigned long long pgskip_dma32 = 0ULL;
376 // unsigned long long pgskip_movable = 0ULL;
377 // unsigned long long pgskip_normal = 0ULL;
378 // unsigned long long pgsteal_direct = 0ULL;
379 // unsigned long long pgsteal_kswapd = 0ULL;
380 unsigned long long pswpin = 0ULL;
381 unsigned long long pswpout = 0ULL;
382 // unsigned long long slabs_scanned = 0ULL;
383 // unsigned long long thp_collapse_alloc = 0ULL;
384 // unsigned long long thp_collapse_alloc_failed = 0ULL;
385 // unsigned long long thp_deferred_split_page = 0ULL;
386 // unsigned long long thp_fault_alloc = 0ULL;
387 // unsigned long long thp_fault_fallback = 0ULL;
388 // unsigned long long thp_file_alloc = 0ULL;
389 // unsigned long long thp_file_mapped = 0ULL;
390 // unsigned long long thp_split_page = 0ULL;
391 // unsigned long long thp_split_page_failed = 0ULL;
392 // unsigned long long thp_split_pmd = 0ULL;
393 // unsigned long long thp_zero_page_alloc = 0ULL;
394 // unsigned long long thp_zero_page_alloc_failed = 0ULL;
395 // unsigned long long unevictable_pgs_cleared = 0ULL;
396 // unsigned long long unevictable_pgs_culled = 0ULL;
397 // unsigned long long unevictable_pgs_mlocked = 0ULL;
398 // unsigned long long unevictable_pgs_munlocked = 0ULL;
399 // unsigned long long unevictable_pgs_rescued = 0ULL;
400 // unsigned long long unevictable_pgs_scanned = 0ULL;
401 // unsigned long long unevictable_pgs_stranded = 0ULL;
402 // unsigned long long workingset_activate = 0ULL;
403 // unsigned long long workingset_nodereclaim = 0ULL;
404 // unsigned long long workingset_refault = 0ULL;
405 // unsigned long long zone_reclaim_failed = 0ULL;
407 unsigned long long *ptr = NULL;
409 for(l = 0; l < lines ;l++) {
410 uint32_t words = procfile_linewords(ff, l);
411 if(unlikely(words < 2)) {
412 if(unlikely(words)) error("Cannot read /proc/vmstat line %u. Expected 2 params, read %u.", l, words);
416 char *name = procfile_lineword(ff, l, 0);
417 char * value = procfile_lineword(ff, l, 1);
418 if(unlikely(!name || !*name || !value || !*value)) continue;
420 uint32_t hash = simple_hash(name);
423 // else if(unlikely(hash == hash_allocstall_dma32 && strcmp(name, "allocstall_dma32") == 0)) ptr = &allocstall_dma32;
424 // else if(unlikely(hash == hash_allocstall_dma && strcmp(name, "allocstall_dma") == 0)) ptr = &allocstall_dma;
425 // else if(unlikely(hash == hash_allocstall_movable && strcmp(name, "allocstall_movable") == 0)) ptr = &allocstall_movable;
426 // else if(unlikely(hash == hash_allocstall_normal && strcmp(name, "allocstall_normal") == 0)) ptr = &allocstall_normal;
427 // else if(unlikely(hash == hash_balloon_deflate && strcmp(name, "balloon_deflate") == 0)) ptr = &balloon_deflate;
428 // else if(unlikely(hash == hash_balloon_inflate && strcmp(name, "balloon_inflate") == 0)) ptr = &balloon_inflate;
429 // else if(unlikely(hash == hash_balloon_migrate && strcmp(name, "balloon_migrate") == 0)) ptr = &balloon_migrate;
430 // else if(unlikely(hash == hash_compact_daemon_wake && strcmp(name, "compact_daemon_wake") == 0)) ptr = &compact_daemon_wake;
431 // else if(unlikely(hash == hash_compact_fail && strcmp(name, "compact_fail") == 0)) ptr = &compact_fail;
432 // else if(unlikely(hash == hash_compact_free_scanned && strcmp(name, "compact_free_scanned") == 0)) ptr = &compact_free_scanned;
433 // else if(unlikely(hash == hash_compact_isolated && strcmp(name, "compact_isolated") == 0)) ptr = &compact_isolated;
434 // else if(unlikely(hash == hash_compact_migrate_scanned && strcmp(name, "compact_migrate_scanned") == 0)) ptr = &compact_migrate_scanned;
435 // else if(unlikely(hash == hash_compact_stall && strcmp(name, "compact_stall") == 0)) ptr = &compact_stall;
436 // else if(unlikely(hash == hash_compact_success && strcmp(name, "compact_success") == 0)) ptr = &compact_success;
437 // else if(unlikely(hash == hash_drop_pagecache && strcmp(name, "drop_pagecache") == 0)) ptr = &drop_pagecache;
438 // else if(unlikely(hash == hash_drop_slab && strcmp(name, "drop_slab") == 0)) ptr = &drop_slab;
439 // else if(unlikely(hash == hash_htlb_buddy_alloc_fail && strcmp(name, "htlb_buddy_alloc_fail") == 0)) ptr = &htlb_buddy_alloc_fail;
440 // else if(unlikely(hash == hash_htlb_buddy_alloc_success && strcmp(name, "htlb_buddy_alloc_success") == 0)) ptr = &htlb_buddy_alloc_success;
441 // else if(unlikely(hash == hash_kswapd_high_wmark_hit_quickly && strcmp(name, "kswapd_high_wmark_hit_quickly") == 0)) ptr = &kswapd_high_wmark_hit_quickly;
442 // else if(unlikely(hash == hash_kswapd_inodesteal && strcmp(name, "kswapd_inodesteal") == 0)) ptr = &kswapd_inodesteal;
443 // else if(unlikely(hash == hash_kswapd_low_wmark_hit_quickly && strcmp(name, "kswapd_low_wmark_hit_quickly") == 0)) ptr = &kswapd_low_wmark_hit_quickly;
444 // else if(unlikely(hash == hash_nr_active_anon && strcmp(name, "nr_active_anon") == 0)) ptr = &nr_active_anon;
445 // else if(unlikely(hash == hash_nr_active_file && strcmp(name, "nr_active_file") == 0)) ptr = &nr_active_file;
446 // else if(unlikely(hash == hash_nr_anon_pages && strcmp(name, "nr_anon_pages") == 0)) ptr = &nr_anon_pages;
447 // else if(unlikely(hash == hash_nr_anon_transparent_hugepages && strcmp(name, "nr_anon_transparent_hugepages") == 0)) ptr = &nr_anon_transparent_hugepages;
448 // else if(unlikely(hash == hash_nr_bounce && strcmp(name, "nr_bounce") == 0)) ptr = &nr_bounce;
449 // else if(unlikely(hash == hash_nr_dirtied && strcmp(name, "nr_dirtied") == 0)) ptr = &nr_dirtied;
450 // else if(unlikely(hash == hash_nr_dirty_background_threshold && strcmp(name, "nr_dirty_background_threshold") == 0)) ptr = &nr_dirty_background_threshold;
451 // else if(unlikely(hash == hash_nr_dirty && strcmp(name, "nr_dirty") == 0)) ptr = &nr_dirty;
452 // else if(unlikely(hash == hash_nr_dirty_threshold && strcmp(name, "nr_dirty_threshold") == 0)) ptr = &nr_dirty_threshold;
453 // else if(unlikely(hash == hash_nr_file_pages && strcmp(name, "nr_file_pages") == 0)) ptr = &nr_file_pages;
454 // else if(unlikely(hash == hash_nr_free_cma && strcmp(name, "nr_free_cma") == 0)) ptr = &nr_free_cma;
455 // else if(unlikely(hash == hash_nr_free_pages && strcmp(name, "nr_free_pages") == 0)) ptr = &nr_free_pages;
456 // else if(unlikely(hash == hash_nr_inactive_anon && strcmp(name, "nr_inactive_anon") == 0)) ptr = &nr_inactive_anon;
457 // else if(unlikely(hash == hash_nr_inactive_file && strcmp(name, "nr_inactive_file") == 0)) ptr = &nr_inactive_file;
458 // else if(unlikely(hash == hash_nr_isolated_anon && strcmp(name, "nr_isolated_anon") == 0)) ptr = &nr_isolated_anon;
459 // else if(unlikely(hash == hash_nr_isolated_file && strcmp(name, "nr_isolated_file") == 0)) ptr = &nr_isolated_file;
460 // else if(unlikely(hash == hash_nr_kernel_stack && strcmp(name, "nr_kernel_stack") == 0)) ptr = &nr_kernel_stack;
461 // else if(unlikely(hash == hash_nr_mapped && strcmp(name, "nr_mapped") == 0)) ptr = &nr_mapped;
462 // else if(unlikely(hash == hash_nr_mlock && strcmp(name, "nr_mlock") == 0)) ptr = &nr_mlock;
463 // else if(unlikely(hash == hash_nr_pages_scanned && strcmp(name, "nr_pages_scanned") == 0)) ptr = &nr_pages_scanned;
464 // else if(unlikely(hash == hash_nr_page_table_pages && strcmp(name, "nr_page_table_pages") == 0)) ptr = &nr_page_table_pages;
465 // else if(unlikely(hash == hash_nr_shmem_hugepages && strcmp(name, "nr_shmem_hugepages") == 0)) ptr = &nr_shmem_hugepages;
466 // else if(unlikely(hash == hash_nr_shmem_pmdmapped && strcmp(name, "nr_shmem_pmdmapped") == 0)) ptr = &nr_shmem_pmdmapped;
467 // else if(unlikely(hash == hash_nr_shmem && strcmp(name, "nr_shmem") == 0)) ptr = &nr_shmem;
468 // else if(unlikely(hash == hash_nr_slab_reclaimable && strcmp(name, "nr_slab_reclaimable") == 0)) ptr = &nr_slab_reclaimable;
469 // else if(unlikely(hash == hash_nr_slab_unreclaimable && strcmp(name, "nr_slab_unreclaimable") == 0)) ptr = &nr_slab_unreclaimable;
470 // else if(unlikely(hash == hash_nr_unevictable && strcmp(name, "nr_unevictable") == 0)) ptr = &nr_unevictable;
471 // else if(unlikely(hash == hash_nr_unstable && strcmp(name, "nr_unstable") == 0)) ptr = &nr_unstable;
472 // else if(unlikely(hash == hash_nr_vmscan_immediate_reclaim && strcmp(name, "nr_vmscan_immediate_reclaim") == 0)) ptr = &nr_vmscan_immediate_reclaim;
473 // else if(unlikely(hash == hash_nr_vmscan_write && strcmp(name, "nr_vmscan_write") == 0)) ptr = &nr_vmscan_write;
474 // else if(unlikely(hash == hash_nr_writeback && strcmp(name, "nr_writeback") == 0)) ptr = &nr_writeback;
475 // else if(unlikely(hash == hash_nr_writeback_temp && strcmp(name, "nr_writeback_temp") == 0)) ptr = &nr_writeback_temp;
476 // else if(unlikely(hash == hash_nr_written && strcmp(name, "nr_written") == 0)) ptr = &nr_written;
477 // else if(unlikely(hash == hash_nr_zone_active_anon && strcmp(name, "nr_zone_active_anon") == 0)) ptr = &nr_zone_active_anon;
478 // else if(unlikely(hash == hash_nr_zone_active_file && strcmp(name, "nr_zone_active_file") == 0)) ptr = &nr_zone_active_file;
479 // else if(unlikely(hash == hash_nr_zone_inactive_anon && strcmp(name, "nr_zone_inactive_anon") == 0)) ptr = &nr_zone_inactive_anon;
480 // else if(unlikely(hash == hash_nr_zone_inactive_file && strcmp(name, "nr_zone_inactive_file") == 0)) ptr = &nr_zone_inactive_file;
481 // else if(unlikely(hash == hash_nr_zone_unevictable && strcmp(name, "nr_zone_unevictable") == 0)) ptr = &nr_zone_unevictable;
482 // else if(unlikely(hash == hash_nr_zone_write_pending && strcmp(name, "nr_zone_write_pending") == 0)) ptr = &nr_zone_write_pending;
483 // else if(unlikely(hash == hash_nr_zspages && strcmp(name, "nr_zspages") == 0)) ptr = &nr_zspages;
484 else if(unlikely(hash == hash_numa_foreign && strcmp(name, "numa_foreign") == 0)) ptr = &numa_foreign;
485 else if(unlikely(hash == hash_numa_hint_faults_local && strcmp(name, "numa_hint_faults_local") == 0)) ptr = &numa_hint_faults_local;
486 else if(unlikely(hash == hash_numa_hint_faults && strcmp(name, "numa_hint_faults") == 0)) ptr = &numa_hint_faults;
487 //else if(unlikely(hash == hash_numa_hit && strcmp(name, "numa_hit") == 0)) ptr = &numa_hit;
488 else if(unlikely(hash == hash_numa_huge_pte_updates && strcmp(name, "numa_huge_pte_updates") == 0)) ptr = &numa_huge_pte_updates;
489 else if(unlikely(hash == hash_numa_interleave && strcmp(name, "numa_interleave") == 0)) ptr = &numa_interleave;
490 else if(unlikely(hash == hash_numa_local && strcmp(name, "numa_local") == 0)) ptr = &numa_local;
491 //else if(unlikely(hash == hash_numa_miss && strcmp(name, "numa_miss") == 0)) ptr = &numa_miss;
492 else if(unlikely(hash == hash_numa_other && strcmp(name, "numa_other") == 0)) ptr = &numa_other;
493 else if(unlikely(hash == hash_numa_pages_migrated && strcmp(name, "numa_pages_migrated") == 0)) ptr = &numa_pages_migrated;
494 else if(unlikely(hash == hash_numa_pte_updates && strcmp(name, "numa_pte_updates") == 0)) ptr = &numa_pte_updates;
495 // else if(unlikely(hash == hash_pageoutrun && strcmp(name, "pageoutrun") == 0)) ptr = &pageoutrun;
496 // else if(unlikely(hash == hash_pgactivate && strcmp(name, "pgactivate") == 0)) ptr = &pgactivate;
497 // else if(unlikely(hash == hash_pgalloc_dma32 && strcmp(name, "pgalloc_dma32") == 0)) ptr = &pgalloc_dma32;
498 // else if(unlikely(hash == hash_pgalloc_dma && strcmp(name, "pgalloc_dma") == 0)) ptr = &pgalloc_dma;
499 // else if(unlikely(hash == hash_pgalloc_movable && strcmp(name, "pgalloc_movable") == 0)) ptr = &pgalloc_movable;
500 // else if(unlikely(hash == hash_pgalloc_normal && strcmp(name, "pgalloc_normal") == 0)) ptr = &pgalloc_normal;
501 // else if(unlikely(hash == hash_pgdeactivate && strcmp(name, "pgdeactivate") == 0)) ptr = &pgdeactivate;
502 else if(unlikely(hash == hash_pgfault && strcmp(name, "pgfault") == 0)) ptr = &pgfault;
503 // else if(unlikely(hash == hash_pgfree && strcmp(name, "pgfree") == 0)) ptr = &pgfree;
504 // else if(unlikely(hash == hash_pginodesteal && strcmp(name, "pginodesteal") == 0)) ptr = &pginodesteal;
505 // else if(unlikely(hash == hash_pglazyfreed && strcmp(name, "pglazyfreed") == 0)) ptr = &pglazyfreed;
506 else if(unlikely(hash == hash_pgmajfault && strcmp(name, "pgmajfault") == 0)) ptr = &pgmajfault;
507 // else if(unlikely(hash == hash_pgmigrate_fail && strcmp(name, "pgmigrate_fail") == 0)) ptr = &pgmigrate_fail;
508 // else if(unlikely(hash == hash_pgmigrate_success && strcmp(name, "pgmigrate_success") == 0)) ptr = &pgmigrate_success;
509 else if(unlikely(hash == hash_pgpgin && strcmp(name, "pgpgin") == 0)) ptr = &pgpgin;
510 else if(unlikely(hash == hash_pgpgout && strcmp(name, "pgpgout") == 0)) ptr = &pgpgout;
511 // else if(unlikely(hash == hash_pgrefill && strcmp(name, "pgrefill") == 0)) ptr = &pgrefill;
512 // else if(unlikely(hash == hash_pgrotated && strcmp(name, "pgrotated") == 0)) ptr = &pgrotated;
513 // else if(unlikely(hash == hash_pgscan_direct && strcmp(name, "pgscan_direct") == 0)) ptr = &pgscan_direct;
514 // else if(unlikely(hash == hash_pgscan_direct_throttle && strcmp(name, "pgscan_direct_throttle") == 0)) ptr = &pgscan_direct_throttle;
515 // else if(unlikely(hash == hash_pgscan_kswapd && strcmp(name, "pgscan_kswapd") == 0)) ptr = &pgscan_kswapd;
516 // else if(unlikely(hash == hash_pgskip_dma32 && strcmp(name, "pgskip_dma32") == 0)) ptr = &pgskip_dma32;
517 // else if(unlikely(hash == hash_pgskip_dma && strcmp(name, "pgskip_dma") == 0)) ptr = &pgskip_dma;
518 // else if(unlikely(hash == hash_pgskip_movable && strcmp(name, "pgskip_movable") == 0)) ptr = &pgskip_movable;
519 // else if(unlikely(hash == hash_pgskip_normal && strcmp(name, "pgskip_normal") == 0)) ptr = &pgskip_normal;
520 // else if(unlikely(hash == hash_pgsteal_direct && strcmp(name, "pgsteal_direct") == 0)) ptr = &pgsteal_direct;
521 // else if(unlikely(hash == hash_pgsteal_kswapd && strcmp(name, "pgsteal_kswapd") == 0)) ptr = &pgsteal_kswapd;
522 else if(unlikely(hash == hash_pswpin && strcmp(name, "pswpin") == 0)) ptr = &pswpin;
523 else if(unlikely(hash == hash_pswpout && strcmp(name, "pswpout") == 0)) ptr = &pswpout;
524 // else if(unlikely(hash == hash_slabs_scanned && strcmp(name, "slabs_scanned") == 0)) ptr = &slabs_scanned;
525 // else if(unlikely(hash == hash_thp_collapse_alloc_failed && strcmp(name, "thp_collapse_alloc_failed") == 0)) ptr = &thp_collapse_alloc_failed;
526 // else if(unlikely(hash == hash_thp_collapse_alloc && strcmp(name, "thp_collapse_alloc") == 0)) ptr = &thp_collapse_alloc;
527 // else if(unlikely(hash == hash_thp_deferred_split_page && strcmp(name, "thp_deferred_split_page") == 0)) ptr = &thp_deferred_split_page;
528 // else if(unlikely(hash == hash_thp_fault_alloc && strcmp(name, "thp_fault_alloc") == 0)) ptr = &thp_fault_alloc;
529 // else if(unlikely(hash == hash_thp_fault_fallback && strcmp(name, "thp_fault_fallback") == 0)) ptr = &thp_fault_fallback;
530 // else if(unlikely(hash == hash_thp_file_alloc && strcmp(name, "thp_file_alloc") == 0)) ptr = &thp_file_alloc;
531 // else if(unlikely(hash == hash_thp_file_mapped && strcmp(name, "thp_file_mapped") == 0)) ptr = &thp_file_mapped;
532 // else if(unlikely(hash == hash_thp_split_page_failed && strcmp(name, "thp_split_page_failed") == 0)) ptr = &thp_split_page_failed;
533 // else if(unlikely(hash == hash_thp_split_page && strcmp(name, "thp_split_page") == 0)) ptr = &thp_split_page;
534 // else if(unlikely(hash == hash_thp_split_pmd && strcmp(name, "thp_split_pmd") == 0)) ptr = &thp_split_pmd;
535 // else if(unlikely(hash == hash_thp_zero_page_alloc_failed && strcmp(name, "thp_zero_page_alloc_failed") == 0)) ptr = &thp_zero_page_alloc_failed;
536 // else if(unlikely(hash == hash_thp_zero_page_alloc && strcmp(name, "thp_zero_page_alloc") == 0)) ptr = &thp_zero_page_alloc;
537 // else if(unlikely(hash == hash_unevictable_pgs_cleared && strcmp(name, "unevictable_pgs_cleared") == 0)) ptr = &unevictable_pgs_cleared;
538 // else if(unlikely(hash == hash_unevictable_pgs_culled && strcmp(name, "unevictable_pgs_culled") == 0)) ptr = &unevictable_pgs_culled;
539 // else if(unlikely(hash == hash_unevictable_pgs_mlocked && strcmp(name, "unevictable_pgs_mlocked") == 0)) ptr = &unevictable_pgs_mlocked;
540 // else if(unlikely(hash == hash_unevictable_pgs_munlocked && strcmp(name, "unevictable_pgs_munlocked") == 0)) ptr = &unevictable_pgs_munlocked;
541 // else if(unlikely(hash == hash_unevictable_pgs_rescued && strcmp(name, "unevictable_pgs_rescued") == 0)) ptr = &unevictable_pgs_rescued;
542 // else if(unlikely(hash == hash_unevictable_pgs_scanned && strcmp(name, "unevictable_pgs_scanned") == 0)) ptr = &unevictable_pgs_scanned;
543 // else if(unlikely(hash == hash_unevictable_pgs_stranded && strcmp(name, "unevictable_pgs_stranded") == 0)) ptr = &unevictable_pgs_stranded;
544 // else if(unlikely(hash == hash_workingset_activate && strcmp(name, "workingset_activate") == 0)) ptr = &workingset_activate;
545 // else if(unlikely(hash == hash_workingset_nodereclaim && strcmp(name, "workingset_nodereclaim") == 0)) ptr = &workingset_nodereclaim;
546 // else if(unlikely(hash == hash_workingset_refault && strcmp(name, "workingset_refault") == 0)) ptr = &workingset_refault;
547 // else if(unlikely(hash == hash_zone_reclaim_failed && strcmp(name, "zone_reclaim_failed") == 0)) ptr = &zone_reclaim_failed;
550 *ptr = str2ull(value);
555 // --------------------------------------------------------------------
557 if(pswpin || pswpout || do_swapio == CONFIG_ONDEMAND_YES) {
558 do_swapio = CONFIG_ONDEMAND_YES;
560 static RRDSET *st_swapio = NULL;
561 if(unlikely(!st_swapio)) {
562 st_swapio = rrdset_create("system", "swapio", NULL, "swap", NULL, "Swap I/O", "kilobytes/s", 250, update_every, RRDSET_TYPE_AREA);
564 rrddim_add(st_swapio, "in", NULL, sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL);
565 rrddim_add(st_swapio, "out", NULL, -sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL);
567 else rrdset_next(st_swapio);
569 rrddim_set(st_swapio, "in", pswpin);
570 rrddim_set(st_swapio, "out", pswpout);
571 rrdset_done(st_swapio);
574 // --------------------------------------------------------------------
577 static RRDSET *st_io = NULL;
578 if(unlikely(!st_io)) {
579 st_io = rrdset_create("system", "io", NULL, "disk", NULL, "Disk I/O", "kilobytes/s", 150, update_every, RRDSET_TYPE_AREA);
581 rrddim_add(st_io, "in", NULL, 1, 1, RRDDIM_INCREMENTAL);
582 rrddim_add(st_io, "out", NULL, -1, 1, RRDDIM_INCREMENTAL);
584 else rrdset_next(st_io);
586 rrddim_set(st_io, "in", pgpgin);
587 rrddim_set(st_io, "out", pgpgout);
591 // --------------------------------------------------------------------
594 static RRDSET *st_pgfaults = NULL;
595 if(unlikely(!st_pgfaults)) {
596 st_pgfaults = rrdset_create("mem", "pgfaults", NULL, "system", NULL, "Memory Page Faults", "page faults/s", 500, update_every, RRDSET_TYPE_LINE);
597 st_pgfaults->isdetail = 1;
599 rrddim_add(st_pgfaults, "minor", NULL, 1, 1, RRDDIM_INCREMENTAL);
600 rrddim_add(st_pgfaults, "major", NULL, -1, 1, RRDDIM_INCREMENTAL);
602 else rrdset_next(st_pgfaults);
604 rrddim_set(st_pgfaults, "minor", pgfault);
605 rrddim_set(st_pgfaults, "major", pgmajfault);
606 rrdset_done(st_pgfaults);
609 // --------------------------------------------------------------------
611 // Ondemand criteria for NUMA. Since this won't change at run time, we
612 // check it only once. We check whether the node count is >= 2 because
613 // single-node systems have uninteresting statistics (since all accesses
615 if(unlikely(has_numa == -1)) {
616 has_numa = (get_numa_node_count() >= 2 &&
617 (numa_local || numa_foreign || numa_interleave || numa_other || numa_pte_updates ||
618 numa_huge_pte_updates || numa_hint_faults || numa_hint_faults_local || numa_pages_migrated)) ? 1 : 0;
621 if(do_numa == CONFIG_ONDEMAND_YES || (do_numa == CONFIG_ONDEMAND_ONDEMAND && has_numa)) {
622 static RRDSET *st_numa = NULL;
623 if(unlikely(!st_numa)) {
624 st_numa = rrdset_create("mem", "numa", NULL, "numa", NULL, "NUMA events", "events/s", 800, update_every, RRDSET_TYPE_LINE);
625 st_numa->isdetail = 1;
627 // These depend on CONFIG_NUMA in the kernel.
628 rrddim_add(st_numa, "local", NULL, 1, 1, RRDDIM_INCREMENTAL);
629 rrddim_add(st_numa, "foreign", NULL, 1, 1, RRDDIM_INCREMENTAL);
630 rrddim_add(st_numa, "interleave", NULL, 1, 1, RRDDIM_INCREMENTAL);
631 rrddim_add(st_numa, "other", NULL, 1, 1, RRDDIM_INCREMENTAL);
633 // The following stats depend on CONFIG_NUMA_BALANCING in the
635 rrddim_add(st_numa, "pte updates", NULL, 1, 1, RRDDIM_INCREMENTAL);
636 rrddim_add(st_numa, "huge pte updates", NULL, 1, 1, RRDDIM_INCREMENTAL);
637 rrddim_add(st_numa, "hint faults", NULL, 1, 1, RRDDIM_INCREMENTAL);
638 rrddim_add(st_numa, "hint faults local", NULL, 1, 1, RRDDIM_INCREMENTAL);
639 rrddim_add(st_numa, "pages migrated", NULL, 1, 1, RRDDIM_INCREMENTAL);
641 else rrdset_next(st_numa);
643 rrddim_set(st_numa, "local", numa_local);
644 rrddim_set(st_numa, "foreign", numa_foreign);
645 rrddim_set(st_numa, "interleave", numa_interleave);
646 rrddim_set(st_numa, "other", numa_other);
648 rrddim_set(st_numa, "pte updates", numa_pte_updates);
649 rrddim_set(st_numa, "huge pte updates", numa_huge_pte_updates);
650 rrddim_set(st_numa, "hint faults", numa_hint_faults);
651 rrddim_set(st_numa, "hint faults local", numa_hint_faults_local);
652 rrddim_set(st_numa, "pages migrated", numa_pages_migrated);
654 rrdset_done(st_numa);