feat: show progress
This commit is contained in:
parent
d14f330e07
commit
6cbbb133c1
@ -342,6 +342,7 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
fprintf(stderr, "worker_step: %ld\n", step);
|
||||
|
||||
std::atomic<uint64_t> cnt{0};
|
||||
std::atomic<uint64_t> progress{0};
|
||||
for (int i = 0; i < thread_num; ++i) {
|
||||
workers.emplace_back([&] {
|
||||
while (!found) {
|
||||
@ -359,8 +360,8 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
for (int i = std::min(step_count, step); i > 0 && cur_mask < last_mask; --i) {
|
||||
cur_mask = next_bit_permutation(cur_mask);
|
||||
if (cnt.fetch_add(1) % 10000000 == 0) {
|
||||
fprintf(stderr, "cnt : %ld, step_count: %5ld, cur_pos: %5ld\n",
|
||||
cnt.load(std::memory_order_relaxed), step_count, g_cur_pos.load());
|
||||
fprintf(stderr, "cnt : %ld, step_count: %5ld, cur_pos: %5ld progress: %ld\n",
|
||||
cnt.load(std::memory_order_relaxed), step_count, g_cur_pos.load(), progress.load());
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,7 +384,7 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < step && cur_mask < last_mask && !found.load(std::memory_order_relaxed); ++i) {
|
||||
for (int i = step * 10; i > 0 && cur_mask < last_mask && !found.load(std::memory_order_relaxed); --i) {
|
||||
if (resolve(cur_mask)) {
|
||||
bool expected = false;
|
||||
if (found.compare_exchange_strong(expected, true)) {
|
||||
@ -393,6 +394,7 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
}
|
||||
}
|
||||
}
|
||||
progress.fetch_add(step * 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user