Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ana::ThreadPool::ThreadsafeProgress Class Reference
Inheritance diagram for ana::ThreadPool::ThreadsafeProgress:
ana::Progress

Public Member Functions

 ThreadsafeProgress (const std::string &title)
 
void SetProgress (double frac)
 

Protected Member Functions

void Done ()
 Call this when action is completed. More...
 
std::string FormatTime (double sec) const
 

Protected Attributes

std::mutex fLock
 
bool fDone
 Has Done been called? More...
 
int fIFrac
 What character are we on? Prevents unnecessary redraws. More...
 
time_t fStart
 
time_t fPrevCall
 
bool fLive
 Is this bar live (drawable?) More...
 

Static Protected Attributes

static bool fAnyLive = false
 Are any bars live? More...
 

Detailed Description

Definition at line 10 of file ThreadPool.cxx.

Constructor & Destructor Documentation

ana::ThreadPool::ThreadsafeProgress::ThreadsafeProgress ( const std::string title)
inline

Definition at line 13 of file ThreadPool.cxx.

13 : Progress(title) {}
Progress(const std::string &title)
Create and draw the progress bar.
Definition: Progress.cxx:18

Member Function Documentation

void ana::Progress::Done ( )
inherited

Call this when action is completed.

Definition at line 90 of file Progress.cxx.

References ana::Progress::fDone, ana::Progress::fLive, and ana::Progress::SetProgress().

Referenced by ana::FCSurface::Add(), ana::covmx::CovarianceMatrix::BuildFullCovMx(), ana::CovMxSurface::CovMxSurface(), DrawCCOscillations(), DrawSurface(), ana::FrequentistSurface::FillSurface(), ana::CovMxManager::GetCovarianceMatrix(), ana::SpectrumLoader::Go(), ana::FileReducer::Go(), ana::NuWROSyst::InitializeHistograms(), MakeCovMx(), MakeFakeData(), MakePlots(), MakeSystsPDF(), nue_data_mc_validation(), nue_fd_mc_validation(), numu_data_mc_validation(), ana::Profile(), reach_2018_dCPfractions(), tree_maker_simple(), trimmubarid(), trimvar(), useBDTG(), and ana::Progress::~Progress().

91  {
92  if(!fLive) return;
93 
94  if(fDone) return; // Can easily be called multiple times
95 
96  SetProgress(1); // Make sure the bar shows 100%
97 
98  fDone = true;
99  }
bool fDone
Has Done been called?
Definition: Progress.h:22
void SetProgress(double frac)
Update the progress fraction between zero and one.
Definition: Progress.cxx:41
bool fLive
Is this bar live (drawable?)
Definition: Progress.h:29
std::string ana::Progress::FormatTime ( double  sec) const
protectedinherited

Definition at line 102 of file Progress.cxx.

References genie::utils::style::Format(), runNovaSAM::ret, and string.

Referenced by ana::Progress::SetProgress().

103  {
104  // Yes, I'm sure there's a standard way to do this, but this was easy, and
105  // lets me print exactly what I want.
107  if(sec >= 60*60-.5){
108  ret += TString::Format("%dh", (int(sec+.5)/(60*60))).Data();
109  }
110  if(sec >= 60-.5){
111  ret += TString::Format("%dm", (int(sec+.5)/60)%60).Data();
112  }
113  if(sec < 60*60){ // don't clutter if still measured in hours
114  ret += TString::Format("%ds", (int(sec+.5)%60)).Data();
115  }
116  return ret;
117  }
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
enum BeamMode string
void ana::ThreadPool::ThreadsafeProgress::SetProgress ( double  frac)
inline

Definition at line 15 of file ThreadPool.cxx.

References fLock, and ana::Progress::SetProgress().

Referenced by ana::ThreadPool::WorkerFunc().

16  {
17  std::scoped_lock lock(fLock);
19  }
double frac(double x)
Fractional part.
void SetProgress(double frac)
Update the progress fraction between zero and one.
Definition: Progress.cxx:41

Member Data Documentation

bool ana::Progress::fAnyLive = false
staticprotectedinherited

Are any bars live?

Definition at line 30 of file Progress.h.

Referenced by ana::Progress::Progress(), and ana::Progress::SetProgress().

bool ana::Progress::fDone
protectedinherited

Has Done been called?

Definition at line 22 of file Progress.h.

Referenced by ana::Progress::Done(), and ana::Progress::SetProgress().

int ana::Progress::fIFrac
protectedinherited

What character are we on? Prevents unnecessary redraws.

Definition at line 23 of file Progress.h.

Referenced by ana::Progress::SetProgress().

bool ana::Progress::fLive
protectedinherited

Is this bar live (drawable?)

Definition at line 29 of file Progress.h.

Referenced by ana::Progress::Done(), ana::Progress::Progress(), and ana::Progress::SetProgress().

std::mutex ana::ThreadPool::ThreadsafeProgress::fLock
protected

Definition at line 22 of file ThreadPool.cxx.

Referenced by SetProgress().

time_t ana::Progress::fPrevCall
protectedinherited

Definition at line 26 of file Progress.h.

Referenced by ana::Progress::SetProgress().

time_t ana::Progress::fStart
protectedinherited

Definition at line 25 of file Progress.h.

Referenced by ana::Progress::SetProgress().


The documentation for this class was generated from the following file: