dnl Zebra, Index Data ApS, 1995-2006
-dnl $Id: configure.ac,v 1.43 2006-12-22 12:13:39 adam Exp $
+dnl $Id: configure.ac,v 1.44 2007-01-05 10:45:11 adam Exp $
dnl
AC_PREREQ(2.59)
AC_INIT([idzebra],[2.0.7],[zebra-help@indexdata.dk])
AM_PROG_LIBTOOL
dnl
dnl ------ headers
-AC_CHECK_HEADERS(sys/resource.h sys/times.h sys/time.h sys/wait.h sys/utsname.h unistd.h)
+AC_CHECK_HEADERS(sys/resource.h sys/time.h sys/wait.h sys/utsname.h unistd.h)
dnl ------ crypt
AC_CHECK_LIB(crypt, crypt)
if test "$ac_cv_lib_crypt_crypt" = "yes"; then
fi
dnl
dnl ------ YAZ
-YAZ_INIT($yazflag,2.1.40)
+YAZ_INIT($yazflag,2.1.45)
if test "$YAZVERSION" = "NONE"; then
AC_MSG_ERROR([YAZ development libraries required])
fi
-/* $Id: util.h,v 1.13 2006-12-22 13:48:20 adam Exp $
+/* $Id: util.h,v 1.14 2007-01-05 10:45:11 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
YAZ_EXPORT void zebra_exit(const char *msg);
-typedef struct zebra_timing *zebra_timing_t;
-
-YAZ_EXPORT
-zebra_timing_t zebra_timing_create(void);
-YAZ_EXPORT
-void zebra_timing_start(zebra_timing_t t);
-YAZ_EXPORT
-void zebra_timing_stop(zebra_timing_t t);
-YAZ_EXPORT
-double zebra_timing_get_real(zebra_timing_t t);
-YAZ_EXPORT
-double zebra_timing_get_user(zebra_timing_t t);
-YAZ_EXPORT
-double zebra_timing_get_sys(zebra_timing_t t);
-YAZ_EXPORT
-void zebra_timing_destroy(zebra_timing_t *tp);
-
YAZ_EXPORT zint atozint(const char *src);
YAZ_END_CDECL
-/* $Id: index.h,v 1.188 2006-12-22 12:14:25 adam Exp $
+/* $Id: index.h,v 1.189 2007-01-05 10:45:11 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#endif
#include <sys/stat.h>
+#include <yaz/timing.h>
#include <idzebra/dict.h>
#include <idzebra/isams.h>
#include <idzebra/isamc.h>
const char *path_root;
RecTypeClass record_classes;
NMEM nmem;
- zebra_timing_t timing;
+ yaz_timing_t timing;
};
-/* $Id: kinput.c,v 1.80 2006-12-06 22:52:38 adam Exp $
+/* $Id: kinput.c,v 1.81 2007-01-05 10:45:11 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Res res;
};
-#if 1
+#if 0
static void pkey(const char *b, int mode)
{
key_logdump_txt(YLOG_LOG, b, mode ? "i" : "d");
-/* $Id: zebraapi.c,v 1.240 2006-12-22 12:14:25 adam Exp $
+/* $Id: zebraapi.c,v 1.241 2007-01-05 10:45:12 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
}
}
- zh->timing = zebra_timing_create();
+ zh->timing = yaz_timing_create();
zh->path_root = res_get (zh->global_res, "root");
zh->nmem = nmem_create();
zh->record_classes = recTypeClass_create (zh->global_res, zh->nmem);
nmem_destroy(zs->nmem);
res_close (zs->global_res);
- zebra_timing_stop(zs->timing);
+ yaz_timing_stop(zs->timing);
yaz_log (YLOG_LOG, "zebra_stop: %4.2f %4.2f %4.2f",
- zebra_timing_get_real(zs->timing),
- zebra_timing_get_user(zs->timing),
- zebra_timing_get_sys(zs->timing));
+ yaz_timing_get_real(zs->timing),
+ yaz_timing_get_user(zs->timing),
+ yaz_timing_get_sys(zs->timing));
- zebra_timing_destroy(&zs->timing);
+ yaz_timing_destroy(&zs->timing);
xfree(zs);
return ZEBRA_OK;
}
-/* $Id: benchindex1.c,v 1.7 2006-12-12 17:33:35 adam Exp $
+/* $Id: benchindex1.c,v 1.8 2007-01-05 10:45:12 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#include <yaz/nmem.h>
#include <yaz/xmalloc.h>
#include <yaz/marcdisp.h>
+#include <yaz/timing.h>
#include <it_key.h>
#include <idzebra/isamb.h>
#include <idzebra/dict.h>
int no_words = 0, no_new_words = 0;
const char *dict_info = 0;
ISAM_P isamc_p = 0;
- zebra_timing_t tim_dict = 0;
- zebra_timing_t tim_isamb = 0;
+ yaz_timing_t tim_dict = 0;
+ yaz_timing_t tim_isamb = 0;
zint number_of_int_splits = isamb_get_int_splits(isb);
zint number_of_leaf_splits = isamb_get_leaf_splits(isb);
zint number_of_dict_splits = dict_get_no_split(dict);
assert(!t);
qsort(b->ar, b->no_entries, sizeof(*b->ar), cmp_ar);
- tim_dict = zebra_timing_create();
+ tim_dict = yaz_timing_create();
#if 0
for (i = 0; i < b->no_entries; i++)
{
}
dict_insert(dict, "_w", sizeof(word_id_seq), &word_id_seq);
- zebra_timing_stop(tim_dict);
- tim_isamb = zebra_timing_create();
+ yaz_timing_stop(tim_dict);
+ tim_isamb = yaz_timing_create();
b->current_entry = 0;
dict_insert(dict, "_i", sizeof(isamc_p), &isamc_p);
}
- zebra_timing_stop(tim_isamb);
+ yaz_timing_stop(tim_isamb);
number_of_int_splits = isamb_get_int_splits(isb) - number_of_int_splits;
number_of_leaf_splits = isamb_get_leaf_splits(isb) - number_of_leaf_splits;
"%6" ZINT_FORMAT0 " %6" ZINT_FORMAT0
" %8d %8d %6d %6d" " %5" ZINT_FORMAT0 "\n",
b->round,
- zebra_timing_get_real(tim_dict) + zebra_timing_get_real(tim_isamb),
- zebra_timing_get_real(tim_dict),
- zebra_timing_get_user(tim_dict),
- zebra_timing_get_sys(tim_dict),
- zebra_timing_get_real(tim_isamb),
- zebra_timing_get_user(tim_isamb),
- zebra_timing_get_sys(tim_isamb),
+ yaz_timing_get_real(tim_dict) + yaz_timing_get_real(tim_isamb),
+ yaz_timing_get_real(tim_dict),
+ yaz_timing_get_user(tim_dict),
+ yaz_timing_get_sys(tim_dict),
+ yaz_timing_get_real(tim_isamb),
+ yaz_timing_get_user(tim_isamb),
+ yaz_timing_get_sys(tim_isamb),
number_of_int_splits,
number_of_leaf_splits,
no_docs,
b->no_entries = 0;
b->terms = 0;
- zebra_timing_destroy(&tim_isamb);
- zebra_timing_destroy(&tim_dict);
+ yaz_timing_destroy(&tim_isamb);
+ yaz_timing_destroy(&tim_dict);
}
void index_block_check_flush(struct index_block *b, ISAMB isb, Dict dict,
int dict_cache_size = 50;
const char *fname = 0;
FILE *inf = stdin;
- zebra_timing_t tim = 0;
+ yaz_timing_t tim = 0;
zint docid_seq = 1;
const char *dict_info;
const char *type = "iso2709";
if (reset)
bf_reset(bfs);
- tim = zebra_timing_create();
+ tim = yaz_timing_create();
/* create isam handle */
isb_postings = isamb_open (bfs, "isamb", isam_cache_size ? 1 : 0,
&method_postings, 0);
fclose(inf);
/* exit block system */
bfs_destroy(bfs);
- zebra_timing_stop(tim);
+ yaz_timing_stop(tim);
printf("# Total timings real=%8.6f user=%3.2f system=%3.2f\n",
- zebra_timing_get_real(tim),
- zebra_timing_get_user(tim),
- zebra_timing_get_sys(tim));
+ yaz_timing_get_real(tim),
+ yaz_timing_get_user(tim),
+ yaz_timing_get_sys(tim));
- zebra_timing_destroy(&tim);
+ yaz_timing_destroy(&tim);
exit(0);
return 0;
-/* $Id: benchisamb.c,v 1.4 2006-12-11 10:02:14 adam Exp $
+/* $Id: benchisamb.c,v 1.5 2007-01-05 10:45:12 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#include <string.h>
#include <yaz/log.h>
#include <yaz/xmalloc.h>
+#include <yaz/timing.h>
#include <idzebra/isamb.h>
#include <assert.h>
for (round = 0; round < number_of_rounds; round++)
{
- zebra_timing_t t = zebra_timing_create();
+ yaz_timing_t t = yaz_timing_create();
- zebra_timing_start(t);
+ yaz_timing_start(t);
for (i = 0; i<number_of_trees; i++)
{
if (0)
isamb_dump(isb, isamc_p[i], log_pr);
}
- zebra_timing_stop(t);
+ yaz_timing_stop(t);
printf("%3d %8.6f %5.2f %5.2f\n",
round+1,
- zebra_timing_get_real(t),
- zebra_timing_get_user(t),
- zebra_timing_get_sys(t));
- zebra_timing_destroy(&t);
+ yaz_timing_get_real(t),
+ yaz_timing_get_user(t),
+ yaz_timing_get_sys(t));
+ yaz_timing_destroy(&t);
}
xfree(isamc_p);
}
int number_of_items = 1000;
int number_of_isams = 1000;
int extra_size = 0;
- zebra_timing_t t = 0;
+ yaz_timing_t t = 0;
while ((ret = options("z:r:n:i:", argv, argc, &arg)) != -2)
{
method.codec.reset = code_reset;
method.codec.stop = code_stop;
- t = zebra_timing_create();
+ t = yaz_timing_create();
- zebra_timing_start(t);
+ yaz_timing_start(t);
/* create block system */
bfs = bfs_create(0, 0);
/* exit block system */
bfs_destroy(bfs);
- zebra_timing_stop(t);
+ yaz_timing_stop(t);
printf("Total %8.6f %5.2f %5.2f\n",
- zebra_timing_get_real(t),
- zebra_timing_get_user(t),
- zebra_timing_get_sys(t));
- zebra_timing_destroy(&t);
+ yaz_timing_get_real(t),
+ yaz_timing_get_user(t),
+ yaz_timing_get_sys(t));
+ yaz_timing_destroy(&t);
exit(0);
return 0;
}
-## $Id: Makefile.am,v 1.30 2006-12-11 09:50:36 adam Exp $
+## $Id: Makefile.am,v 1.31 2007-01-05 10:45:13 adam Exp $
noinst_LTLIBRARIES = libidzebra-util.la
libidzebra_util_la_SOURCES = zint.c res.c charmap.c zebramap.c passwddb.c \
zebra-lock.c dirent.c xpath.c atoi_zn.c snippet.c flock.c attrfind.c \
- exit.c it_key.c su_codec.c timing.c
+ exit.c it_key.c su_codec.c
tstpass_SOURCES = tstpass.c
+++ /dev/null
-/* $Id: timing.c,v 1.1 2006-12-11 09:50:36 adam Exp $
- Copyright (C) 1995-2006
- Index Data ApS
-
-This file is part of the Zebra server.
-
-Zebra is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-*/
-
-#include <stdlib.h>
-
-#if HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#include <yaz/xmalloc.h>
-#include <idzebra/util.h>
-
-struct zebra_timing {
- struct tms tms1, tms2;
- struct timeval start_time, end_time;
- double real_sec, user_sec, sys_sec;
-};
-
-zebra_timing_t zebra_timing_create(void)
-{
- zebra_timing_t t = xmalloc(sizeof(*t));
- zebra_timing_start(t);
- return t;
-}
-
-void zebra_timing_start(zebra_timing_t t)
-{
-#if HAVE_SYS_TIMES_H
-#if HAVE_SYS_TIME_H
- times(&t->tms1);
- gettimeofday(&t->start_time, 0);
-#endif
-#endif
- t->real_sec = -1.0;
- t->user_sec = -1.0;
- t->sys_sec = -1.0;
-}
-
-void zebra_timing_stop(zebra_timing_t t)
-{
- t->real_sec = 0.0;
- t->user_sec = 0.0;
- t->sys_sec = 0.0;
-#if HAVE_SYS_TIMES_H
-#if HAVE_SYS_TIME_H
- gettimeofday(&t->end_time, 0);
- times(&t->tms2);
-
- t->real_sec = ((t->end_time.tv_sec - t->start_time.tv_sec) * 1000000.0 +
- t->end_time.tv_usec - t->start_time.tv_usec) / 1000000;
-
- t->user_sec = (double) (t->tms2.tms_utime - t->tms1.tms_utime)/100;
- t->sys_sec = (double) (t->tms2.tms_stime - t->tms1.tms_stime)/100;
-#endif
-#endif
-}
-
-double zebra_timing_get_real(zebra_timing_t t)
-{
- return t->real_sec;
-}
-
-double zebra_timing_get_user(zebra_timing_t t)
-{
- return t->user_sec;
-}
-
-double zebra_timing_get_sys(zebra_timing_t t)
-{
- return t->sys_sec;
-}
-
-void zebra_timing_destroy(zebra_timing_t *tp)
-{
- if (*tp)
- {
- xfree(*tp);
- *tp = 0;
- }
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-