Log In
New Account
  
 
Home My Page Project Tree Code Snippets Project Openings NUTSS
 
 
Summary Tracker Lists CVS Files
 

CVS | Administration

Diff for /libnutss/examples/slinks_variable_load.c between versions 1.4 and 1.5

version 1.4, 2007/05/29 02:06:25 version 1.5, 2007/05/29 03:03:16
Line 38  void *recvthread(void *arg) { Line 38  void *recvthread(void *arg) {
             newflow = (flow_t*)calloc(1,sizeof(flow_t));              newflow = (flow_t*)calloc(1,sizeof(flow_t));
             newflow->duration = atoi(strtok(tmp,";"));              newflow->duration = atoi(strtok(tmp,";"));
             newflow->weight = atoi(strtok(NULL,";"));              newflow->weight = atoi(strtok(NULL,";"));
           strncpy(newflow->source,peer.user+4,256);            strncpy(newflow->source,peer.user+4,sizeof(newflow->source));
           fprintf(s,"%d ACCEPTED FLOW from %s: d%d/w%d\n",num,newflow->source,newflow->duration,newflow->weight);            if(s) fprintf(s,"%d ACCEPTED FLOW from %s: d%d/w%d\n",num,newflow->source,newflow->duration,newflow->weight);
             for(ptr = flows; ptr; ptr = ptr->next) {              for(ptr = flows; ptr; ptr = ptr->next) {
                 if(--ptr->duration == 0) {                  if(--ptr->duration == 0) {
                     load -= ptr->weight;                      load -= ptr->weight;
                     delta -= ptr->weight;                      delta -= ptr->weight;
            if(ptr->last) ptr->last->next = ptr->next;             if(ptr->last) ptr->last->next = ptr->next;
                     else          flows = ptr->next;                      else          flows = ptr->next;
          if(s) fprintf(s,"%d EXPIRED FLOW from %s:s%s/w%d\n",num,newflow->source,newflow->duration,           if(s) fprintf(s,"%d EXPIRED FLOW from %s:d%d/w%d\n",num,ptr->source,ptr->duration,ptr->weight);
newflow->weight); 
            free(ptr);             free(ptr);
                 }                  }
             }              }
Line 58  void *recvthread(void *arg) { Line 57  void *recvthread(void *arg) {
             if(f) fprintf(f,"%d\t%d\t%d\n",time,load,delta);              if(f) fprintf(f,"%d\t%d\t%d\n",time,load,delta);
         }          }
     }      }
   fprintf(s,"RECV THREAD DONE\n");    if(s) fprintf(s,"%d DONERECEIVING\n",num);
 }  }
   
 int main(int argc, char **argv) {  int main(int argc, char **argv) {
Line 110  int main(int argc, char **argv) { Line 109  int main(int argc, char **argv) {
   
     sleep(1);      sleep(1);
   
       snprintf(tmp, sizeof(tmp), "%d;%d;", duration, weight);
   
     while (time++ < limit*10) { // (i-- != 0) {      while (time++ < limit*10) { // (i-- != 0) {
       snprintf(tmp, sizeof(tmp), "%d;%d;", duration, weight);        swaplinks_sendtoany(swp, tmp, strlen(tmp)+1, 0);
       if((double)rand()/RAND_MAX > (3.0/4)) { //(double)duration/limit) { 
           fprintf(s,"%d SENDING FLOW...\n",num); 
           swaplinks_sendtoany(swp, tmp, strlen(tmp)+1, 0); 
} 
         sleep(1);          sleep(1);
     }      }
   
       if(s) fprintf(s,"%d DONE SENDING\n",num);
   
     pthread_join(tid,NULL);      pthread_join(tid,NULL);
   
     if(f) fclose(f);      if(f) fclose(f);

Removed from v.1.4  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
 

GForge.cis.cornell.edu is brought to you by

Cornell Computing and Information Science


Powered By GForge Collaborative Development Environment