do not expect numa values when they are not needed
Costa Tsaousis (ktsaou) committed
Jan 20, 2017 at 02:44 UTC
c58b52d252e612cf7a28e1931289bbfc996f6c34
1 file changed
+27
-20
src/proc_vmstat.c
+27
-20
@@ -31,22 +31,34 @@ int do_proc_vmstat(int update_every, usec_t dt) {
31
do_pgfaults = config_get_boolean("plugin:proc:/proc/vmstat", "memory page faults", 1);
32
do_numa = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "system-wide numa metric summary", CONFIG_ONDEMAND_ONDEMAND);
33
34
+
35
arl_base = arl_create(NULL, 60);
35
- arl_expect(arl_base, "numa_foreign", &numa_foreign);
36
- arl_expect(arl_base, "numa_hint_faults_local", &numa_hint_faults_local);
37
- arl_expect(arl_base, "numa_hint_faults", &numa_hint_faults);
38
- arl_expect(arl_base, "numa_huge_pte_updates", &numa_huge_pte_updates);
39
- arl_expect(arl_base, "numa_interleave", &numa_interleave);
40
- arl_expect(arl_base, "numa_local", &numa_local);
41
- arl_expect(arl_base, "numa_other", &numa_other);
42
- arl_expect(arl_base, "numa_pages_migrated", &numa_pages_migrated);
43
- arl_expect(arl_base, "numa_pte_updates", &numa_pte_updates);
36
arl_expect(arl_base, "pgfault", &pgfault);
37
arl_expect(arl_base, "pgmajfault", &pgmajfault);
38
arl_expect(arl_base, "pgpgin", &pgpgin);
39
arl_expect(arl_base, "pgpgout", &pgpgout);
40
arl_expect(arl_base, "pswpin", &pswpin);
41
arl_expect(arl_base, "pswpout", &pswpout);
42
+
43
+ if(do_numa == CONFIG_ONDEMAND_YES || (do_numa == CONFIG_ONDEMAND_ONDEMAND && get_numa_node_count() >= 2)) {
44
+ arl_expect(arl_base, "numa_foreign", &numa_foreign);
45
+ arl_expect(arl_base, "numa_hint_faults_local", &numa_hint_faults_local);
46
+ arl_expect(arl_base, "numa_hint_faults", &numa_hint_faults);
47
+ arl_expect(arl_base, "numa_huge_pte_updates", &numa_huge_pte_updates);
48
+ arl_expect(arl_base, "numa_interleave", &numa_interleave);
49
+ arl_expect(arl_base, "numa_local", &numa_local);
50
+ arl_expect(arl_base, "numa_other", &numa_other);
51
+ arl_expect(arl_base, "numa_pages_migrated", &numa_pages_migrated);
52
+ arl_expect(arl_base, "numa_pte_updates", &numa_pte_updates);
53
+ }
54
+ else {
55
+ // Do not expect numa metrics when they are not needed.
56
+ // By not adding them, the ARL will stop processing the file
57
+ // when all the expected metrics are collected.
58
+ // Also ARL will not parse their values.
59
+ has_numa = 0;
60
+ do_numa = CONFIG_ONDEMAND_NO;
61
+ }
62
}
63
64
if(unlikely(!ff)) {
@@ -69,12 +81,9 @@ int do_proc_vmstat(int update_every, usec_t dt) {
81
continue;
82
}
83
72
- char *name = procfile_lineword(ff, l, 0);
73
- char *value = procfile_lineword(ff, l, 1);
74
- if(unlikely(!name || !*name || !value || !*value)) continue;
75
-
76
- if(unlikely(arl_check(arl_base, name, value)))
77
- break;
84
+ if(unlikely(arl_check(arl_base,
85
+ procfile_lineword(ff, l, 0),
86
+ procfile_lineword(ff, l, 1)))) break;
87
}
88
89
// --------------------------------------------------------------------
@@ -137,11 +146,9 @@ int do_proc_vmstat(int update_every, usec_t dt) {
146
// check it only once. We check whether the node count is >= 2 because
147
// single-node systems have uninteresting statistics (since all accesses
148
// are local).
140
- if(unlikely(has_numa == -1)) {
141
- has_numa = (get_numa_node_count() >= 2 &&
142
- (numa_local || numa_foreign || numa_interleave || numa_other || numa_pte_updates ||
143
- numa_huge_pte_updates || numa_hint_faults || numa_hint_faults_local || numa_pages_migrated)) ? 1 : 0;
144
- }
149
+ if(unlikely(has_numa == -1))
150
+ has_numa = (numa_local || numa_foreign || numa_interleave || numa_other || numa_pte_updates ||
151
+ numa_huge_pte_updates || numa_hint_faults || numa_hint_faults_local || numa_pages_migrated) ? 1 : 0;
152
153
if(do_numa == CONFIG_ONDEMAND_YES || (do_numa == CONFIG_ONDEMAND_ONDEMAND && has_numa)) {
154
do_numa = CONFIG_ONDEMAND_YES;