@@ -621,8 +621,11 @@ int main(int argc, char* argv[]) {
621621 std::vector<ThreadStorage> threadStorage (thread_count);
622622 populate (tcname, 0 , 0 , 0 , 0 , dropsToFind);
623623
624+ // The current time in seconds
625+ std::time_t currentTime = std::time (nullptr );
626+
624627 for (size_t i = 0 ; i < thread_count; i++) {
625- threads.emplace_back ([i, thread_count, &tcname, &dropsToFind, mindropcount, &threadStorage]() {
628+ threads.emplace_back ([i, thread_count, &tcname, &dropsToFind, mindropcount, &threadStorage, ¤tTime ]() {
626629 std::random_device rd;
627630 std::mt19937 gen (rd ());
628631
@@ -647,12 +650,21 @@ int main(int argc, char* argv[]) {
647650 if (threadStorage[i].totalsims >= 100000 && threadStorage[i].totalsims % 1000 == 0 ) {
648651 allAboveMin = true ;
649652
650- for (const auto & drop : threadStorage[i].totaldrops ) {
651- long dropsLeft = mindropcount - drop.second ;
652-
653- if (dropsLeft > 0 && drop.second > 0 || drop.second == 0 && threadStorage[i].totalsims < 1000000 ) {
654- allAboveMin = false ;
655- break ;
653+ // Elapsed time in seconds
654+ std::time_t elapsedTime = std::time (nullptr ) - currentTime;
655+
656+ if (elapsedTime < 120 ) {
657+ for (const auto & drop : threadStorage[i].totaldrops ) {
658+ long dropsLeft = mindropcount - drop.second ;
659+
660+ if (dropsLeft > 0 && drop.second > 0 || drop.second == 0 && threadStorage[i].totalsims < 1000000 ) {
661+ if (threadStorage[i].totalsims % 200000 == 0 ) {
662+ std::string msg = " Thread " + std::to_string (i) + " : " + drop.first .name + " needs " + std::to_string (dropsLeft) + " (" + std::to_string (elapsedTime) + " seconds elapsed)\n " ;
663+ std::cerr << msg;
664+ }
665+ allAboveMin = false ;
666+ break ;
667+ }
656668 }
657669 }
658670 }
0 commit comments