Added hide and show of cursor
This commit is contained in:
parent
241cf31512
commit
1fd5ff640e
@ -155,12 +155,17 @@ int main(int argc, const char * argv[]) {
|
|||||||
unsigned long long cur_iter {robinsonizer.total_iterations()};
|
unsigned long long cur_iter {robinsonizer.total_iterations()};
|
||||||
unsigned long long prev_iter {0};
|
unsigned long long prev_iter {0};
|
||||||
|
|
||||||
|
// hide cursor
|
||||||
|
std::cerr << "\x1b[?25l";
|
||||||
|
|
||||||
while (!robinsonizer.found()) { // show progress info
|
while (!robinsonizer.found()) { // show progress info
|
||||||
prev_iter = cur_iter;
|
prev_iter = cur_iter;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds{1});
|
std::this_thread::sleep_for(std::chrono::seconds{1});
|
||||||
cur_iter = robinsonizer.total_iterations();
|
cur_iter = robinsonizer.total_iterations();
|
||||||
std::cerr << '\r' << cur_iter - prev_iter << " iterations per second, " << cur_iter << " total";
|
std::cerr << '\r' << cur_iter - prev_iter << " iterations per second, " << cur_iter << " total";
|
||||||
}
|
}
|
||||||
|
// show cursor
|
||||||
|
std::cerr << "\x1b[?25h";
|
||||||
worker.join();
|
worker.join();
|
||||||
std::cout << '\n';
|
std::cout << '\n';
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user