dovecot-1.2: Sending SIGUSR2 to dovecot-auth now also logs stati...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jan 21 22:48:55 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/85476be1fee2
changeset: 8670:85476be1fee2
user: Timo Sirainen <tss at iki.fi>
date: Wed Jan 21 15:48:51 2009 -0500
description:
Sending SIGUSR2 to dovecot-auth now also logs statistics about cache inserts.
diffstat:
1 file changed, 18 insertions(+), 1 deletion(-)
src/auth/auth-cache.c | 19 ++++++++++++++++++-
diffs (44 lines):
diff -r 14b9a90eb01d -r 85476be1fee2 src/auth/auth-cache.c
--- a/src/auth/auth-cache.c Wed Jan 21 12:40:06 2009 -0500
+++ b/src/auth/auth-cache.c Wed Jan 21 15:48:51 2009 -0500
@@ -19,6 +19,8 @@ struct auth_cache {
unsigned int ttl_secs, neg_ttl_secs;
unsigned int hit_count, miss_count;
+ unsigned int pos_entries, neg_entries;
+ unsigned long long pos_size, neg_size;
};
char *auth_cache_parse_key(pool_t pool, const char *query)
@@ -108,8 +110,15 @@ static void sig_auth_cache_stats(int sig
cache->hit_count, total_count,
total_count == 0 ? 100 : (cache->hit_count * 100 / total_count));
- /* reset hit counter */
+ i_info("Authentication cache inserts: "
+ "positive: %u %lluB, negative: %u %lluB",
+ cache->pos_entries, cache->pos_size,
+ cache->neg_entries, cache->neg_size);
+
+ /* reset counters */
cache->hit_count = cache->miss_count = 0;
+ cache->pos_entries = cache->neg_entries = 0;
+ cache->pos_size = cache->neg_size = 0;
}
struct auth_cache *auth_cache_new(size_t max_size, unsigned int ttl_secs,
@@ -249,6 +258,14 @@ void auth_cache_insert(struct auth_cache
cache->size_left -= alloc_size;
hash_table_insert(cache->hash, node->data, node);
+
+ if (*value != '\0') {
+ cache->pos_entries++;
+ cache->pos_size += alloc_size;
+ } else {
+ cache->neg_entries++;
+ cache->neg_size += alloc_size;
+ }
}
void auth_cache_remove(struct auth_cache *cache,
More information about the dovecot-cvs
mailing list