From bcb0290ae544bcd535451dc4d16b66a5952f17bf Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 28 Apr 2016 20:16:30 +0200 Subject: [PATCH hurd 2/2] libdiskfs: nodecache introspection hack --- libdiskfs/node-cache.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libdiskfs/node-cache.c b/libdiskfs/node-cache.c index ee7e6fd..6c65682 100644 --- a/libdiskfs/node-cache.c +++ b/libdiskfs/node-cache.c @@ -60,6 +60,18 @@ static struct hurd_ihash nodecache = hash, compare); static pthread_rwlock_t nodecache_lock = PTHREAD_RWLOCK_INITIALIZER; +char * +nodecache_hack (void) +{ + static char *dbg; + free (dbg); + if (asprintf (&dbg, "(nodehash load: %db%%, effective load: %db%%)", + hurd_ihash_get_load (&nodecache), + hurd_ihash_get_effective_load (&nodecache)) < 0) + dbg = NULL; + return dbg; +} + /* Fetch inode INUM, set *NPP to the node structure; gain one user reference and lock the node. */ error_t __attribute__ ((weak)) -- 2.1.4