|
||||
File indexing completed on 2025-01-18 10:11:10
0001 // @(#)root/tmva $Id$ 0002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss 0003 0004 /********************************************************************************** 0005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 0006 * Package: TMVA * 0007 * Class : Timer * 0008 * * 0009 * * 0010 * Description: * 0011 * Timing information for methods training * 0012 * * 0013 * Authors (alphabetical): * 0014 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 0015 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland * 0016 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 0017 * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada * 0018 * * 0019 * Copyright (c) 2006: * 0020 * CERN, Switzerland * 0021 * MPI-K Heidelberg, Germany * 0022 * * 0023 * Redistribution and use in source and binary forms, with or without * 0024 * modification, are permitted according to the terms listed in LICENSE * 0025 * (see tmva/doc/LICENSE) * 0026 **********************************************************************************/ 0027 0028 #ifndef ROOT_TMVA_Timer 0029 #define ROOT_TMVA_Timer 0030 0031 ////////////////////////////////////////////////////////////////////////// 0032 // // 0033 // Timer // 0034 // // 0035 // Timing information for training and evaluation of MVA methods // 0036 // // 0037 ////////////////////////////////////////////////////////////////////////// 0038 0039 #ifndef ROOT_time 0040 #include "time.h" 0041 #endif 0042 #include "TString.h" 0043 #include "TStopwatch.h" 0044 0045 // ensure that clock_t is always defined 0046 #if defined(__SUNPRO_CC) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 == 500 ) 0047 #ifndef _CLOCK_T 0048 #define _CLOCK_T 0049 typedef long clock_t; // relative time in a specified resolution 0050 #endif /* ifndef _CLOCK_T */ 0051 0052 #endif // SUN and XOPENSOURCE=500 0053 0054 namespace TMVA { 0055 0056 class MsgLogger; 0057 0058 class Timer : public TStopwatch { 0059 0060 public: 0061 0062 Timer( const char* prefix = "", Bool_t colourfulOutput = kTRUE ); 0063 Timer( Int_t ncounts, const char* prefix = "", Bool_t colourfulOutput = kTRUE ); 0064 virtual ~Timer( void ); 0065 0066 void Init ( Int_t ncounts ); 0067 void Reset( void ); 0068 0069 // when the "Scientific" flag set, time is returned with sub-decimals 0070 // for algorithm timing measurement 0071 TString GetElapsedTime ( Bool_t Scientific = kTRUE ); 0072 Double_t ElapsedSeconds ( void ); 0073 TString GetLeftTime ( Int_t icounts ); 0074 void DrawProgressBar( Int_t, const TString& comment = "" ); 0075 void DrawProgressBar( TString ); 0076 void DrawProgressBar( void ); 0077 0078 private: 0079 0080 TString SecToText ( Double_t, Bool_t ) const; 0081 0082 Int_t fNcounts; ///< reference number of "counts" 0083 TString fPrefix; ///< prefix for outputs 0084 Bool_t fColourfulOutput; ///< flag for use of colors 0085 0086 // Save state of previos progress 0087 Int_t fPreviousProgress; 0088 TString fPreviousTimeEstimate; 0089 Bool_t fOutputToFile; 0090 0091 Int_t fProgressBarStringLength; 0092 0093 static const TString fgClassName; ///< used for output 0094 static const Int_t fgNbins; ///< number of bins in progress bar 0095 0096 mutable MsgLogger* fLogger; ///<! the output logger 0097 MsgLogger& Log() const { return *fLogger; } 0098 0099 ClassDef(Timer,0); // Timing information for training and evaluation of MVA methods 0100 }; 0101 0102 } // namespace 0103 0104 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |