Loading [MathJax]/extensions/tex2jax.js
mbsim  4.0.0
MBSim Kernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
stopwatch.h
1/* Copyright (C) 2004-2009 MBSim Development Team
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * Contact: martin.o.foerg@googlemail.com
17 */
18
19#ifndef _STOPWATCH_H_
20#define _STOPWATCH_H_
21
29#ifdef HAVE_SYS_TIME_H
30struct timeval;
31#endif
32
33namespace MBSim {
34
35 class StopWatch {
36
37 protected:
38
39#ifdef HAVE_SYS_TIME_H
40 timeval *begin_tv;
41 timeval *end_tv;
42#else
43 double begin_d;
44 double end_d;
45#endif
46
47 public:
48 StopWatch();
49 ~StopWatch();
50
51 /* \brief starts timer */
52 void start();
53 /* \brief stops timer and returns enclosed time
54 * \param reset if flag = true clock is reseted
55 */
56 double stop(bool reset=true);
57
58 };
59}
60#endif
61
Definition: stopwatch.h:35
namespace MBSim
Definition: bilateral_constraint.cc:30