StopWatch.hh 3.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  OpenFlipper 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 Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision: 3468 $
//   $Author: moebius $
//   $Date: 2008-10-17 14:58:52 +0200 (Fri, 17 Oct 2008) $
//
//=============================================================================

// (C) Copyright 2015 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary
// to Autodesk,  Inc.,  and considered a trade secret as defined
// in section 499C of the penal code of the State of California.
// Use of  this information  by  anyone  other  than  authorized
// employees of Autodesk, Inc.  is granted  only under a written
// non-disclosure agreement,  expressly  prescribing  the  scope
// and manner of such use.

//=============================================================================
//
//  CLASS StopWatch
//
//=============================================================================

#ifndef BASE_STOPWATCH_HH_INCLUDED
#define BASE_STOPWATCH_HH_INCLUDED

51
#include <Base/Config/BaseDefines.hh>
Max Lyon's avatar
Max Lyon committed
52

53 54 55 56 57 58 59 60 61 62
namespace Base {

//== CLASS DEFINITION =========================================================
    
/** \class StopWatch StopWatch.hh 

    This class can be used for measuring time, providing optimal granularity
    for the current platform. 
**/

Max Lyon's avatar
Max Lyon committed
63
class BASEDLLEXPORT StopWatch
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
{
public:

  /// Constructor
  StopWatch(); 

  /// Destructor
  ~StopWatch();

  /// Start time measurement
  void start();

  /// Restart, return time elapsed until now.
  double restart();

  /// Stop time measurement, return time.
  double stop();

  /// Get the total time in milli-seconds (watch has to be stopped).
  double elapsed() const;

private:
  class Impl;
  Impl* impl_;

private:
  // disable copy and assignment
  StopWatch(const StopWatch&);
  StopWatch& operator=(const StopWatch&);
};


//=============================================================================
} // namespace Base

//=============================================================================
#endif//BASE_STOPWATCH_HH_INCLUDED
//=============================================================================