Add Linux page cache metrics to eBPF (#10693)
Add new eBPF thread to display page cache utilization.
thiagoftsm committed
Mar 3, 2021 at 16:08 UTC
71e711430cd793daa0599c5f911018889778798b
12 files changed
+833
-38
CMakeLists.txt
+2
@@ -481,6 +481,8 @@ set(SLABINFO_PLUGIN_FILES
481
set(EBPF_PROCESS_PLUGIN_FILES
482
collectors/ebpf.plugin/ebpf.c
483
collectors/ebpf.plugin/ebpf.h
484
+ collectors/ebpf.plugin/ebpf_cachestat.c
485
+ collectors/ebpf.plugin/ebpf_cachestat.h
486
collectors/ebpf.plugin/ebpf_process.c
487
collectors/ebpf.plugin/ebpf_process.h
488
collectors/ebpf.plugin/ebpf_socket.c
Makefile.am
+2
@@ -281,6 +281,8 @@ PERF_PLUGIN_FILES = \
281
282
EBPF_PLUGIN_FILES = \
283
collectors/ebpf.plugin/ebpf.c \
284
+ collectors/ebpf.plugin/ebpf_cachestat.c \
285
+ collectors/ebpf.plugin/ebpf_cachestat.h \
286
collectors/ebpf.plugin/ebpf_process.c \
287
collectors/ebpf.plugin/ebpf_process.h \
288
collectors/ebpf.plugin/ebpf_socket.c \
collectors/ebpf.plugin/ebpf.c
+51
-22
@@ -83,6 +83,9 @@ ebpf_module_t ebpf_modules[] = {
83
{ .thread_name = "socket", .config_name = "socket", .enabled = 0, .start_routine = ebpf_socket_thread,
84
.update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
85
.optional = 0, .apps_routine = ebpf_socket_create_apps_charts },
86
+ { .thread_name = "cachestat", .config_name = "cachestat", .enabled = 0, .start_routine = ebpf_cachestat_thread,
87
+ .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
88
+ .optional = 0, .apps_routine = ebpf_cachestat_create_apps_charts },
89
{ .thread_name = NULL, .enabled = 0, .start_routine = NULL, .update_time = 1,
90
.global_charts = 0, .apps_charts = 1, .mode = MODE_ENTRY,
91
.optional = 0, .apps_routine = NULL },
@@ -585,21 +588,23 @@ void ebpf_print_help()
588
"\n"
589
" Available command line options:\n"
590
"\n"
588
- " SECONDS set the data collection frequency.\n"
591
+ " SECONDS Set the data collection frequency.\n"
592
"\n"
590
- " --help or -h show this help.\n"
593
+ " --help or -h Show this help.\n"
594
"\n"
592
- " --version or -v show software version.\n"
595
+ " --version or -v Show software version.\n"
596
"\n"
594
- " --global or -g disable charts per application.\n"
597
+ " --global or -g Disable charts per application.\n"
598
"\n"
596
- " --all or -a Enable all chart groups (global and apps), unless -g is also given.\n"
599
+ " --all or -a Enable all chart groups (global and apps), unless -g is also given.\n"
600
"\n"
598
- " --net or -n Enable network viewer charts.\n"
601
+ " --cachestat or -c Enable charts related to process run time.\n"
602
"\n"
600
- " --process or -p Enable charts related to process run time.\n"
603
+ " --net or -n Enable network viewer charts.\n"
604
"\n"
602
- " --return or -r Run the collector in return mode.\n"
605
+ " --process or -p Enable charts related to process run time.\n"
606
+ "\n"
607
+ " --return or -r Run the collector in return mode.\n"
608
"\n",
609
VERSION,
610
(year >= 116) ? year + 1900 : 2020);
@@ -1657,7 +1662,7 @@ static void read_collector_values(int *disable_apps)
1662
1663
// Read ebpf programs section
1664
enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION,
1660
- ebpf_modules[0].config_name, CONFIG_BOOLEAN_YES);
1665
+ ebpf_modules[EBPF_MODULE_PROCESS_IDX].config_name, CONFIG_BOOLEAN_YES);
1666
int started = 0;
1667
if (enabled) {
1668
ebpf_enable_chart(EBPF_MODULE_PROCESS_IDX, *disable_apps);
@@ -1668,7 +1673,8 @@ static void read_collector_values(int *disable_apps)
1673
enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network viewer",
1674
CONFIG_BOOLEAN_NO);
1675
if (!enabled)
1671
- enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, ebpf_modules[1].config_name,
1676
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION,
1677
+ ebpf_modules[EBPF_MODULE_SOCKET_IDX].config_name,
1678
CONFIG_BOOLEAN_NO);
1679
1680
if (enabled) {
@@ -1685,7 +1691,15 @@ static void read_collector_values(int *disable_apps)
1691
if (!enabled)
1692
enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "network connections",
1693
CONFIG_BOOLEAN_NO);
1688
- ebpf_modules[1].optional = enabled;
1694
+ ebpf_modules[EBPF_MODULE_SOCKET_IDX].optional = enabled;
1695
+
1696
+ enabled = appconfig_get_boolean(&collector_config, EBPF_PROGRAMS_SECTION, "cachestat",
1697
+ CONFIG_BOOLEAN_NO);
1698
+
1699
+ if (enabled) {
1700
+ ebpf_enable_chart(EBPF_MODULE_CACHESTAT_IDX, *disable_apps);
1701
+ started++;
1702
+ }
1703
1704
if (!started){
1705
ebpf_enable_all_charts(*disable_apps);
@@ -1761,13 +1775,14 @@ static void parse_args(int argc, char **argv)
1775
int freq = 0;
1776
int option_index = 0;
1777
static struct option long_options[] = {
1764
- {"help", no_argument, 0, 'h' },
1765
- {"version", no_argument, 0, 'v' },
1766
- {"global", no_argument, 0, 'g' },
1767
- {"all", no_argument, 0, 'a' },
1768
- {"net", no_argument, 0, 'n' },
1769
- {"process", no_argument, 0, 'p' },
1770
- {"return", no_argument, 0, 'r' },
1778
+ {"help", no_argument, 0, 'h' },
1779
+ {"version", no_argument, 0, 'v' },
1780
+ {"global", no_argument, 0, 'g' },
1781
+ {"all", no_argument, 0, 'a' },
1782
+ {"cachestat", no_argument, 0, 'c' },
1783
+ {"net", no_argument, 0, 'n' },
1784
+ {"process", no_argument, 0, 'p' },
1785
+ {"return", no_argument, 0, 'r' },
1786
{0, 0, 0, 0}
1787
};
1788
@@ -1782,7 +1797,7 @@ static void parse_args(int argc, char **argv)
1797
}
1798
1799
while (1) {
1785
- int c = getopt_long(argc, argv, "hvganpr", long_options, &option_index);
1800
+ int c = getopt_long(argc, argv, "hvgcanpr", long_options, &option_index);
1801
if (c == -1)
1802
break;
1803
@@ -1808,6 +1823,15 @@ static void parse_args(int argc, char **argv)
1823
ebpf_enable_all_charts(disable_apps);
1824
#ifdef NETDATA_INTERNAL_CHECKS
1825
info("EBPF running with all chart groups, because it was started with the option \"--all\" or \"-a\".");
1826
+#endif
1827
+ break;
1828
+ }
1829
+ case 'c': {
1830
+ enabled = 1;
1831
+ ebpf_enable_chart(EBPF_MODULE_CACHESTAT_IDX, disable_apps);
1832
+#ifdef NETDATA_INTERNAL_CHECKS
1833
+ info(
1834
+ "EBPF enabling \"CACHESTAT\" charts, because it was started with the option \"--cachestat\" or \"-c\".");
1835
#endif
1836
break;
1837
}
@@ -1953,9 +1977,14 @@ int main(int argc, char **argv)
1977
read_local_ports("/proc/net/udp6", IPPROTO_UDP);
1978
1979
struct netdata_static_thread ebpf_threads[] = {
1956
- {"EBPF PROCESS", NULL, NULL, 1, NULL, NULL, ebpf_modules[0].start_routine},
1957
- {"EBPF SOCKET" , NULL, NULL, 1, NULL, NULL, ebpf_modules[1].start_routine},
1958
- {NULL , NULL, NULL, 0, NULL, NULL, NULL}
1980
+ {"EBPF PROCESS", NULL, NULL, 1,
1981
+ NULL, NULL, ebpf_modules[EBPF_MODULE_PROCESS_IDX].start_routine},
1982
+ {"EBPF SOCKET" , NULL, NULL, 1,
1983
+ NULL, NULL, ebpf_modules[EBPF_MODULE_SOCKET_IDX].start_routine},
1984
+ {"EBPF CACHESTAT" , NULL, NULL, 1,
1985
+ NULL, NULL, ebpf_modules[EBPF_MODULE_CACHESTAT_IDX].start_routine},
1986
+ {NULL , NULL, NULL, 0,
1987
+ NULL, NULL, NULL}
1988
};
1989
1990
//clean_loaded_events();
collectors/ebpf.plugin/ebpf.conf
+2
@@ -19,11 +19,13 @@
19
#
20
# The eBPF collector enables and runs the following eBPF programs by default:
21
#
22
+# `cachestat`: Make charts for kernel functions related to page cache.
23
# `process` : This eBPF program creates charts that show information about process creation, VFS IO, and
24
# files removed.
25
# `socket` : This eBPF program creates charts with information about `TCP` and `UDP` functions, including the
26
# bandwidth consumed by each.
27
[ebpf programs]
28
+ cachestat = no
29
process = yes
30
socket = yes
31
network connections = no
collectors/ebpf.plugin/ebpf.h
+7
-2
@@ -70,8 +70,11 @@ typedef struct netdata_error_report {
70
} netdata_error_report_t;
71
72
extern ebpf_module_t ebpf_modules[];
73
-#define EBPF_MODULE_PROCESS_IDX 0
74
-#define EBPF_MODULE_SOCKET_IDX 1
73
+enum ebpf_module_indexes {
74
+ EBPF_MODULE_PROCESS_IDX,
75
+ EBPF_MODULE_SOCKET_IDX,
76
+ EBPF_MODULE_CACHESTAT_IDX
77
+};
78
79
// Copied from musl header
80
#ifndef offsetof
@@ -181,6 +184,7 @@ extern void ebpf_cleanup_publish_syscall(netdata_publish_syscall_t *nps);
184
#define EBPF_NETWORK_VIEWER_SECTION "network connections"
185
#define EBPF_SERVICE_NAME_SECTION "service name"
186
187
+#define EBPF_COMMON_DIMENSION_PERCENTAGE "%"
188
#define EBPF_COMMON_DIMENSION_CALL "calls/s"
189
#define EBPF_COMMON_DIMENSION_BITS "kilobits/s"
190
#define EBPF_COMMON_DIMENSION_BYTES "bytes/s"
@@ -198,6 +202,7 @@ extern char *ebpf_algorithms[];
202
// Common functions
203
extern void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr);
204
extern void ebpf_socket_create_apps_charts(struct ebpf_module *em, void *ptr);
205
+extern void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *root);
206
extern collected_number get_value_from_structure(char *basis, size_t offset);
207
extern struct pid_stat *root_of_pids;
208
extern ebpf_process_stat_t *global_process_stat;
collectors/ebpf.plugin/ebpf_apps.c
+22
-10
@@ -909,6 +909,26 @@ static inline void del_pid_entry(pid_t pid)
909
all_pids_count--;
910
}
911
912
+/**
913
+ * Cleanup variable from other threads
914
+ *
915
+ * @param pid current pid.
916
+ */
917
+void cleanup_variables_from_other_threads(uint32_t pid)
918
+{
919
+ // Clean socket structures
920
+ if (socket_bandwidth_curr) {
921
+ freez(socket_bandwidth_curr[pid]);
922
+ socket_bandwidth_curr[pid] = NULL;
923
+ }
924
+
925
+ // Clean cachestat strcture
926
+ if (cachestat_pid) {
927
+ freez(cachestat_pid[pid]);
928
+ cachestat_pid[pid] = NULL;
929
+ }
930
+}
931
+
932
/**
933
* Remove PIDs when they are not running more.
934
*/
@@ -932,11 +952,7 @@ void cleanup_exited_pids()
952
freez(current_apps_data[r]);
953
current_apps_data[r] = NULL;
954
935
- // Clean socket structures
936
- if (socket_bandwidth_curr) {
937
- freez(socket_bandwidth_curr[r]);
938
- socket_bandwidth_curr[r] = NULL;
939
- }
955
+ cleanup_variables_from_other_threads(r);
956
} else {
957
if (unlikely(p->keep))
958
p->keeploops++;
@@ -1054,11 +1070,7 @@ void collect_data_for_all_processes(int tbl_pid_stats_fd)
1070
freez(current_apps_data[key]);
1071
current_apps_data[key] = NULL;
1072
1057
- // Clean socket structures
1058
- if (socket_bandwidth_curr) {
1059
- freez(socket_bandwidth_curr[key]);
1060
- socket_bandwidth_curr[key] = NULL;
1061
- }
1073
+ cleanup_variables_from_other_threads(key);
1074
1075
pids = pids->next;
1076
continue;
collectors/ebpf.plugin/ebpf_apps.h
+6
@@ -15,8 +15,10 @@
15
#define NETDATA_APPS_VFS_GROUP "ebpf vfs"
16
#define NETDATA_APPS_PROCESS_GROUP "ebpf process"
17
#define NETDATA_APPS_NET_GROUP "ebpf net"
18
+#define NETDATA_APPS_CACHESTAT_GROUP "ebpf cachestat"
19
20
#include "ebpf_process.h"
21
+#include "ebpf_cachestat.h"
22
23
#define MAX_COMPARE_NAME 100
24
#define MAX_NAME 100
@@ -105,6 +107,9 @@ struct target {
107
uid_t uid;
108
gid_t gid;
109
110
+ // Page cache statistic per process
111
+ netdata_publish_cachestat_t cachestat;
112
+
113
/* These variables are not necessary for eBPF collector
114
kernel_uint_t minflt;
115
kernel_uint_t cminflt;
@@ -426,5 +431,6 @@ extern void collect_data_for_all_processes(int tbl_pid_stats_fd);
431
432
extern ebpf_process_stat_t **global_process_stats;
433
extern ebpf_process_publish_apps_t **current_apps_data;
434
+extern netdata_publish_cachestat_t **cachestat_pid;
435
436
#endif /* NETDATA_EBPF_APPS_H */
collectors/ebpf.plugin/ebpf_cachestat.c
new
+658
@@ -0,0 +1,658 @@
1
+// SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+#include "ebpf.h"
4
+#include "ebpf_cachestat.h"
5
+
6
+static ebpf_data_t cachestat_data;
7
+netdata_publish_cachestat_t **cachestat_pid;
8
+
9
+static struct bpf_link **probe_links = NULL;
10
+static struct bpf_object *objects = NULL;
11
+
12
+static char *cachestat_counter_dimension_name[NETDATA_CACHESTAT_END] = { "ratio", "dirty", "hit",
13
+ "miss" };
14
+static netdata_syscall_stat_t *cachestat_counter_aggregated_data = NULL;
15
+static netdata_publish_syscall_t *cachestat_counter_publish_aggregated = NULL;
16
+
17
+netdata_cachestat_pid_t *cachestat_vector = NULL;
18
+
19
+static netdata_idx_t *cachestat_hash_values = NULL;
20
+
21
+static int read_thread_closed = 1;
22
+
23
+struct netdata_static_thread cachestat_threads = {"CACHESTAT KERNEL",
24
+ NULL, NULL, 1, NULL,
25
+ NULL, NULL};
26
+
27
+static int *map_fd = NULL;
28
+
29
+/*****************************************************************
30
+ *
31
+ * FUNCTIONS TO CLOSE THE THREAD
32
+ *
33
+ *****************************************************************/
34
+
35
+/**
36
+ * Clean PID structures
37
+ *
38
+ * Clean the allocated structures.
39
+ */
40
+static void clean_pid_structures() {
41
+ struct pid_stat *pids = root_of_pids;
42
+ while (pids) {
43
+ freez(cachestat_pid[pids->pid]);
44
+
45
+ pids = pids->next;
46
+ }
47
+}
48
+
49
+/**
50
+ * Clean up the main thread.
51
+ *
52
+ * @param ptr thread data.
53
+ */
54
+static void ebpf_cachestat_cleanup(void *ptr)
55
+{
56
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
57
+ if (!em->enabled)
58
+ return;
59
+
60
+ heartbeat_t hb;
61
+ heartbeat_init(&hb);
62
+ uint32_t tick = 2*USEC_PER_MS;
63
+ while (!read_thread_closed) {
64
+ usec_t dt = heartbeat_next(&hb, tick);
65
+ UNUSED(dt);
66
+ }
67
+
68
+ clean_pid_structures();
69
+ freez(cachestat_pid);
70
+
71
+ freez(cachestat_counter_aggregated_data);
72
+ ebpf_cleanup_publish_syscall(cachestat_counter_publish_aggregated);
73
+ freez(cachestat_counter_publish_aggregated);
74
+
75
+ freez(cachestat_vector);
76
+ freez(cachestat_hash_values);
77
+
78
+ struct bpf_program *prog;
79
+ size_t i = 0 ;
80
+ bpf_object__for_each_program(prog, objects) {
81
+ bpf_link__destroy(probe_links[i]);
82
+ i++;
83
+ }
84
+ bpf_object__close(objects);
85
+}
86
+
87
+/*****************************************************************
88
+ *
89
+ * COMMON FUNCTIONS
90
+ *
91
+ *****************************************************************/
92
+
93
+/**
94
+ * Write charts
95
+ *
96
+ * Write the current information to publish the charts.
97
+ *
98
+ * @param family chart family
99
+ * @param chart chart id
100
+ * @param dim dimension name
101
+ * @param v1 value.
102
+ */
103
+static inline void cachestat_write_charts(char *family, char *chart, char *dim, long long v1)
104
+{
105
+ write_begin_chart(family, chart);
106
+
107
+ write_chart_dimension(dim, v1);
108
+
109
+ write_end_chart();
110
+}
111
+
112
+/**
113
+ * Update publish
114
+ *
115
+ * Update publish values before to write dimension.
116
+ *
117
+ * @param out strcuture that will receive data.
118
+ * @param mpa calls for mark_page_accessed during the last second.
119
+ * @param mbd calls for mark_buffer_dirty during the last second.
120
+ * @param apcl calls for add_to_page_cache_lru during the last second.
121
+ * @param apd calls for account_page_dirtied during the last second.
122
+ */
123
+void cachestat_update_publish(netdata_publish_cachestat_t *out, uint64_t mpa, uint64_t mbd,
124
+ uint64_t apcl, uint64_t apd)
125
+{
126
+ // Adapted algorithm from https://github.com/iovisor/bcc/blob/master/tools/cachestat.py#L126-L138
127
+ calculated_number total = (calculated_number) (((long long)mpa) - ((long long)mbd));
128
+ if (total < 0)
129
+ total = 0;
130
+
131
+ calculated_number misses = (calculated_number) ( ((long long) apcl) - ((long long) apd) );
132
+ if (misses < 0)
133
+ misses = 0;
134
+
135
+ // If hits are < 0, then its possible misses are overestimate due to possibly page cache read ahead adding
136
+ // more pages than needed. In this case just assume misses as total and reset hits.
137
+ calculated_number hits = total - misses;
138
+ if (hits < 0 ) {
139
+ misses = total;
140
+ hits = 0;
141
+ }
142
+
143
+ calculated_number ratio = (total > 0) ? hits/total : 0;
144
+
145
+ out->ratio = (long long )(ratio*100);
146
+ out->hit = (long long)hits;
147
+ out->miss = (long long)misses;
148
+}
149
+
150
+/**
151
+ * Save previous values
152
+ *
153
+ * Save values used this time.
154
+ *
155
+ * @param publish
156
+ */
157
+static void save_previous_values(netdata_publish_cachestat_t *publish) {
158
+ publish->prev.mark_page_accessed = cachestat_hash_values[NETDATA_KEY_CALLS_MARK_PAGE_ACCESSED];
159
+ publish->prev.account_page_dirtied = cachestat_hash_values[NETDATA_KEY_CALLS_ACCOUNT_PAGE_DIRTIED];
160
+ publish->prev.add_to_page_cache_lru = cachestat_hash_values[NETDATA_KEY_CALLS_ADD_TO_PAGE_CACHE_LRU];
161
+ publish->prev.mark_buffer_dirty = cachestat_hash_values[NETDATA_KEY_CALLS_MARK_BUFFER_DIRTY];
162
+}
163
+
164
+/**
165
+ * Calculate statistics
166
+ *
167
+ * @param publish the structure where we will store the data.
168
+ */
169
+static void calculate_stats(netdata_publish_cachestat_t *publish) {
170
+ if (!publish->prev.mark_page_accessed) {
171
+ save_previous_values(publish);
172
+ return;
173
+ }
174
+
175
+ uint64_t mpa = cachestat_hash_values[NETDATA_KEY_CALLS_MARK_PAGE_ACCESSED] - publish->prev.mark_page_accessed;
176
+ uint64_t mbd = cachestat_hash_values[NETDATA_KEY_CALLS_MARK_BUFFER_DIRTY] - publish->prev.mark_buffer_dirty;
177
+ uint64_t apcl = cachestat_hash_values[NETDATA_KEY_CALLS_ADD_TO_PAGE_CACHE_LRU] - publish->prev.add_to_page_cache_lru;
178
+ uint64_t apd = cachestat_hash_values[NETDATA_KEY_CALLS_ACCOUNT_PAGE_DIRTIED] - publish->prev.account_page_dirtied;
179
+
180
+ save_previous_values(publish);
181
+
182
+ // We are changing the original algorithm to have a smooth ratio.
183
+ cachestat_update_publish(publish, mpa, mbd, apcl, apd);
184
+}
185
+
186
+
187
+/*****************************************************************
188
+ *
189
+ * APPS
190
+ *
191
+ *****************************************************************/
192
+
193
+/**
194
+ * Apps Accumulator
195
+ *
196
+ * Sum all values read from kernel and store in the first address.
197
+ *
198
+ * @param out the vector with read values.
199
+ */
200
+static void cachestat_apps_accumulator(netdata_cachestat_pid_t *out)
201
+{
202
+ int i, end = (running_on_kernel >= NETDATA_KERNEL_V4_15) ? ebpf_nprocs : 1;
203
+ netdata_cachestat_pid_t *total = &out[0];
204
+ for (i = 1; i < end; i++) {
205
+ netdata_cachestat_pid_t *w = &out[i];
206
+ total->account_page_dirtied += w->account_page_dirtied;
207
+ total->add_to_page_cache_lru += w->add_to_page_cache_lru;
208
+ total->mark_buffer_dirty += w->mark_buffer_dirty;
209
+ total->mark_page_accessed += w->mark_page_accessed;
210
+ }
211
+}
212
+
213
+/**
214
+ * Save Pid values
215
+ *
216
+ * Save the current values inside the structure
217
+ *
218
+ * @param out vector used to plot charts
219
+ * @param publish vector with values read from hash tables.
220
+ */
221
+static inline void cachestat_save_pid_values(netdata_publish_cachestat_t *out, netdata_cachestat_pid_t *publish)
222
+{
223
+ if (!out->current.mark_page_accessed) {
224
+ memcpy(&out->current, &publish[0], sizeof(netdata_cachestat_pid_t));
225
+ return;
226
+ }
227
+
228
+ memcpy(&out->prev, &out->current, sizeof(netdata_cachestat_pid_t));
229
+ memcpy(&out->current, &publish[0], sizeof(netdata_cachestat_pid_t));
230
+}
231
+
232
+/**
233
+ * Fill PID
234
+ *
235
+ * Fill PID structures
236
+ *
237
+ * @param current_pid pid that we are collecting data
238
+ * @param out values read from hash tables;
239
+ */
240
+static void cachestat_fill_pid(uint32_t current_pid, netdata_cachestat_pid_t *publish)
241
+{
242
+ netdata_publish_cachestat_t *curr = cachestat_pid[current_pid];
243
+ if (!curr) {
244
+ curr = callocz(1, sizeof(netdata_publish_cachestat_t));
245
+ cachestat_pid[current_pid] = curr;
246
+
247
+ cachestat_save_pid_values(curr, publish);
248
+ return;
249
+ }
250
+
251
+ cachestat_save_pid_values(curr, publish);
252
+}
253
+
254
+/**
255
+ * Read APPS table
256
+ *
257
+ * Read the apps table and store data inside the structure.
258
+ */
259
+static void read_apps_table()
260
+{
261
+ netdata_cachestat_pid_t *cv = cachestat_vector;
262
+ uint32_t key;
263
+ struct pid_stat *pids = root_of_pids;
264
+ int fd = map_fd[NETDATA_CACHESTAT_PID_STATS];
265
+ size_t length = sizeof(netdata_cachestat_pid_t)*ebpf_nprocs;
266
+ while (pids) {
267
+ key = pids->pid;
268
+
269
+ if (bpf_map_lookup_elem(fd, &key, cv)) {
270
+ pids = pids->next;
271
+ continue;
272
+ }
273
+
274
+ cachestat_apps_accumulator(cv);
275
+
276
+ cachestat_fill_pid(key, cv);
277
+
278
+ // We are cleaning to avoid passing data read from one process to other.
279
+ memset(cv, 0, length);
280
+
281
+ pids = pids->next;
282
+ }
283
+}
284
+
285
+/**
286
+ * Create apps charts
287
+ *
288
+ * Call ebpf_create_chart to create the charts on apps submenu.
289
+ *
290
+ * @param em a pointer to the structure with the default values.
291
+ */
292
+void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *ptr)
293
+{
294
+ UNUSED(em);
295
+ struct target *root = ptr;
296
+ ebpf_create_charts_on_apps(NETDATA_CACHESTAT_HIT_RATIO_CHART,
297
+ "The ratio is calculated dividing the Hit pages per total cache accesses without counting dirties.",
298
+ EBPF_COMMON_DIMENSION_PERCENTAGE,
299
+ NETDATA_APPS_CACHESTAT_GROUP,
300
+ 20090,
301
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX],
302
+ root);
303
+
304
+ ebpf_create_charts_on_apps(NETDATA_CACHESTAT_DIRTY_CHART,
305
+ "Number of pages marked as dirty. When a page is called dirty, this means that the data stored inside the page needs to be written to devices.",
306
+ EBPF_CACHESTAT_DIMENSION_PAGE,
307
+ NETDATA_APPS_CACHESTAT_GROUP,
308
+ 20091,
309
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
310
+ root);
311
+
312
+ ebpf_create_charts_on_apps(NETDATA_CACHESTAT_HIT_CHART,
313
+ "Number of cache access without counting dirty pages and page additions.",
314
+ EBPF_CACHESTAT_DIMENSION_HITS,
315
+ NETDATA_APPS_CACHESTAT_GROUP,
316
+ 20092,
317
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX],
318
+ root);
319
+
320
+ ebpf_create_charts_on_apps(NETDATA_CACHESTAT_MISSES_CHART,
321
+ "Page caches added without counting dirty pages",
322
+ EBPF_CACHESTAT_DIMENSION_MISSES,
323
+ NETDATA_APPS_CACHESTAT_GROUP,
324
+ 20093,
325
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX],
326
+ root);
327
+}
328
+
329
+/*****************************************************************
330
+ *
331
+ * MAIN LOOP
332
+ *
333
+ *****************************************************************/
334
+
335
+/**
336
+ * Read global counter
337
+ *
338
+ * Read the table with number of calls for all functions
339
+ */
340
+static void read_global_table()
341
+{
342
+ uint32_t idx;
343
+ netdata_idx_t *val = cachestat_hash_values;
344
+ netdata_idx_t stored;
345
+ int fd = map_fd[NETDATA_CACHESTAT_GLOBAL_STATS];
346
+
347
+ for (idx = NETDATA_KEY_CALLS_ADD_TO_PAGE_CACHE_LRU; idx < NETDATA_CACHESTAT_END; idx++) {
348
+ if (!bpf_map_lookup_elem(fd, &idx, &stored)) {
349
+ val[idx] = stored;
350
+ }
351
+ }
352
+}
353
+
354
+/**
355
+ * Socket read hash
356
+ *
357
+ * This is the thread callback.
358
+ * This thread is necessary, because we cannot freeze the whole plugin to read the data on very busy socket.
359
+ *
360
+ * @param ptr It is a NULL value for this thread.
361
+ *
362
+ * @return It always returns NULL.
363
+ */
364
+void *ebpf_cachestat_read_hash(void *ptr)
365
+{
366
+ read_thread_closed = 0;
367
+
368
+ heartbeat_t hb;
369
+ heartbeat_init(&hb);
370
+ usec_t step = NETDATA_LATENCY_CACHESTAT_SLEEP_MS;
371
+
372
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
373
+
374
+ int apps = em->apps_charts;
375
+ while (!close_ebpf_plugin) {
376
+ usec_t dt = heartbeat_next(&hb, step);
377
+ (void)dt;
378
+
379
+ read_global_table();
380
+
381
+ if (apps)
382
+ read_apps_table();
383
+ }
384
+ read_thread_closed = 1;
385
+
386
+ return NULL;
387
+}
388
+
389
+/**
390
+ * Send global
391
+ *
392
+ * Send global charts to Netdata
393
+ */
394
+static void cachestat_send_global(netdata_publish_cachestat_t *publish)
395
+{
396
+ calculate_stats(publish);
397
+
398
+ netdata_publish_syscall_t *ptr = cachestat_counter_publish_aggregated;
399
+ // The algorithm sets this value to zero sometimes, we are not written them to have a smooth chart
400
+ if (publish->ratio) {
401
+ cachestat_write_charts(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_RATIO_CHART,
402
+ ptr[NETDATA_CACHESTAT_IDX_RATIO].dimension, publish->ratio);
403
+ }
404
+
405
+ cachestat_write_charts(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_DIRTY_CHART,
406
+ ptr[NETDATA_CACHESTAT_IDX_DIRTY].dimension,
407
+ cachestat_hash_values[NETDATA_KEY_CALLS_MARK_BUFFER_DIRTY]);
408
+
409
+ cachestat_write_charts(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_CHART,
410
+ ptr[NETDATA_CACHESTAT_IDX_HIT].dimension, publish->hit);
411
+
412
+ cachestat_write_charts(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_MISSES_CHART,
413
+ ptr[NETDATA_CACHESTAT_IDX_MISS].dimension, publish->miss);
414
+}
415
+
416
+/**
417
+ * Cachestat sum PIDs
418
+ *
419
+ * Sum values for all PIDs associated to a group
420
+ *
421
+ * @param publish output structure.
422
+ * @param root structure with listed IPs
423
+ */
424
+void ebpf_cachestat_sum_pids(netdata_publish_cachestat_t *publish, struct pid_on_target *root)
425
+{
426
+ memcpy(&publish->prev, &publish->current,sizeof(publish->current));
427
+ memset(&publish->current, 0, sizeof(publish->current));
428
+
429
+ netdata_cachestat_pid_t *dst = &publish->current;
430
+ while (root) {
431
+ int32_t pid = root->pid;
432
+ netdata_publish_cachestat_t *w = cachestat_pid[pid];
433
+ if (w) {
434
+ netdata_cachestat_pid_t *src = &w->current;
435
+ dst->account_page_dirtied += src->account_page_dirtied;
436
+ dst->add_to_page_cache_lru += src->add_to_page_cache_lru;
437
+ dst->mark_buffer_dirty += src->mark_buffer_dirty;
438
+ dst->mark_page_accessed += src->mark_page_accessed;
439
+ }
440
+
441
+ root = root->next;
442
+ }
443
+}
444
+
445
+/**
446
+ * Send data to Netdata calling auxiliar functions.
447
+ *
448
+ * @param root the target list.
449
+*/
450
+void ebpf_cache_send_apps_data(struct target *root)
451
+{
452
+ struct target *w;
453
+ collected_number value;
454
+
455
+ write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_CACHESTAT_HIT_RATIO_CHART);
456
+ for (w = root; w; w = w->next) {
457
+ if (unlikely(w->exposed && w->processes)) {
458
+ ebpf_cachestat_sum_pids(&w->cachestat, w->root_pid);
459
+ netdata_cachestat_pid_t *current = &w->cachestat.current;
460
+ netdata_cachestat_pid_t *prev = &w->cachestat.prev;
461
+
462
+ uint64_t mpa = current->mark_page_accessed - prev->mark_page_accessed;
463
+ uint64_t mbd = current->mark_buffer_dirty - prev->mark_buffer_dirty;
464
+ w->cachestat.dirty = current->mark_buffer_dirty;
465
+ uint64_t apcl = current->add_to_page_cache_lru - prev->add_to_page_cache_lru;
466
+ uint64_t apd = current->account_page_dirtied - prev->account_page_dirtied;
467
+
468
+ cachestat_update_publish(&w->cachestat, mpa, mbd, apcl, apd);
469
+ value = (collected_number) w->cachestat.ratio;
470
+ // Here we are using different approach to have a chart more smooth
471
+ write_chart_dimension(w->name, value);
472
+ }
473
+ }
474
+ write_end_chart();
475
+
476
+ write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_CACHESTAT_DIRTY_CHART);
477
+ for (w = root; w; w = w->next) {
478
+ if (unlikely(w->exposed && w->processes)) {
479
+ value = (collected_number) w->cachestat.dirty;
480
+ write_chart_dimension(w->name, value);
481
+ }
482
+ }
483
+ write_end_chart();
484
+
485
+ write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_CACHESTAT_HIT_CHART);
486
+ for (w = root; w; w = w->next) {
487
+ if (unlikely(w->exposed && w->processes)) {
488
+ value = (collected_number) w->cachestat.hit;
489
+ write_chart_dimension(w->name, value);
490
+ }
491
+ }
492
+ write_end_chart();
493
+
494
+ write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_CACHESTAT_MISSES_CHART);
495
+ for (w = root; w; w = w->next) {
496
+ if (unlikely(w->exposed && w->processes)) {
497
+ value = (collected_number) w->cachestat.miss;
498
+ write_chart_dimension(w->name, value);
499
+ }
500
+ }
501
+ write_end_chart();
502
+}
503
+
504
+/**
505
+* Main loop for this collector.
506
+*/
507
+static void cachestat_collector(ebpf_module_t *em)
508
+{
509
+ cachestat_threads.thread = mallocz(sizeof(netdata_thread_t));
510
+ cachestat_threads.start_routine = ebpf_cachestat_read_hash;
511
+
512
+ map_fd = cachestat_data.map_fd;
513
+
514
+ netdata_thread_create(cachestat_threads.thread, cachestat_threads.name, NETDATA_THREAD_OPTION_JOINABLE,
515
+ ebpf_cachestat_read_hash, em);
516
+
517
+ netdata_publish_cachestat_t publish;
518
+ memset(&publish, 0, sizeof(publish));
519
+ int apps = em->apps_charts;
520
+ while (!close_ebpf_plugin) {
521
+ pthread_mutex_lock(&collect_data_mutex);
522
+ pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex);
523
+
524
+ pthread_mutex_lock(&lock);
525
+
526
+ cachestat_send_global(&publish);
527
+
528
+ if (apps)
529
+ ebpf_cache_send_apps_data(apps_groups_root_target);
530
+
531
+ pthread_mutex_unlock(&lock);
532
+ pthread_mutex_unlock(&collect_data_mutex);
533
+ }
534
+}
535
+
536
+/*****************************************************************
537
+ *
538
+ * INITIALIZE THREAD
539
+ *
540
+ *****************************************************************/
541
+
542
+/**
543
+ * Create global charts
544
+ *
545
+ * Call ebpf_create_chart to create the charts for the collector.
546
+ */
547
+static void ebpf_create_memory_charts()
548
+{
549
+ ebpf_create_chart(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_RATIO_CHART,
550
+ "Hit is calculating using total cache added without dirties per total added because of red misses.",
551
+ EBPF_CACHESTAT_DIMENSION_HITS, NETDATA_CACHESTAT_SUBMENU,
552
+ NULL,
553
+ 21100,
554
+ ebpf_create_global_dimension,
555
+ cachestat_counter_publish_aggregated, 1);
556
+
557
+ ebpf_create_chart(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_DIRTY_CHART,
558
+ "Number of dirty pages added to the page cache.",
559
+ EBPF_CACHESTAT_DIMENSION_PAGE, NETDATA_CACHESTAT_SUBMENU,
560
+ NULL,
561
+ 21101,
562
+ ebpf_create_global_dimension,
563
+ &cachestat_counter_publish_aggregated[NETDATA_CACHESTAT_IDX_DIRTY], 1);
564
+
565
+ ebpf_create_chart(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_CHART,
566
+ "Hits are function calls that Netdata counts.",
567
+ EBPF_CACHESTAT_DIMENSION_HITS, NETDATA_CACHESTAT_SUBMENU,
568
+ NULL,
569
+ 21102,
570
+ ebpf_create_global_dimension,
571
+ &cachestat_counter_publish_aggregated[NETDATA_CACHESTAT_IDX_HIT], 1);
572
+
573
+ ebpf_create_chart(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_MISSES_CHART,
574
+ "Misses are function calls that Netdata counts.",
575
+ EBPF_CACHESTAT_DIMENSION_MISSES, NETDATA_CACHESTAT_SUBMENU,
576
+ NULL,
577
+ 21103,
578
+ ebpf_create_global_dimension,
579
+ &cachestat_counter_publish_aggregated[NETDATA_CACHESTAT_IDX_MISS], 1);
580
+
581
+ fflush(stdout);
582
+}
583
+
584
+/**
585
+ * Allocate vectors used with this thread.
586
+ *
587
+ * We are not testing the return, because callocz does this and shutdown the software
588
+ * case it was not possible to allocate.
589
+ *
590
+ * @param length is the length for the vectors used inside the collector.
591
+ */
592
+static void ebpf_cachestat_allocate_global_vectors(size_t length)
593
+{
594
+ cachestat_pid = callocz((size_t)pid_max, sizeof(netdata_publish_cachestat_t *));
595
+ cachestat_vector = callocz((size_t)ebpf_nprocs, sizeof(netdata_cachestat_pid_t));
596
+
597
+ cachestat_hash_values = callocz(length, sizeof(netdata_idx_t));
598
+
599
+ cachestat_counter_aggregated_data = callocz(length, sizeof(netdata_syscall_stat_t));
600
+ cachestat_counter_publish_aggregated = callocz(length, sizeof(netdata_publish_syscall_t));
601
+}
602
+
603
+/*****************************************************************
604
+ *
605
+ * MAIN THREAD
606
+ *
607
+ *****************************************************************/
608
+
609
+/**
610
+ * Cachestat thread
611
+ *
612
+ * Thread used to make cachestat thread
613
+ *
614
+ * @param ptr a pointer to `struct ebpf_module`
615
+ *
616
+ * @return It always return NULL
617
+ */
618
+void *ebpf_cachestat_thread(void *ptr)
619
+{
620
+ netdata_thread_cleanup_push(ebpf_cachestat_cleanup, ptr);
621
+
622
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
623
+ fill_ebpf_data(&cachestat_data);
624
+
625
+ if (!em->enabled)
626
+ goto endcachestat;
627
+
628
+ pthread_mutex_lock(&lock);
629
+ ebpf_cachestat_allocate_global_vectors(NETDATA_CACHESTAT_END);
630
+ if (ebpf_update_kernel(&cachestat_data)) {
631
+ pthread_mutex_unlock(&lock);
632
+ goto endcachestat;
633
+ }
634
+
635
+ probe_links = ebpf_load_program(ebpf_plugin_dir, em, kernel_string, &objects, cachestat_data.map_fd);
636
+ if (!probe_links) {
637
+ pthread_mutex_unlock(&lock);
638
+ goto endcachestat;
639
+ }
640
+
641
+ int algorithms[NETDATA_CACHESTAT_END] = {
642
+ NETDATA_EBPF_ABSOLUTE_IDX, NETDATA_EBPF_INCREMENTAL_IDX, NETDATA_EBPF_ABSOLUTE_IDX, NETDATA_EBPF_ABSOLUTE_IDX
643
+ };
644
+
645
+ ebpf_global_labels(cachestat_counter_aggregated_data, cachestat_counter_publish_aggregated,
646
+ cachestat_counter_dimension_name, cachestat_counter_dimension_name,
647
+ algorithms, NETDATA_CACHESTAT_END);
648
+
649
+ ebpf_create_memory_charts();
650
+
651
+ pthread_mutex_unlock(&lock);
652
+
653
+ cachestat_collector(em);
654
+
655
+endcachestat:
656
+ netdata_thread_cleanup_pop(1);
657
+ return NULL;
658
+}
collectors/ebpf.plugin/ebpf_cachestat.h
new
+63
@@ -0,0 +1,63 @@
1
+// SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+#ifndef NETDATA_EBPF_CACHESTAT_H
4
+#define NETDATA_EBPF_CACHESTAT_H 1
5
+
6
+#define NETDATA_EBPF_MEMORY_GROUP "mem"
7
+
8
+// charts
9
+#define NETDATA_CACHESTAT_HIT_RATIO_CHART "cachestat_ratio"
10
+#define NETDATA_CACHESTAT_DIRTY_CHART "cachestat_dirties"
11
+#define NETDATA_CACHESTAT_HIT_CHART "cachestat_hits"
12
+#define NETDATA_CACHESTAT_MISSES_CHART "cachestat_misses"
13
+
14
+#define NETDATA_CACHESTAT_SUBMENU "page cache"
15
+
16
+#define EBPF_CACHESTAT_DIMENSION_PAGE "pages/s"
17
+#define EBPF_CACHESTAT_DIMENSION_HITS "hits/s"
18
+#define EBPF_CACHESTAT_DIMENSION_MISSES "misses/s"
19
+
20
+#define NETDATA_LATENCY_CACHESTAT_SLEEP_MS 600000ULL
21
+
22
+// variables
23
+enum cachestat_counters {
24
+ NETDATA_KEY_CALLS_ADD_TO_PAGE_CACHE_LRU,
25
+ NETDATA_KEY_CALLS_MARK_PAGE_ACCESSED,
26
+ NETDATA_KEY_CALLS_ACCOUNT_PAGE_DIRTIED,
27
+ NETDATA_KEY_CALLS_MARK_BUFFER_DIRTY,
28
+
29
+ NETDATA_CACHESTAT_END
30
+};
31
+
32
+enum cachestat_indexes {
33
+ NETDATA_CACHESTAT_IDX_RATIO,
34
+ NETDATA_CACHESTAT_IDX_DIRTY,
35
+ NETDATA_CACHESTAT_IDX_HIT,
36
+ NETDATA_CACHESTAT_IDX_MISS
37
+};
38
+
39
+enum cachesta_tables {
40
+ NETDATA_CACHESTAT_GLOBAL_STATS,
41
+ NETDATA_CACHESTAT_PID_STATS
42
+};
43
+
44
+typedef struct netdata_publish_cachestat_pid {
45
+ uint64_t add_to_page_cache_lru;
46
+ uint64_t mark_page_accessed;
47
+ uint64_t account_page_dirtied;
48
+ uint64_t mark_buffer_dirty;
49
+} netdata_cachestat_pid_t;
50
+
51
+typedef struct netdata_publish_cachestat {
52
+ long long ratio;
53
+ long long dirty;
54
+ long long hit;
55
+ long long miss;
56
+
57
+ netdata_cachestat_pid_t current;
58
+ netdata_cachestat_pid_t prev;
59
+} netdata_publish_cachestat_t;
60
+
61
+extern void *ebpf_cachestat_thread(void *ptr);
62
+
63
+#endif // NETDATA_EBPF_CACHESTAT_H
packaging/ebpf.checksums
+3
-3
@@ -1,3 +1,3 @@
1
-d9c1c81fe3a8b9af7fc1174a28c16ddb24e2f3ff79e6beb1b2eb184bf0d2e8c0 netdata-kernel-collector-glibc-v0.5.5.tar.xz
2
-0e1dd5e12a58dda53576b2dab963cd26fa26fe2084d84c51becb9238d1055fc1 netdata-kernel-collector-musl-v0.5.5.tar.xz
3
-d6d65e5f40a83880aa7dd740829a7ffe6a0805637e1616805aebdff088a3fcb0 netdata-kernel-collector-static-v0.5.5.tar.xz
1
+5fd3d9e8bf15b97bcb1044cbca8b308ff191ba95885443c1dae633f2e46c1777 netdata-kernel-collector-glibc-v0.5.6.tar.xz
2
+459b0730a8eb86ea32f1ba4eee47ab434dad4a5b909363c5b71b98743e9927da netdata-kernel-collector-musl-v0.5.6.tar.xz
3
+0f0cbea80190fc105f45f2a6ddc4bd6ab23e8141bf6921cdd7f779380153bfea netdata-kernel-collector-static-v0.5.6.tar.xz
packaging/ebpf.version
+1
-1
@@ -1 +1 @@
1
-v0.5.5
1
+v0.5.6
web/gui/dashboard_info.js
+16
@@ -1010,6 +1010,22 @@ netdataDashboard.context = {
1010
info: 'Transparent HugePages (THP) is backing virtual memory with huge pages, supporting automatic promotion and demotion of page sizes. It works for all applications for anonymous memory mappings and tmpfs/shmem.'
1011
},
1012
1013
+ 'mem.cachestat_ratio': {
1014
+ info: 'When the processor needs to read or write a location in main memory, it checks for a corresponding entry in the page cache. If the entry is there, a page cache hit has occurred and the read is from the cache. If the entry is not there, a page cache miss has occurred and the kernel allocates a new entry and copies in data from the disk. Netdata calculates the percentage of accessed files that are cached on memory. <a href="https://github.com/iovisor/bcc/blob/master/tools/cachestat.py#L126-L138" target="_blank">The ratio</a> is calculated counting the accessed cached pages (without counting dirty pages and pages added because of read misses) divided by total access without dirty pages. The algorithm will not plot data when ratio is zero and our dashboard will interpolate the plot. '
1015
+ },
1016
+
1017
+ 'mem.cachestat_dirties': {
1018
+ info: 'Number of <a href="https://en.wikipedia.org/wiki/Page_cache#Memory_conservation" target="_blank">dirty(modified) pages</a> cache. Pages in the page cache modified after being brought in are called dirty pages. Since non-dirty pages in the page cache have identical copies in <a href="https://en.wikipedia.org/wiki/Secondary_storage" target="_blank">secondary storage</a> (e.g. hard disk drive or solid-state drive), discarding and reusing their space is much quicker than paging out application memory, and is often preferred over flushing the dirty pages into secondary storage and reusing their space.'
1019
+ },
1020
+
1021
+ 'mem.cachestat_hits': {
1022
+ info: 'When the processor needs to read or write a location in main memory, it checks for a corresponding entry in the page cache. If the entry is there, a page cache hit has occurred and the read is from the cache. Hits show pages accessed that were not modified (we are excluding dirty pages), this counting also excludes the recent pages inserted for read.'
1023
+ },
1024
+
1025
+ 'mem.cachestat_misses': {
1026
+ info: 'When the processor needs to read or write a location in main memory, it checks for a corresponding entry in the page cache. If the entry is not there, a page cache miss has occurred and the cache allocates a new entry and copies in data for the main memory. Misses count page insertions to the memory not related to writing.'
1027
+ },
1028
+
1029
// ------------------------------------------------------------------------
1030
// network interfaces
1031