72 fPrefix ( strcmp(prefix,"")==0?
Timer::fgClassName:
TString(prefix) ),
73 fColourfulOutput( colourfulOutput ),
74 fProgressBarStringLength (0),
87 : fNcounts ( ncounts ),
88 fPrefix ( strcmp(prefix,
"")==0?
Timer::fgClassName:
TString(prefix) ),
89 fColourfulOutput( colourfulOutput ),
90 fProgressBarStringLength (0),
132 return SecToText( ElapsedSeconds(), Scientific );
140 Double_t leftTime = ( icounts <= 0 ? -1 :
141 icounts > fNcounts ? -1 :
144 return SecToText( leftTime,
kFALSE );
152 fProgressBarStringLength = 0;
155 std::clog << fLogger->GetPrintedSource();
156 std::clog <<
"Please wait ";
159 std::clog <<
"." << std::flush;
168 std::clog << fLogger->GetPrintedSource();
176 for (
int i = fProgressBarStringLength; i < theString.
Length (); ++i)
178 std::clog <<
"\r" << std::flush;
179 fProgressBarStringLength = theString.
Length ();
188 if (!
gConfig().DrawProgressBar())
return;
191 if (icounts > fNcounts-1) icounts = fNcounts-1;
192 if (icounts < 0 ) icounts = 0;
195 std::clog << fLogger->GetPrintedSource();
197 else std::clog <<
"[";
198 for (
Int_t i=0; i<ic; i++) {
200 else std::clog <<
">";
202 for (
Int_t i=ic+1; i<fgNbins; i++) {
204 else std::clog <<
".";
207 else std::clog <<
"]" ;
210 if (fColourfulOutput) {
215 << this->GetLeftTime( icounts ) <<
gTools().
Color(
"reset") <<
") ";
219 std::clog <<
"(" <<
Int_t((100*(icounts+1))/
Float_t(fNcounts)) <<
"%"
220 <<
", " <<
"time left: " << this->GetLeftTime( icounts ) <<
") ";
223 std::clog <<
"[" << comment <<
"] ";
225 std::clog <<
"\r" << std::flush;
234 if (Scientific ) out =
Form(
"%.3g sec", seconds );
235 else if (seconds < 0 ) out =
"unknown";
236 else if (seconds <= 300) out =
Form(
"%i sec",
Int_t(seconds) );
238 if (seconds > 3600) {
240 if (h <= 1) out =
Form(
"%i hr : ", h );
241 else out =
Form(
"%i hrs : ", h );
243 seconds =
Int_t(seconds)%3600;
246 if (m <= 1) out +=
Form(
"%i min", m );
247 else out +=
Form(
"%i mins", m );
static const TString fgClassName
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
virtual ~Timer(void)
destructor
TString GetElapsedTime(Bool_t Scientific=kTRUE)
std::vector< std::vector< double > > Data
void Reset(void)
resets timer
char * Form(const char *fmt,...)
void Reset(Detail::TBranchProxy *x)
TString GetLeftTime(Int_t icounts)
returns pretty string with time left
Timer(const char *prefix="", Bool_t colourfulOutput=kTRUE)
constructor
Double_t ElapsedSeconds(void)
computes elapsed tim in seconds
TString SecToText(Double_t, Bool_t) const
pretty string output
static const Int_t fgNbins
void DrawProgressBar(void)
draws the progressbar