X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Ftiming.h;h=d493cf1531ccb3ae86e770255027e28851c10514;hp=faa83647b7a172f61c37165f74db64a5e667cf18;hb=7fe4b7de2eb91fc87a5c53ff081b15df0c449a0a;hpb=2788a4851b551e1a3efb320a2878b809f2d8a9d7 diff --git a/include/yaz/timing.h b/include/yaz/timing.h index faa8364..d493cf1 100644 --- a/include/yaz/timing.h +++ b/include/yaz/timing.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data. + * Copyright (C) 1995-2013 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: @@ -27,7 +27,8 @@ /** * \file timing.h - * \brief Timing Utilities + \brief Timing Utilities + */ #ifndef YAZ_TIMING_H @@ -37,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); @@ -60,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