chiark / gitweb /
routesearch: event counters
[ypp-sc-tools.main.git] / yarrg / rsmain.c
index 7904c013c1362b622d13017d54ce6ed351e689b1..da05f4780fb30ed0256b684aee3c7cea241f5477 100644 (file)
@@ -7,26 +7,31 @@ double max_mass=-1, max_volu=-1, max_capi=-1;
 double distance_loss_factor_per_league;
 int max_dist= -1;
 
+#define CTR(x) int ctr_##x;
+  COUNTER_LIST
+#undef CTR
+
 int main(int argc, const char **argv) {
   const char *arg;
 
+#ifndef debug_flags
   debug_flags= ~( dbg_sql2 );
+#endif
   sysassert( !setvbuf(debug,0,_IOLBF,0) );
   
   for (;;) {
     arg= *++argv;
     if (arg[0] != '-') break;
+#ifndef debug_flags
     if (!strcmp(arg,"-DN")) {
       debug_flags= 0;
-    } else {
+    } else
+#endif
+    {
       abort();
     }
   }
 
-  setup_sql();
-  setup_value();
-  setup_search();
-
   max_mass= atof(*argv++);
   max_volu= atof(*argv++);
   max_capi= atof(*argv++);
@@ -34,6 +39,12 @@ int main(int argc, const char **argv) {
 
   if (!loss_per_league) loss_per_league= 1e-7;
   distance_loss_factor_per_league= 1.0 - loss_per_league;
+
+  setup_sql();
+  setup_value();
+  setup_search();
+
+  fprintf(stderr,"setup complete, starting search\n");
   
   arg= *argv++;
   if (!strcmp(arg,"specific")) {
@@ -41,7 +52,7 @@ int main(int argc, const char **argv) {
     while ((arg= *argv++))
       ia[ni++]= atoi(arg);
 
-    double val= value_route(ni, ia);
+    double val= value_route(ni, ia, 0);
     printf("route value is %g\n", val);
   } else if (!strcmp(arg,"search")) {
     max_dist= atoi(*argv++);
@@ -50,5 +61,10 @@ int main(int argc, const char **argv) {
   } else {
     abort();
   }
+
+#define CTR(x) fprintf(stderr,"  %-30s %10d\n",#x,ctr_##x);
+  COUNTER_LIST
+#undef CTR
+
   return 0;
 }