Gather data

This commit is contained in:
mike
2026-01-08 02:54:56 +01:00
parent 17880de6d5
commit 5691b4c07b
2 changed files with 64 additions and 13 deletions

View File

@@ -718,7 +718,7 @@ public record SwedishGenerator(int[] buff) {
public FillResult fillMask(Rng rng, Grid mask, DictEntry[] dictIndex,
int logEveryMs, int timeLimitMs, boolean verbose) {
boolean multiThreaded = Thread.currentThread().getName().contains("pool");
var grid = mask.deepCopyGrid();
var slots = extractSlots(grid);
@@ -738,7 +738,7 @@ public record SwedishGenerator(int[] buff) {
final var BAR_LEN = 22;
Runnable renderProgress = () -> {
if (!verbose) return;
if (!verbose || multiThreaded) return;
var now = System.currentTimeMillis();
if ((now - lastLog.get()) < logEveryMs) return;
lastLog.set(now);
@@ -901,14 +901,16 @@ public record SwedishGenerator(int[] buff) {
renderProgress.run();
var ok = new Solver().backtrack(0);
// final progress line
System.out.print("\r" + padRight("", 120) + "\r");
System.out.flush();
if (!multiThreaded) {
System.out.print("\r" + padRight("", 120) + "\r");
System.out.flush();
}
stats.seconds = (System.currentTimeMillis() - t0) / 1000.0;
var res = new FillResult(ok, grid, assigned, stats);
// print a final progress line
if (verbose) {
if (verbose && !multiThreaded) {
System.out.println(
String.format(Locale.ROOT,
"[######################] %d/%d slots | nodes=%d | backtracks=%d | mrv=%d | %.1fs",