00001 // @(#)root/gl:$Id: TGLStopwatch.h 23087 2008-04-09 14:10:56Z rdm $ 00002 // Author: Richard Maunder 25/05/2005 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TGLStopwatch 00013 #define ROOT_TGLStopwatch 00014 00015 #ifndef ROOT_Rtypes 00016 #include "Rtypes.h" 00017 #endif 00018 00019 ////////////////////////////////////////////////////////////////////////// 00020 // // 00021 // TGLStopwatch // 00022 // // 00023 // Stopwatch object for timing GL work. We do not use the TStopwatch as // 00024 // we need to perform GL flushing to get accurate times + we record // 00025 // timing overheads here. // 00026 // 00027 // MT: Bypassed all of the overhead stuff. It does not seem reasonable 00028 // anyway. Besides it was being initialized outside of a valid GL 00029 // context and coused random crashes (especially on 64-bit machines with 00030 // nvidia cards). 00031 // 00032 ////////////////////////////////////////////////////////////////////////// 00033 00034 class TGLStopwatch 00035 { 00036 private: 00037 // Fields 00038 Double_t fStart; //! start time (millisec) 00039 Double_t fEnd; //! end time (millisec) 00040 Double_t fLastRun; //! time of last run (milisec) 00041 00042 // Methods 00043 Double_t GetClock(void) const; 00044 00045 public: 00046 TGLStopwatch(); 00047 virtual ~TGLStopwatch(); // ClassDef introduces virtual fns 00048 00049 void Start(); 00050 Double_t Lap() const; 00051 Double_t End(); 00052 Double_t LastRun() const { return fLastRun; } 00053 00054 ClassDef(TGLStopwatch,0) // a GL stopwatch utility class 00055 }; 00056 00057 #endif // ROOT_TGLStopwatch