From 1deca02b41aae9bf2632ea1420cc900fcf41531d Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 12 Oct 2000 13:40:55 +0000 Subject: Added some stat stuff. 2000-10-12 Not Zed * index.h: Added some stat stuff. * wordindex.c (struct _wordcache): Changed files[] to be a pointer to an allocated block/or an individual item. (find): Fix for changes to struct. (find_name): " (sync_cache_entry): " (add): " (add_list): " (add_index_cache): Free the cache file array if it was created. (word_flush): And here. (word_close): And here too. (ibex_create_word_index): Double the size of the hashtables. (word_flush): Make sure we reset the wordcount to 0 if we remove the list items. DOH. (add_index_cache): Use a slightly more sohpisticated aging algorithm to remove expired nodes. 2000-10-10 Not Zed * hash.c (hash_find): (hash_remove): (hash_insert): Truncate key if it is too big to fit in a single block to MAX_KEYLEN bytes. svn path=/trunk/; revision=5882 --- libibex/block.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libibex/block.c') diff --git a/libibex/block.c b/libibex/block.c index d971077dba..6f6cd60657 100644 --- a/libibex/block.c +++ b/libibex/block.c @@ -38,6 +38,7 @@ #define d(x) /*#define DEBUG*/ +int block_log; #ifdef IBEX_STATS static void @@ -202,6 +203,9 @@ ibex_block_dirty(struct _block *block) static void sync_block(struct _memcache *block_cache, struct _memblock *memblock) { + if (block_log) + printf("writing block %d\n", memblock->block); + lseek(block_cache->fd, memblock->block, SEEK_SET); if (write(block_cache->fd, &memblock->data, sizeof(memblock->data)) != -1) { memblock->flags &= ~BLOCK_DIRTY; @@ -324,6 +328,9 @@ ibex_block_read(struct _memcache *block_cache, blockid_t blockid) add_miss(block_cache, blockid); add_read(block_cache, blockid); #endif + if (block_log) + printf("miss block %d\n", blockid); + d(printf("loading blockid from disk %d\n", blockid)); memblock = g_malloc(sizeof(*memblock)); memblock->block = blockid; @@ -345,6 +352,8 @@ ibex_block_read(struct _memcache *block_cache, blockid_t blockid) struct _memblock *rootblock = g_hash_table_lookup(block_cache->index, (void *)0); struct _root *root = (struct _root *)&rootblock->data; + printf("Unsyncing root block\n"); + g_assert(rootblock != NULL); root->flags &= ~IBEX_ROOT_SYNCF; sync_block(block_cache, rootblock); -- cgit