X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmisc%2Fstopwatch.hxx;h=34364387c21e54d91f2e046a8423367d1ab92716;hb=e4e31be7d43569a92a5d9fa7e784381b66cbd95a;hp=f901939302bf5731357924f70c4f09c4c9ae99ff;hpb=5173d709e090b953eaf800cbcd1bf897de332a12;p=simgear.git diff --git a/simgear/misc/stopwatch.hxx b/simgear/misc/stopwatch.hxx index f9019393..34364387 100644 --- a/simgear/misc/stopwatch.hxx +++ b/simgear/misc/stopwatch.hxx @@ -1,27 +1,33 @@ -/*************************************************************************** - * stopwatch.hxx Timer class, for use in benchmarking - * +/** + * \file stopwatch.hxx + * Timer class, for use in benchmarking * Based on blitz/Timer.h * - * $Id$ - * * Copyright (C) 1997,1998 Todd Veldhuizen * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * * Suggestions: blitz-suggest@cybervision.com * Bugs: blitz-bugs@cybervision.com * * For more information, please see the Blitz++ Home Page: * http://seurat.uwaterloo.ca/blitz/ + */ + +/* + * $Id$ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -32,12 +38,12 @@ #ifndef _STOPWATCH_HXX #define _STOPWATCH_HXX -#ifndef __cplusplus +#ifndef __cplusplus # error This library requires C++ -#endif +#endif #ifdef HAVE_CONFIG_H -# include +# include #endif #if defined(__linux__) && ! defined(HAVE_GETRUSAGE) @@ -61,30 +67,34 @@ # include #endif +/** + * A high resolutions timing class + */ class StopWatch { public: - StopWatch() - { -// state_ = uninitialized; + /** Constructor */ + StopWatch() { + // state_ = uninitialized; } - void start() - { -// state_ = running; + /** Start counting time */ + void start() { + // state_ = running; t1_ = systemTime(); } - void stop() - { + /** Stop counting time */ + void stop() { t2_ = systemTime(); -// BZPRECONDITION(state_ == running); -// state_ = stopped; + // BZPRECONDITION(state_ == running); + // state_ = stopped; } + /** @return the elapsed time between start and stop */ double elapsedSeconds() { -// BZPRECONDITION(state_ == stopped); + // BZPRECONDITION(state_ == stopped); return t2_ - t1_; }