mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 06:30:30 +00:00
mmap-cache: add some stats about files/windows/unused
Let's give some visibility into the ratio of files:windows:unused by the time we're done using the cache.
This commit is contained in:
@@ -435,8 +435,8 @@ found:
|
||||
void mmap_cache_stats_log_debug(MMapCache *m) {
|
||||
assert(m);
|
||||
|
||||
log_debug("mmap cache statistics: %u category cache hit, %u window list hit, %u miss",
|
||||
m->n_category_cache_hit, m->n_window_list_hit, m->n_missed);
|
||||
log_debug("mmap cache statistics: %u category cache hit, %u window list hit, %u miss, %u files, %u windows, %u unused",
|
||||
m->n_category_cache_hit, m->n_window_list_hit, m->n_missed, hashmap_size(m->fds), m->n_windows, m->n_unused);
|
||||
}
|
||||
|
||||
static void mmap_cache_process_sigbus(MMapCache *m) {
|
||||
|
||||
@@ -2542,6 +2542,10 @@ _public_ void sd_journal_close(sd_journal *j) {
|
||||
|
||||
sd_journal_flush_matches(j);
|
||||
|
||||
/* log stats before closing files so we can see the windows state */
|
||||
if (j->mmap)
|
||||
mmap_cache_stats_log_debug(j->mmap);
|
||||
|
||||
ordered_hashmap_free_with_destructor(j->files, journal_file_close);
|
||||
iterated_cache_free(j->files_cache);
|
||||
|
||||
@@ -2553,10 +2557,8 @@ _public_ void sd_journal_close(sd_journal *j) {
|
||||
|
||||
safe_close(j->inotify_fd);
|
||||
|
||||
if (j->mmap) {
|
||||
mmap_cache_stats_log_debug(j->mmap);
|
||||
if (j->mmap)
|
||||
mmap_cache_unref(j->mmap);
|
||||
}
|
||||
|
||||
hashmap_free_free(j->errors);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user