summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-12-06 00:16:17 -0800
committerLennart Poettering <lennart@poettering.net>2020-12-10 10:23:01 +0100
commit073f50a099353c783a7aad47e9b5f419327ef6ef (patch)
tree401a5c5b62b5166db1e86b004bc44e43a9069821
parent6bfbfce795e42c758e3ffc4d744c8b2a9a1da2b5 (diff)
downloadsystemd-073f50a099353c783a7aad47e9b5f419327ef6ef.tar.gz
mmap-cache: separate context and window list cache hit accounting
Account and log these statistics separately since their overheads are potentially quite different when the window lists are large. There should probably be a histogram of window list traversal counts too.
-rw-r--r--src/journal/mmap-cache.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 14e45864a9..788b232114 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -57,7 +57,7 @@ struct MMapCache {
unsigned n_ref;
unsigned n_windows;
- unsigned n_hit, n_missed;
+ unsigned n_context_cache_hit, n_window_list_hit, n_missed;
Hashmap *fds;
Context *contexts[MMAP_CACHE_MAX_CONTEXTS];
@@ -520,14 +520,14 @@ int mmap_cache_get(
/* Check whether the current context is the right one already */
r = try_context(m, f, prot, context, keep_always, offset, size, ret, ret_size);
if (r != 0) {
- m->n_hit++;
+ m->n_context_cache_hit++;
return r;
}
/* Search for a matching mmap */
r = find_mmap(m, f, prot, context, keep_always, offset, size, ret, ret_size);
if (r != 0) {
- m->n_hit++;
+ m->n_window_list_hit++;
return r;
}
@@ -540,7 +540,7 @@ int mmap_cache_get(
void mmap_cache_stats_log_debug(MMapCache *m) {
assert(m);
- log_debug("mmap cache statistics: %u hit, %u miss", m->n_hit, m->n_missed);
+ log_debug("mmap cache statistics: %u context cache hit, %u window list hit, %u miss", m->n_context_cache_hit, m->n_window_list_hit, m->n_missed);
}
static void mmap_cache_process_sigbus(MMapCache *m) {