Improved status printing

This commit is contained in:
Ämin on ThinkPad 2023-05-08 20:49:20 +02:00
parent 263805631e
commit 76a540dce9
2 changed files with 12 additions and 11 deletions

View File

@ -232,7 +232,7 @@ int test_graphs(int startidx, int len, int maxn, const int *graphs) {
const float percentage = 100*(float)count/(float)len;
const int deltat = t1-tstart;
const float rate = (float)count/(float)deltat;
fprintf(stderr, "\r%6.2f%% %*d/%d (verification rate %*.2f graphs/s in %d seconds; current line %d)",percentage,padlen,count,len,padlen+3,rate,deltat,graphidx+1);
fprintf(stderr, "\r%6.2f%% %*d/%d (%*.2f graphs/s in %d seconds; current line %d)",percentage,padlen,count,len,padlen+3,rate,deltat,graphidx+1);
t0 = t1;
}
// Test graph with index `graphidx'
@ -344,7 +344,7 @@ int test_graphs(int startidx, int len, int maxn, const int *graphs) {
}
const int deltat = time(NULL) - tstart;
const float rate = (deltat == 0) ? len : (float)len/(float)deltat;
fprintf(stderr, "\r%6.2f%% %*d/%d (verification rate %*.2f graphs/s in %d seconds; current line %d)\n",100.0,padlen,len,len,padlen+3,rate,deltat,startidx+len);
fprintf(stderr, "\r%6.2f%% %*d/%d (%*.2f graphs/s in %d seconds; current line %d)\n",100.0,padlen,len,len,padlen+3,rate,deltat,startidx+len);
return 0;
}
@ -385,8 +385,7 @@ int main(int argc, char *argv[]) {
return -1;
}
const int startidx = START ? START-1 : 0; // Index of graph to start verifying
const int tot = NUM ? NUM : graphcount-START+1; // Number of graphs to be verified
printf("startidx=%d, tot=%d\n", startidx, tot);
const int tot = NUM ? NUM : graphcount-startidx; // Number of graphs to be verified
if(startidx >= graphcount || tot <= 0 || tot+startidx-1 >= graphcount) {
fprintf(stderr, "ERROR: Lines to be verified are out of range\n");
return -1;

View File

@ -441,7 +441,7 @@ int main(int argc, char *argv[]) {
return -1;
}
const unsigned long long max = 1L << m; // Largest `graphnumber'
const int padlen = (int)((float)m/3.322)+1;
const int padlen = (int)((float)m/3.322)+1; // Convert log 2 to log 10
int len = 0;
time_t t0 = time(NULL);
time_t t = time(NULL);
@ -464,8 +464,10 @@ int main(int argc, char *argv[]) {
t = now;
const int deltat = now - t0;
const float rate = (float)graphschecked/(float)deltat;
const float percentage = (RANDOM==0) ? 100*(float)graphnumber/(float)max : (float)len/(float)RANDOM;
fprintf(stderr, "\r%6.2f%% %*llu/%llu (found=%i at rate %*.2f graphs/s in %d seconds)",percentage,padlen,graphnumber,max,len,padlen+3,rate,deltat);
const float SOCrate = (float)len/(float)deltat;
const float percentage = (RANDOM==0) ? 100*(float)graphnumber/(float)max : 100*(float)len/(float)RANDOM;
const float ETC = (RANDOM==0) ? ((float)(max - graphschecked)/(rate))/3600 : ((float)(RANDOM - len)/(SOCrate))/3600;
fprintf(stderr, "\r%6.2f%% %*llu/%llu (%i SOCs found, %d seconds, %*.2f graphs/s, %*.2f SOCs/s, %*.2fh estimated time left)",percentage,padlen,graphnumber,max,len,deltat,padlen+3,rate,padlen+3,SOCrate,padlen,ETC);
fflush(stderr);
}
// Convert graph index `grpahnumber' to the lists parents, children, parentslen, childrenlen
@ -508,9 +510,9 @@ int main(int argc, char *argv[]) {
}
const int deltat = time(NULL) - t0;
const float rate = (deltat == 0) ? graphschecked : (float)graphschecked/(float)deltat;
//fprintf(stderr, "\r100%% %llu/%llu ", max,max);
fprintf(stderr, "\r%6.2f%% %*llu/%llu (found=%i at rate %*.2f graphs/s in %d seconds)",100.00,padlen,graphnumber,max,len,padlen+3,rate,deltat);
fprintf(stderr, "\nFound %d SOCs at rate %.2f graphs/s in %d seconds\n", len,rate,deltat);
const float SOCrate = (deltat == 0) ? len : (float)len/(float)deltat;
fprintf(stderr, "\r%6.2f%% %*llu/%llu (%i SOCs found, %d seconds, %*.2f graphs/s, %*.2f SOCs/s, %*.2fh estimated time left)",100.00,padlen,graphnumber,max,len,deltat,padlen+3,rate,padlen+3,SOCrate,padlen,0.00);
fprintf(stderr, "\nFound %d SOCs in %d seconds\n", len,deltat);
// Free manually allocated memory
free(cycles);
return 0;