@@ -168,6 +168,24 @@ std::string getDuration(uint64_t tStart, uint64_t tStop)
168168 return fmt::format (" {:02}d {:02}:{:02}:{:02}" , d, h, m, s);
169169}
170170
171+ // ----------------------------------------------------------------------------
172+ void exitOnDemand (int code)
173+ {
174+ // / exit the program if requested
175+
176+ printf (" Continue? [y/n] " );
177+
178+ std::string response{};
179+ while (true ) {
180+ std::cin >> response;
181+ if (response == " y" ) {
182+ break ;
183+ } else if (response == " n" ) {
184+ exit (code);
185+ }
186+ }
187+ }
188+
171189// ----------------------------------------------------------------------------
172190std::set<int > getRuns (std::string runList)
173191{
@@ -479,8 +497,8 @@ void fillDataPoints(const std::vector<DPVAL>& dps, std::map<uint64_t, double>& d
479497 auto previousTS = dps2.rbegin ()->first ;
480498 if (ts != previousTS || getValue (*itDP) != dps2.rbegin ()->second ) {
481499 if (ts <= previousTS) {
482- printf (" error: wrong data point order (%llu <= %llu)\n " , (ULL)ts, (ULL)previousTS);
483- exit (1 );
500+ printf (" error: wrong data point order (%llu <= %llu). " , (ULL)ts, (ULL)previousTS);
501+ exitOnDemand (1 );
484502 }
485503 if (printWarning) {
486504 printf (" %s%s missing the previous data point (dt = %s%llu ms)" , color.c_str (), header.c_str (),
@@ -512,8 +530,10 @@ void fillDataPoints(const std::vector<DPVAL>& dps, std::map<uint64_t, double>& d
512530 for (++itDP; itDP < dps.end (); ++itDP) {
513531 ts = itDP->get_epoch_time ();
514532 if (ts <= previousTS) {
515- printf (" error: wrong data point order (%llu <= %llu)\n " , (ULL)ts, (ULL)previousTS);
516- exit (1 );
533+ printf (" error: wrong data point order (%llu <= %llu). " , (ULL)ts, (ULL)previousTS);
534+ exitOnDemand (1 );
535+ } else {
536+ previousTS = ts;
517537 }
518538 if (ts < tMin && (warningLevel > 1 || (warningLevel == 1 && ts + tolerance < tMin))) {
519539 printf (" %s%s data point outside of file validity range (dt = -%llu ms)\e[0m\n " ,
@@ -523,7 +543,6 @@ void fillDataPoints(const std::vector<DPVAL>& dps, std::map<uint64_t, double>& d
523543 header.c_str (), (ULL)(ts - tMax));
524544 }
525545 dps2.emplace (ts, getValue (*itDP));
526- previousTS = ts;
527546 }
528547}
529548
0 commit comments