glucat  0.12.0
timing.h
Go to the documentation of this file.
1 #ifndef GLUCAT_TEST_TIMING_H
2 #define GLUCAT_TEST_TIMING_H
3 /***************************************************************************
4  GluCat : Generic library of universal Clifford algebra templates
5  timing.h : Common definitions for timing tests
6  -------------------
7  begin : Tue 2012-03-27
8  copyright : (C) 2012 by Paul C. Leopardi
9  ***************************************************************************
10 
11  This library is free software: you can redistribute it and/or modify
12  it under the terms of the GNU Lesser General Public License as published
13  by the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public License
22  along with this library. If not, see <http://www.gnu.org/licenses/>.
23 
24  ***************************************************************************
25  This library is based on a prototype written by Arvind Raja and was
26  licensed under the LGPL with permission of the author. See Arvind Raja,
27  "Object-oriented implementations of Clifford algebras in C++: a prototype",
28  in Ablamowicz, Lounesto and Parra (eds.)
29  "Clifford algebras with numeric and symbolic computations", Birkhauser, 1996.
30  ***************************************************************************
31  See also Arvind Raja's original header comments in glucat.h
32  ***************************************************************************/
33 
34 namespace glucat
35 {
36  namespace timing
37  {
39  const double MS_PER_SEC = 1000.0;
40 
42  const double MS_PER_CLOCK = MS_PER_SEC / double(CLOCKS_PER_SEC);
43 
45  const int EXTRA_TRIALS = 2;
46 
48  inline
49  static
50  double
51  elapsed(clock_t cpu_time)
52  { return double(clock() - cpu_time) * MS_PER_CLOCK; }
53 
54  }
55 }
56 #endif // GLUCAT_TEST_TIMING_H
static double elapsed(clock_t cpu_time)
Elapsed time in milliseconds.
Definition: timing.h:51
const double MS_PER_SEC
Timing constant: milliseconds per second.
Definition: timing.h:39
const int EXTRA_TRIALS
Timing constant: trial expansion factor.
Definition: timing.h:45
const double MS_PER_CLOCK
Timing constant: milliseconds per clock.
Definition: timing.h:42