- Main Page
- Modules
- Data Structures
- Files

# timer.h

    00001 /*************************************************************************
    00002  *                                                                       *
    00003  * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
    00004  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
    00005  *                                                                       *
    00006  * This library is free software; you can redistribute it and/or         *
    00007  * modify it under the terms of EITHER:                                  *
    00008  *   (1) The GNU Lesser General Public License as published by the Free  *
    00009  *       Software Foundation; either version 2.1 of the License, or (at  *
    00010  *       your option) any later version. The text of the GNU Lesser      *
    00011  *       General Public License is included with this library in the     *
    00012  *       file LICENSE.TXT.                                               *
    00013  *   (2) The BSD-style license that is included with this library in     *
    00014  *       the file LICENSE-BSD.TXT.                                       *
    00015  *                                                                       *
    00016  * This library is distributed in the hope that it will be useful,       *
    00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
    00019  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
    00020  *                                                                       *
    00021  *************************************************************************/
    00022
    00023 #ifndef _ODE_TIMER_H_
    00024 #define _ODE_TIMER_H_
    00025
    00026 #include <ode/config.h>
    00027
    00028 #ifdef __cplusplus
    00029 extern "C" {
    00030 #endif
    00031
    00032
    00033 /* stop watch objects */
    00034
    00035 typedef struct dStopwatch {
    00036   double time;       /* total clock count */
    00037   unsigned long cc[2];     /* clock count since last `start' */
    00038 } dStopwatch;
    00039
    00040 ODE_API void dStopwatchReset (dStopwatch *);
    00041 ODE_API void dStopwatchStart (dStopwatch *);
    00042 ODE_API void dStopwatchStop  (dStopwatch *);
    00043 ODE_API double dStopwatchTime (dStopwatch *);   /* returns total time in secs */
    00044
    00045
    00046 /* code timers */
    00047
    00048 ODE_API void dTimerStart (const char *description);   /* pass a static string here */
    00049 ODE_API void dTimerNow (const char *description);  /* pass a static string here */
    00050 ODE_API void dTimerEnd(void);
    00051
    00052 /* print out a timer report. if `average' is nonzero, print out the average
    00053  * time for each slot (this is only meaningful if the same start-now-end
    00054  * calls are being made repeatedly.
    00055  */
    00056 ODE_API void dTimerReport (FILE *fout, int average);
    00057
    00058
    00059 /* resolution */
    00060
    00061 /* returns the timer ticks per second implied by the timing hardware or API.
    00062  * the actual timer resolution may not be this great.
    00063  */
    00064 ODE_API double dTimerTicksPerSecond(void);
    00065
    00066 /* returns an estimate of the actual timer resolution, in seconds. this may
    00067  * be greater than 1/ticks_per_second.
    00068  */
    00069 ODE_API double dTimerResolution(void);
    00070
    00071
    00072 #ifdef __cplusplus
    00073 }
    00074 #endif
    00075
    00076 #endif