about summary refs log tree commit diff
path: root/nscd/nscd_stat.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-26 18:35:05 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-26 18:35:05 +0000
commita95a08b4af38992cbcf3d1da97199ef19528fbde (patch)
tree669bba61a337bf8b9c9c15857877bc589792435c /nscd/nscd_stat.c
parent1114ffff54dfbd35cbff9c845376b8221c2c9ced (diff)
downloadglibc-a95a08b4af38992cbcf3d1da97199ef19528fbde.tar.gz
glibc-a95a08b4af38992cbcf3d1da97199ef19528fbde.tar.xz
glibc-a95a08b4af38992cbcf3d1da97199ef19528fbde.zip
Update.
2004-08-26  Ulrich Drepper  <drepper@redhat.com>

	* nscd/cache.c: Major rewrite.  The data is now optionally kept in
	a mmaped memory region which is automatically mirrored on disk.
	This implements persistent data storage.  The Memory handled
	needed to be completely revamped, it now uses a garbage collection
	mechanism instead of malloc.
	* nscd/connections.c: Likewise.
	* nscd/nscd.c: Likewise.
	* nscd/nscd.h: Likewise.
	* nscd/nscd_conf.c: Likewise.
	* nscd/nscd_stat.c: Likewise.
	* nscd/grpcache.c: Likewise.
	* nscd/hstcache.c:: Likewise.
	* nscd/pwdcache.c:: Likewise.
	* nscd/Makefile: Add rules to build mem.c.
	* nscd/mem.c: New file.
	* nscd/nscd.conf: Describe new configuration options.
Diffstat (limited to 'nscd/nscd_stat.c')
-rw-r--r--nscd/nscd_stat.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c
index f04e1972b5..30f427bd20 100644
--- a/nscd/nscd_stat.c
+++ b/nscd/nscd_stat.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <error.h>
+#include <inttypes.h>
 #include <langinfo.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -42,17 +43,21 @@ struct dbstat
   unsigned long int postimeout;
   unsigned long int negtimeout;
 
-  unsigned long int poshit;
-  unsigned long int neghit;
-  unsigned long int posmiss;
-  unsigned long int negmiss;
+  size_t nentries;
+  size_t maxnentries;
+  size_t maxnsearched;
+  size_t datasize;
+  size_t dataused;
 
-  unsigned long int nentries;
-  unsigned long int maxnentries;
-  unsigned long int maxnsearched;
+  uintmax_t poshit;
+  uintmax_t neghit;
+  uintmax_t posmiss;
+  uintmax_t negmiss;
 
-  unsigned long int rdlockdelayed;
-  unsigned long int wrlockdelayed;
+  uintmax_t rdlockdelayed;
+  uintmax_t wrlockdelayed;
+
+  uintmax_t addfailed;
 };
 
 /* Record for transmitting statistics.  */
@@ -68,7 +73,7 @@ struct statdata
 
 
 void
-send_stats (int fd, struct database dbs[lastdb])
+send_stats (int fd, struct database_dyn dbs[lastdb])
 {
   struct statdata data;
   int cnt;
@@ -83,18 +88,21 @@ send_stats (int fd, struct database dbs[lastdb])
     {
       data.dbs[cnt].enabled = dbs[cnt].enabled;
       data.dbs[cnt].check_file = dbs[cnt].check_file;
-      data.dbs[cnt].module = dbs[cnt].module;
+      data.dbs[cnt].module = dbs[cnt].head->module;
       data.dbs[cnt].postimeout = dbs[cnt].postimeout;
       data.dbs[cnt].negtimeout = dbs[cnt].negtimeout;
-      data.dbs[cnt].poshit = dbs[cnt].poshit;
-      data.dbs[cnt].neghit = dbs[cnt].neghit;
-      data.dbs[cnt].posmiss = dbs[cnt].posmiss;
-      data.dbs[cnt].negmiss = dbs[cnt].negmiss;
-      data.dbs[cnt].nentries = dbs[cnt].nentries;
-      data.dbs[cnt].maxnentries = dbs[cnt].maxnentries;
-      data.dbs[cnt].maxnsearched = dbs[cnt].maxnsearched;
-      data.dbs[cnt].rdlockdelayed = dbs[cnt].rdlockdelayed;
-      data.dbs[cnt].wrlockdelayed = dbs[cnt].wrlockdelayed;
+      data.dbs[cnt].poshit = dbs[cnt].head->poshit;
+      data.dbs[cnt].neghit = dbs[cnt].head->neghit;
+      data.dbs[cnt].posmiss = dbs[cnt].head->posmiss;
+      data.dbs[cnt].negmiss = dbs[cnt].head->negmiss;
+      data.dbs[cnt].nentries = dbs[cnt].head->nentries;
+      data.dbs[cnt].maxnentries = dbs[cnt].head->maxnentries;
+      data.dbs[cnt].datasize = dbs[cnt].head->data_size;
+      data.dbs[cnt].dataused = dbs[cnt].head->first_free;
+      data.dbs[cnt].maxnsearched = dbs[cnt].head->maxnsearched;
+      data.dbs[cnt].rdlockdelayed = dbs[cnt].head->rdlockdelayed;
+      data.dbs[cnt].wrlockdelayed = dbs[cnt].head->wrlockdelayed;
+      data.dbs[cnt].addfailed = dbs[cnt].head->addfailed;
     }
 
   if (TEMP_FAILURE_RETRY (write (fd, &data, sizeof (data))) != sizeof (data))
@@ -220,22 +228,26 @@ receive_print_stats (void)
 
       printf (_("\n%s cache:\n\n"
 		"%15s  cache is enabled\n"
-		"%15Zu  suggested size\n"
+		"%15zu  suggested size\n"
+		"%15zu  total data pool size\n"
+		"%15zu  used data pool size\n"
 		"%15lu  seconds time to live for positive entries\n"
 		"%15lu  seconds time to live for negative entries\n"
-		"%15lu  cache hits on positive entries\n"
-		"%15lu  cache hits on negative entries\n"
-		"%15lu  cache misses on positive entries\n"
-		"%15lu  cache misses on negative entries\n"
+		"%15" PRIuMAX "  cache hits on positive entries\n"
+		"%15" PRIuMAX "  cache hits on negative entries\n"
+		"%15" PRIuMAX "  cache misses on positive entries\n"
+		"%15" PRIuMAX "  cache misses on negative entries\n"
 		"%15lu%% cache hit rate\n"
-		"%15lu  current number of cached values\n"
-		"%15lu  maximum number of cached values\n"
-		"%15lu  maximum chain length searched\n"
-		"%15lu  number of delays on rdlock\n"
-		"%15lu  number of delays on wrlock\n"
+		"%15zu  current number of cached values\n"
+		"%15zu  maximum number of cached values\n"
+		"%15zu  maximum chain length searched\n"
+		"%15" PRIuMAX "  number of delays on rdlock\n"
+		"%15" PRIuMAX "  number of delays on wrlock\n"
+		"%15" PRIuMAX "  memory allocations failed\n"
 		"%15s  check /etc/%s for changes\n"),
 	      dbnames[i], enabled,
 	      data.dbs[i].module,
+	      data.dbs[i].datasize, data.dbs[i].dataused,
 	      data.dbs[i].postimeout, data.dbs[i].negtimeout,
 	      data.dbs[i].poshit, data.dbs[i].neghit,
 	      data.dbs[i].posmiss, data.dbs[i].negmiss,
@@ -243,7 +255,8 @@ receive_print_stats (void)
 	      data.dbs[i].nentries, data.dbs[i].maxnentries,
 	      data.dbs[i].maxnsearched,
 	      data.dbs[i].rdlockdelayed,
-	      data.dbs[i].wrlockdelayed, check_file, dbnames[i]);
+	      data.dbs[i].wrlockdelayed,
+	      data.dbs[i].addfailed, check_file, dbnames[i]);
     }
 
   close (fd);