chiark / gitweb /
multicore worker only print read matrix input every second
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Mar 2014 19:36:27 +0000 (19:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Mar 2014 19:36:27 +0000 (19:36 +0000)
main.c

diff --git a/main.c b/main.c
index b38b0ce..3f52a86 100644 (file)
--- a/main.c
+++ b/main.c
@@ -263,6 +263,8 @@ static void multicore_outer_iteration(int i, AdjWord min) {
 }
 
 static void mc_iterate_worker(void) {
+  static time_t lastprint;
+
   for (;;) {
     mc_rwvsetup_outer();
     ssize_t r = readv(mc_work[0], mc_iov, mc_niovs);
@@ -272,8 +274,12 @@ static void mc_iterate_worker(void) {
     bool ok = maxhamweight_ok();
     if (!ok) continue;
 
-    ok = preconsider_ok(multicore_iteration_boundary, 1);
-    progress_eol();
+    time_t now = time(0);
+    bool doprint = now != lastprint;
+    lastprint = now;
+
+    ok = preconsider_ok(multicore_iteration_boundary, doprint);
+    if (doprint) progress_eol();
     if (!ok) continue;
 
     /* stop iterate_recurse from trying to run multicore_outer_iteration */