chiark / gitweb /
routesearch: event counters
[ypp-sc-tools.main.git] / yarrg / rsvalue.c
index d2190dc289a9a3cc4879333da794b4c9c5f1b691..3bf98b47b397f8bca433d55045b193305de099c2 100644 (file)
@@ -13,6 +13,7 @@ static CommodInfo *commodstab;
 static sqlite3_stmt *ss_ipair_dist;
 static sqlite3_stmt *ss_ite_buy, *ss_ite_sell;
 
+
 #define MAX_LEGS (MAX_ROUTELEN-1)
 
 typedef struct {
@@ -158,6 +159,8 @@ static IslandPair *ipair_get_create(int si, int di) {
 double value_route(int nislands, const int *islands, int exclude_arbitrage) {
   int s,d;
 
+  ctr_subroutes_valued++;
+
   /* We need to construct the LP problem.  GLPK talks
    * about rows and columns, which are numbered from 1.
    *
@@ -288,6 +291,8 @@ double value_route(int nislands, const int *islands, int exclude_arbitrage) {
   double profit= 0;
 
   if (lpx_get_num_cols(lp)) {
+    ctr_subroutes_nonempty++;
+    
     if (DEBUGP(lp))
       lpx_write_cpxlp(lp, (char*)DEBUG_DEV);
 
@@ -327,6 +332,7 @@ static void read_trades(void) {
 
   SQL_DISTINCT_DECL(cols,5);
   while (SQL_DISTINCT_STEP(ss_trades,cols,5)) {    
+    ctr_trades_loaded++;
     IslandPair *ip= ipair_get_create(cols[1], cols[3]);
     TradesBlock *block= ip->trades;
     if (!block || ip->trades->ntrades >= TRADES_PER_BLOCK) {
@@ -357,6 +363,7 @@ static void read_islandtradeends(const char *bs, int srcdstoff) {
 
   SQL_DISTINCT_DECL(cols,5);
   while (SQL_DISTINCT_STEP(ss,cols,3)) {
+    ctr_quantities_loaded++;
     IslandTradeEnd *search;
 
     int commodid= cols[0];
@@ -397,6 +404,7 @@ void setup_value(void) {
   SQL_PREPARE(sst,
              "SELECT commodid,unitmass,unitvolume FROM commods");
   while (SQL_STEP(sst)) {
+    ctr_commodities_loaded++;
     int id= sqlite3_column_int(sst,0);
     assert(id>=0 && id<commodstabsz);
     commodstab[id].mass= sqlite3_column_int(sst,1);