]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/commitdiff
fcb: Added debugging outputs
authorTuka Martin <tukamart@fel.cvut.cz>
Sun, 15 Apr 2012 23:02:07 +0000 (01:02 +0200)
committerTuka Martin <tukamart@fel.cvut.cz>
Sun, 15 Apr 2012 23:02:07 +0000 (01:02 +0200)
Output shows some of resource details as selected
in redistribute_spare_capacity function

src/frsh/fres/cbroker/fcb.c

index 6361bcce69bffb7f9cdd35ff5272598ff608c9ad..69fe78eba5304662137e6e788788338ba675a105 100644 (file)
@@ -1030,15 +1030,27 @@ void redistribute_spare_capacity(fres_contract_broker obj,
        struct res_key key = {restype, resid };
        struct resource *resource;
        const frsh_resource_type_t restype_to_find = restype;
+       struct fcb_contract * fc;
+       struct res_key * rk;
        
+       //TODO: delete debug outputs
+       int num_of_resources = 0;
+       gavl_cust_for_each(fcb_resource, fcb, resource) {
+               num_of_resources++;
+       }
+       printf("Number of resources: %d\n", num_of_resources);
+
        resource = fcb_resource_find(fcb, &key);
+       if(resource == NULL)
+               printf("Resource not found\n");
+       else printf("Found resource with name %s, type %d and ID %d\n", resource->name, resource->key.type, resource->key.id);
        assert(resource != NULL);
-
-       //TODO: delete debug output
-       printf("\ncalled function 'redistribute_spare_capacity'\n");
-
-       struct fcb_contract * fc;
-       struct res_key * rk;
+       
+       int num_of_contracts = 0;
+       ul_list_for_each(sc_contracts, resource, fc) {
+               num_of_contracts++;
+       }
+       printf("Number of contracts in resource %s: %d\n", resource->name, num_of_contracts);
 
        gavl_cust_for_each(fcb_contract, fcb, fc) {
                        rk = get_fc_res_key(fc, &key);