1 /*************************************************************************
2  *                          D bindings for ODE                           *
3  *                                                                       *
4  *       C header port by Daniel "q66" Kolesa <quaker66@gmail.com>       *
5  *                                                                       *
6  * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
7  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
8  *                                                                       *
9  * This library is free software; you can redistribute it and/or         *
10  * modify it under the terms of EITHER:                                  *
11  *   (1) The GNU Lesser General Public License as published by the Free  *
12  *       Software Foundation; either version 2.1 of the License, or (at  *
13  *       your option) any later version. The text of the GNU Lesser      *
14  *       General Public License is included with this library in the     *
15  *       file LICENSE.TXT.                                               *
16  *   (2) The BSD-style license that is included with this library in     *
17  *       the file LICENSE-BSD.TXT.                                       *
18  *                                                                       *
19  * This library is distributed in the hope that it will be useful,       *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
22  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
23  *                                                                       *
24  *************************************************************************/
25 
26 module deimos.ode.timer;
27 
28 private import deimos.ode.odeconfig;
29 private import core.stdc.stdio: FILE;
30 
31 extern (C):
32 nothrow:
33 
34 /* stop watch objects */
35 
36 struct dStopwatch
37 {
38     double time;
39     c_ulong[2] cc;
40 }
41 
42 void dStopwatchReset (dStopwatch*);
43 void dStopwatchStart (dStopwatch*);
44 void dStopwatchStop  (dStopwatch*);
45 double dStopwatchTime(dStopwatch*); /* returns total time in secs */
46 
47 
48 /* code timers */
49 
50 void dTimerStart(const(char)* description);    /* pass a static string here */
51 void dTimerNow  (const(char)* description);    /* pass a static string here */
52 void dTimerEnd();
53 
54 /* print out a timer report. if `average' is nonzero, print out the average
55  * time for each slot (this is only meaningful if the same start-now-end
56  * calls are being made repeatedly.
57  */
58 void dTimerReport(FILE* fout, int average);
59 
60 
61 /* resolution */
62 
63 /* returns the timer ticks per second implied by the timing hardware or API.
64  * the actual timer resolution may not be this great.
65  */
66 double dTimerTicksPerSecond();
67 
68 /* returns an estimate of the actual timer resolution, in seconds. this may
69  * be greater than 1/ticks_per_second.
70  */
71 double dTimerResolution();