56 #ifndef ROOT_TMVA_Config
59 #ifndef ROOT_TMVA_Tools
62 #ifndef ROOT_TMVA_MsgLogger
66 const TString TMVA::Timer::fgClassName =
"Timer";
76 fPrefix ( strcmp(prefix,"")==0?
Timer::fgClassName:
TString(prefix) ),
77 fColourfulOutput( colourfulOutput ),
78 fLogger ( new MsgLogger( fPrefix.
Data() ) )
90 : fNcounts ( ncounts ),
91 fPrefix ( strcmp(prefix,
"")==0?
Timer::fgClassName:
TString(prefix) ),
92 fColourfulOutput( colourfulOutput ),
134 return SecToText( ElapsedSeconds(), Scientific );
142 Double_t leftTime = ( icounts <= 0 ? -1 :
143 icounts > fNcounts ? -1 :
146 return SecToText( leftTime,
kFALSE );
156 std::clog << fLogger->GetPrintedSource();
157 std::clog <<
"Please wait ";
160 std::clog <<
"." << std::flush;
168 std::clog << fLogger->GetPrintedSource();
176 std::clog <<
"\r" << std::flush;
185 if (!
gConfig().DrawProgressBar())
return;
188 if (icounts > fNcounts-1) icounts = fNcounts-1;
189 if (icounts < 0 ) icounts = 0;
192 std::clog << fLogger->GetPrintedSource();
194 else std::clog <<
"[";
195 for (
Int_t i=0; i<ic; i++) {
197 else std::clog <<
">";
199 for (
Int_t i=ic+1; i<fgNbins; i++) {
201 else std::clog <<
".";
204 else std::clog <<
"]" ;
207 if (fColourfulOutput) {
212 << this->GetLeftTime( icounts ) <<
gTools().
Color(
"reset") <<
") ";
216 std::clog <<
"(" <<
Int_t((100*(icounts+1))/
Float_t(fNcounts)) <<
"%"
217 <<
", " <<
"time left: " << this->GetLeftTime( icounts ) <<
") ";
220 std::clog <<
"[" << comment <<
"] ";
222 std::clog <<
"\r" << std::flush;
231 if (Scientific ) out =
Form(
"%.3g sec", seconds );
232 else if (seconds < 0 ) out =
"unknown";
233 else if (seconds <= 300) out =
Form(
"%i sec",
Int_t(seconds) );
235 if (seconds > 3600) {
237 if (h <= 1) out =
Form(
"%i hr : ", h );
238 else out =
Form(
"%i hrs : ", h );
240 seconds =
Int_t(seconds)%3600;
243 if (m <= 1) out +=
Form(
"%i min", m );
244 else out +=
Form(
"%i mins", m );
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void DrawProgressBar(void)
draws the progressbar
TString GetLeftTime(Int_t icounts)
returns pretty string with time left
void Reset(void)
resets timer
ClassImp(TMVA::Timer) TMVA
constructor
virtual ~Timer(void)
destructor
std::vector< std::vector< double > > Data
TString GetElapsedTime(Bool_t Scientific=kTRUE)
static const Int_t fgNbins
Timer(const char *prefix="", Bool_t colourfulOutput=kTRUE)
RooCmdArg Timer(Bool_t flag=kTRUE)
TString SecToText(Double_t, Bool_t) const
pretty string output
Double_t ElapsedSeconds(void)
computes elapsed tim in seconds
char * Form(const char *fmt,...)
void Reset(Detail::TBranchProxy *x)
Abstract ClassifierFactory template that handles arbitrary types.