fix(debugfs/extfrag): add zone label (#18910)
Ilya Mashchenko committed
Oct 31, 2024 at 14:17 UTC
acb79a1df7cb15c604fbdd201ec3661cc4919420
1 file changed
+15
-16
src/collectors/debugfs.plugin/debugfs_extfrag.c
+15
-16
@@ -60,23 +60,20 @@ static void extfrag_send_chart(char *chart_id, collected_number *values)
60
}
61
62
int do_debugfs_extfrag(int update_every, const char *name) {
63
- static procfile *ff = NULL;
64
- static int chart_order = NETDATA_CHART_PRIO_MEM_FRAGMENTATION;
63
+ static procfile *ff = NULL;;
64
65
if (unlikely(!ff)) {
66
char filename[FILENAME_MAX + 1];
68
- snprintfz(filename,
69
- FILENAME_MAX,
70
- "%s%s",
71
- netdata_configured_host_prefix,
72
- "/sys/kernel/debug/extfrag/extfrag_index");
67
+ snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/kernel/debug/extfrag/extfrag_index");
68
69
ff = procfile_open(filename, " \t,", PROCFILE_FLAG_DEFAULT);
75
- if (unlikely(!ff)) return 1;
70
+ if (unlikely(!ff))
71
+ return 1;
72
}
73
74
ff = procfile_readall(ff);
79
- if (unlikely(!ff)) return 1;
75
+ if (unlikely(!ff))
76
+ return 1;
77
78
size_t l, i, j, lines = procfile_lines(ff);
79
for (l = 0; l < lines; l++) {
@@ -102,19 +99,21 @@ int do_debugfs_extfrag(int update_every, const char *name) {
99
extrafrag->id = extrafrag->node_zone;
100
fprintf(
101
stdout,
105
- "CHART mem.fragmentation_index_%s '' 'Memory fragmentation index for each order' 'index' 'fragmentation' 'mem.fragmentation_index_%s' 'line' %d %d '' 'debugfs.plugin' '%s'\n",
102
+ "CHART mem.fragmentation_index_%s '' 'Memory fragmentation index for each order' 'index' 'fragmentation' 'mem.numa_node_zone_fragmentation_index' 'line' %d %d '' 'debugfs.plugin' '%s'\n",
103
extrafrag->node_zone,
107
- zone_lowercase,
108
- chart_order++, // FIXME: the same zones must have the same order
104
+ NETDATA_CHART_PRIO_MEM_FRAGMENTATION,
105
update_every,
106
name);
107
for (i = 0; i < NETDATA_ORDER_FRAGMENTATION; i++) {
108
fprintf(stdout, "DIMENSION '%s' '%s' absolute 1 1000 ''\n", orders[i], orders[i]);
109
}
114
- fprintf(stdout,
115
- "CLABEL 'numa_node' 'node%s' 1\n"
116
- "CLABEL_COMMIT\n",
117
- id);
110
+ fprintf(
111
+ stdout,
112
+ "CLABEL 'numa_node' 'node%s' 1\n"
113
+ "CLABEL 'zone' '%s' 1\n"
114
+ "CLABEL_COMMIT\n",
115
+ id,
116
+ zone);
117
}
118
extfrag_send_chart(chart_id, line_orders);
119
}