10 #include <sys/times.h> 50 void tick(
long i,
long n) {
51 if ( !statusTime(i, n) )
return;
53 double fcpui = fclock();
54 time_t timei = time(0);
55 double ftime0 = time0;
56 double ftime1 = time1;
57 double ftimei = timei;
59 if ( ftimei > ftime1 && fcpui > fcpu1 )
60 eff = (fcpui-fcpu1)/(ftimei-ftime1);
61 if ( eff >= 1.0 ) eff = 0.999999;
64 if ( ftimei > ftime0 && fcpui > fcpu0 )
65 eff0 = (fcpui-fcpu0)/(ftimei-ftime0);
66 if ( eff0 >= 1.0 ) eff0 = 0.999999;
68 double fcpun = fcpu0 + (n*(fcpui-fcpu0))/i;
69 time_t timen = (time_t)(ftimei + (fcpun-fcpui)/eff + 30.0);
70 time_t timen0 = (time_t)(ftimei + (fcpun-fcpui)/eff0 + 30.0);
74 strftime(date,1024,
"%y.%m.%d %H:%M",localtime(&timei));
75 strftime(daten,1024,
"%H:%M",localtime(&timen));
76 strftime(daten0,1024,
"%H:%M",localtime(&timen0));
78 if ( n - i < n/10 ) ii = i - n;
79 time_t dayn = (timen - timei)/86400;
80 time_t dayn0 = (timen0 - timei)/86400;
84 if ( dayn <= 0 && dayn0 <= 0 ) {
85 os << date <<
" " << setw(8) << ii <<
"/" << setw(9);
86 os.setf(ios::left, ios::adjustfield);
87 os << n <<
" etc: " << daten <<
"[";
88 os.setf(ios::right, ios::adjustfield);
89 os << setw(2) << ieff <<
"%] " << daten0 <<
"[" << ieff0 <<
"%] " 90 << host <<
":" << pid << endl << flush;
92 os << date <<
" " << setw(8) << ii <<
"/" << setw(9);
93 os.setf(ios::left, ios::adjustfield);
94 os << n <<
" etc: " << dayn <<
"+" << daten <<
"[";
95 os.setf(ios::right, ios::adjustfield);
96 os << setw(2) << ieff <<
"%] " 97 << dayn0 <<
"+" << daten0 <<
"[" << ieff0 <<
"%] " 98 << host <<
":" << pid << endl << flush;
111 tmsbuf.tms_utime+tmsbuf.tms_stime+tmsbuf.tms_cutime+tmsbuf.tms_cstime;
112 d /= sysconf(_SC_CLK_TCK);
118 if ( i <= 0 )
return false;
119 if ( i == n )
return true;
120 if ( i > n/2 ) i = n-i;
121 while ( i >= 10 && !(i%10) ) i /= 10;
122 if ( i == 1 || i == 2 || i == 5 )
return true;
123 if ( secstep > 0 && time(0) > time1 + secstep )
return true;
131 fcpu0 = fcpu1 = fclock();
132 time0 = time1 = time(0);
134 gethostname(name,1024);
136 if ( host.find(
".") != string::npos )
137 host = host.substr(0, host.find(
"."));
140 strftime(date,1024,
"%y.%m.%d %H:%M",localtime(&time0));
142 os << date <<
" 0/" << setw(9);
143 os.setf(ios::left, ios::adjustfield);
145 os.setf(ios::right, ios::adjustfield);
146 os <<
" Initializing... " 147 << host <<
":" << pid << endl << flush;
end namespace Pythia8
Definition: PythiaStdlib.h:312
void tick(long i, long n)
Definition: ProgressLog.h:50
bool statusTime(long i, long n) const
Check if this is a good time to print out a status line.
Definition: ProgressLog.h:117
Definition: ProgressLog.h:27
void operator()()
Definition: ProgressLog.h:44
void operator()(int cnt)
Definition: ProgressLog.h:38
ProgressLog(long NIn, int maxsec=1200)
Create an object for monitoring the progress of a run with NIn iterations.
Definition: ProgressLog.h:32
double fclock()
Interface to the system time information.
Definition: ProgressLog.h:107
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
void init(long n)
Initialise the basic engine.
Definition: ProgressLog.h:128