X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Ftiming.h;h=0f8a982f4eee2e777c30c725e9f0bce6f39a1151;hp=605870163b12041e441845f6dcdc3817034f0604;hb=dd993ee2910a754d46b2223c06b09abdd61caceb;hpb=75c07fe53a0cf8bb2c138cb6d87cde84d3b8b6a6 diff --git a/include/yaz/timing.h b/include/yaz/timing.h index 6058701..0f8a982 100644 --- a/include/yaz/timing.h +++ b/include/yaz/timing.h @@ -1,5 +1,5 @@ -/* - * Copyright (c) 1995-2007, Index Data +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2011 Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -24,11 +24,11 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: timing.h,v 1.1 2007-01-03 13:46:17 adam Exp $ */ /** * \file timing.h - * \brief Timing Utilities + \brief Timing Utilities + */ #ifndef YAZ_TIMING_H @@ -38,20 +38,69 @@ YAZ_BEGIN_CDECL +/** \brief YAZ timing handle (opaque type) + */ typedef struct yaz_timing *yaz_timing_t; +/** \brief create timing handle + \returns timing handle + + \verbatim + yaz_timing_t my = yaz_timing_create(); + yaz_timing_start(my); + do_work(); + yaz_timing_stop(my); + + printf("real=%g user=%g sys=%g\n", + yaz_timing_get_real(my), + yaz_timing_get_user(my), + yaz_timing_get_sys(my)); + + yaz_timing_destroy(my); + + \endverbatim + */ YAZ_EXPORT yaz_timing_t yaz_timing_create(void); + +/** \brief start timer + \param t timing handle + */ YAZ_EXPORT void yaz_timing_start(yaz_timing_t t); + +/** \brief stop timer + \param t timing handle + + Use yaz_timing_get_real, yaz_timing_get_user and yaz_timing_get_sys + to fetch timing results. +*/ YAZ_EXPORT void yaz_timing_stop(yaz_timing_t t); + +/** \brief returns real time in seconds + \param t timing handle + \returns time in seconds +*/ YAZ_EXPORT double yaz_timing_get_real(yaz_timing_t t); + +/** \brief returns user time in seconds + \param t timing handle + \returns time in seconds +*/ YAZ_EXPORT double yaz_timing_get_user(yaz_timing_t t); + +/** \brief returns system time in seconds + \param t timing handle + \returns time in seconds +*/ YAZ_EXPORT double yaz_timing_get_sys(yaz_timing_t t); + +/** \brief destroys timing handle +*/ YAZ_EXPORT void yaz_timing_destroy(yaz_timing_t *tp); @@ -61,6 +110,7 @@ YAZ_END_CDECL /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab