-/* $Id: dict-p.h,v 1.7 2006-08-29 11:28:42 adam Exp $
+/* $Id: dict-p.h,v 1.8 2006-12-12 13:42:24 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Dict_BFile dbf;
const char **(*grep_cmap)(void *vp, const char **from, int len);
void *grep_cmap_data;
+ /** number of split page operations, since dict_open */
+ zint no_split;
+ /** number of insert operations, since dict_open */
+ zint no_insert;
+ /** number of lookup operations, since dict_open */
+ zint no_lookup;
struct Dict_head head;
};
-/* $Id: insert.c,v 1.29 2006-11-14 12:04:38 adam Exp $
+/* $Id: insert.c,v 1.30 2006-12-12 13:42:24 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Dict_char prev_char = 0;
int best_no = -1, no_current = 1;
+ dict->no_split++;
/* determine splitting char... */
indxp = (short*) ((char*) p+DICT_bsize(p)-sizeof(short));
for (i = DICT_nodir (p); --i >= 0; --indxp)
{
if (!dict->rw)
return -1;
+ dict->no_insert++;
if (!dict->head.root)
{
void *p;
-/* $Id: lookup.c,v 1.15 2006-08-14 10:40:09 adam Exp $
+/* $Id: lookup.c,v 1.16 2006-12-12 13:42:24 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
char *dict_lookup (Dict dict, const char *p)
{
+ dict->no_lookup++;
if (!dict->head.root)
return NULL;
return dict_look (dict, (const Dict_char *) p, dict->head.root);
-/* $Id: open.c,v 1.27 2006-09-11 22:57:54 adam Exp $
+/* $Id: open.c,v 1.28 2006-12-12 13:42:24 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
}
dict->dbf = dict_bf_open (bfs, name, page_size, cache, rw);
dict->rw = rw;
+ dict->no_split = 0;
+ dict->no_insert = 0;
+ dict->no_lookup = 0;
if(!dict->dbf)
{
{
return strlen((const char *) s);
}
+
+zint dict_get_no_lookup(Dict dict)
+{
+ return dict->no_lookup;
+}
+
+zint dict_get_no_insert(Dict dict)
+{
+ return dict->no_insert;
+}
+
+zint dict_get_no_split(Dict dict)
+{
+ return dict->no_split;
+}
+
/*
* Local variables:
* c-basic-offset: 4
-/* $Id: dict.h,v 1.12 2006-09-11 22:57:54 adam Exp $
+/* $Id: dict.h,v 1.13 2006-12-12 13:42:23 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
YAZ_EXPORT
void dict_clean(Dict dict);
+/** \brief get number of lookup operations, since dict_open
+ \param dict dictionary handle
+ \returns number of operatons
+*/
+YAZ_EXPORT
+zint dict_get_no_lookup(Dict dict);
+
+/** \brief get number of insert operations, since dict_open
+ \param dict dictionary handle
+ \returns number of operatons
+*/
+YAZ_EXPORT
+zint dict_get_no_insert(Dict dict);
+
+/** \brief get number of page split operations, since dict_open
+ \param dict dictionary handle
+ \returns number of operatons
+*/
+YAZ_EXPORT
+zint dict_get_no_split(Dict dict);
YAZ_END_CDECL