void plot_show(void) { uint64_t i; struct odflow_list *psubflow_list; struct odflow *pflow; // set current index before shaffling the flow list for (i = 0; i < inparam.agrflow_list->size; i++) { pflow = inparam.agrflow_list->list[i]; pflow->list_index = i; } /* sort flow entries based on the byte/packet count in order */ qsort(inparam.agrflow_list->list, inparam.agrflow_list->size, sizeof(struct odflow *), plot_comp); /* sort subflow entries based on the byte/packet count in order */ for (i = 0; i < inparam.agrflow_list->size; i++) { psubflow_list = inparam.agrflow_list->list[i]->subflow; if ((psubflow_list != NULL) && (psubflow_list->size > 0)) qsort(psubflow_list->list, psubflow_list->size, sizeof(struct odflow *), plot_comp); } switch (query.outfmt) { case REAGGREGATION: print_aguri(); break; case JSON: print_json(); break; case DEBUG: print_csv(); break; } }
int main() { csv_line header ; csv_line current ; header = get_line() ; current = get_line() ; while ( current.nfields > 0 ) { print_csv(header, current) ; current = get_line() ; } return 0 ; }
int main(int argc, char *argv [ ]) { long int ppp=1111990911; time_t seconds; time( & seconds ) ; srand ( seconds ) ; srand48 ( seconds ) ; //srand generates a sequence of random numbers depending upon the seed value FILE *p1; //p1 = fopen ( argv [ 1 ],"w" ) ; int NoIteration = atoi ( argv [ 1 ] ) ; //TAM_WIDTH_MAX = atoi ( argv [ 3 ] ) ; int iteration; long int t,mint; FILE *tamread; tamread = fopen("tam_testtime.txt","r"); for(int ii = 0; ii< SIZE; ii++) tam_testtime[ii].no_of_tam = TAM_INFO[ii]; for(int ii = 0; ii< SIZE; ii++) { for(int jj = 0; jj< tam_testtime[ii].no_of_tam; jj++) { fscanf(tamread,"%d\t%ld", &tam_testtime[ii].tam_list[jj], &tam_testtime[ii].testtime_list[jj]); } } fclose (tamread); /*temp_tam_index[0] = TAM_INFO[0]; for(int i = 1; i< SIZE; i++) { temp_tam_index[i] = temp_tam_index[i-1]+TAM_INFO[i]; } */ if(HARD_DIE_TEST) { initialiseparticle(&(partarray[0])); partarray[0].time_fitness = bin_packing(partarray[0].info,0,0); // printf("%ld \n", partarray[0].time_fitness); for ( int i = 0 ; i < SIZE ; i ++ ) { //printf ("{ %d, %d, %ld, %ld, %d }\n", scheduler[0][i].corenum, scheduler[0][i].tam_width, scheduler[0][i]. starttime, scheduler[0][i]. endtime, scheduler[0][i]. tsv); } print_csv(partarray[0].time_fitness, scheduler[0]); return 0; } for(iteration=0;iteration < NoIteration;iteration++) { globalbestIndx = 0; mint=particle_swarm_optimization(); //printf ("Globalbestindx: %d\n",globalbestIndx); /*fo/r ( int pp = 0 ; pp < SIZE ; pp ++ ){ BestParticle [ pp ] .tam_width = scheduler [globalbestIndx][pp]. tam_width; BestParticle [ pp ] .corenum = scheduler [globalbestIndx][pp]. corenum; BestParticle [ pp ] .starttime = scheduler [globalbestIndx][pp]. starttime; BestParticle [ pp ] .endtime = scheduler [globalbestIndx][pp]. endtime; }*/ for(int i=1;i<3;i++) { //printf("RunForrestRun: %d\n",i); globalbestIndx = 0; t=particle_swarm_optimization(); /*for ( int ii = 0 ; ii < SIZE ; ii ++ ) { printf ("{ %d, %d, %ld, %ld }\n", scheduler [globalbestIndx][ii].corenum, scheduler [globalbestIndx][ii].tam_width, scheduler [globalbestIndx][ii]. starttime, scheduler [globalbestIndx][ii]. endtime); }*/ if ( t < mint ) { mint = t ; /*for ( int pp = 0 ; pp < SIZE ; pp ++ ){ BestParticle [ pp ] .corenum = scheduler [globalbestIndx][pp]. corenum; BestParticle [ pp ] .tam_width = scheduler [globalbestIndx][pp]. tam_width; BestParticle [ pp ] .starttime = scheduler [globalbestIndx][pp]. starttime; BestParticle [ pp ] .endtime = scheduler [globalbestIndx][pp]. endtime; }*/ } //printf("%ld \n",t); } //fprintf(p1,"%ld\n",mint); //printf("%ld\n",mint); } for ( int i = 0 ; i < SIZE ; i ++ ) { //printf ("{ %d, %d, %ld, %ld, %d }\n", BestParticle[i].corenum, BestParticle[i].tam_width, BestParticle[i]. starttime, BestParticle[i]. endtime, BestParticle[i]. tsv); } print_csv(mint, BestParticle); return 0; }
int main(int argc, char *argv [ ]) { long int ppp=1111990911; time_t seconds; time( & seconds ) ; srand ( seconds ) ; srand48 ( seconds ) ; //srand generates a sequence of random numbers depending upon the seed value p1 = fopen ( argv [ 1 ],"w" ) ; int NoIteration = atoi ( argv [ 2 ] ) ; power_budget = atoi ( argv [ 3 ] ) ; //TAM_WIDTH_MAX = atoi ( argv [ 3 ] ) ; int iteration; long int t,mint; FILE *tamread; tamread = fopen("tam_testtime.txt","r"); for(int ii = 0; ii< SIZE; ii++) tam_testtime[ii].no_of_tam = TAM_INFO[ii]; for(int ii = 0; ii< SIZE; ii++) { for(int jj = 0; jj< tam_testtime[ii].no_of_tam; jj++) { fscanf(tamread,"%d\t%ld", &tam_testtime[ii].tam_list[jj], &tam_testtime[ii].testtime_list[jj]); } } fclose (tamread); for(int ii = 0; ii< SIZE; ii++) { for(int jj = 0; jj< tam_testtime[ii].no_of_tam; jj++) { char input_file [100]="sic_power_level_"; char r[20]; sprintf (r, "%d",ii+1); strcat (input_file, r); long int power, testtime; sprintf (r, "/power_tam_%d",jj+5); strcat (input_file, r); strcat (input_file, ".txt"); // printf("%s\n", input_file); tamread = fopen(input_file,"r"); int count = 0; while (!(feof(tamread))) { fscanf(tamread, "%ld\t%ld\t\n", &power, &testtime); // printf("%ld %ld\n", power, testtime); tam_testtime[ii].power_testtime_list[jj].power_list[count] = power; tam_testtime[ii].power_testtime_list[jj].testtime_list[count] = testtime; count ++; } tam_testtime[ii].power_testtime_list[jj].no_of_power = count; } } // temp_tam_index[0] = TAM_INFO[0]; /*for(int ii = 0; ii< SIZE; ii++) { for(int jj = 0; jj< tam_testtime[ii].no_of_tam; jj++) printf("%d ", tam_testtime[ii].power_testtime_list[jj].no_of_power); printf("\n"); }*/ if(HARD_DIE_TEST) { initialiseparticle(&(partarray[0])); partarray[0].time_fitness = bin_packing(partarray[0].info,0,0); // printf("%ld \n", partarray[0].time_fitness); for ( int i = 0 ; i < SIZE ; i ++ ) { //printf ("{ %d, %d, %ld, %ld, %d }\n", scheduler[0][i].corenum, scheduler[0][i].tam_width, scheduler[0][i]. starttime, scheduler[0][i]. endtime, scheduler[0][i]. tsv); } print_csv(partarray[0].time_fitness, scheduler[0]); return 0; } for(iteration=0;iteration < NoIteration;iteration++) { globalbestIndx = 0; mint=particle_swarm_optimization(); // printf ("Globalbestindx: %d\n",globalbestIndx); /*fo/r ( int pp = 0 ; pp < SIZE ; pp ++ ){ BestParticle [ pp ] .tam_width = scheduler [globalbestIndx][pp]. tam_width; BestParticle [ pp ] .corenum = scheduler [globalbestIndx][pp]. corenum; BestParticle [ pp ] .starttime = scheduler [globalbestIndx][pp]. starttime; BestParticle [ pp ] .endtime = scheduler [globalbestIndx][pp]. endtime; }*/ for(int i=1;i<2;i++) { // printf("RunForrestRun: %d\n",i); globalbestIndx = 0; t=particle_swarm_optimization(); /*for ( int ii = 0 ; ii < SIZE ; ii ++ ) { printf ("{ %d, %d, %ld, %ld }\n", scheduler [globalbestIndx][ii].corenum, scheduler [globalbestIndx][ii].tam_width, scheduler [globalbestIndx][ii]. starttime, scheduler [globalbestIndx][ii]. endtime); }*/ if ( t < mint ) { mint = t ; /*for ( int pp = 0 ; pp < SIZE ; pp ++ ){ BestParticle [ pp ] .corenum = scheduler [globalbestIndx][pp]. corenum; BestParticle [ pp ] .tam_width = scheduler [globalbestIndx][pp]. tam_width; BestParticle [ pp ] .starttime = scheduler [globalbestIndx][pp]. starttime; BestParticle [ pp ] .endtime = scheduler [globalbestIndx][pp]. endtime; }*/ } //printf("%ld \n",t); } //fprintf(p1,"%ld\n",mint); // printf("%ld\n",mint); } for ( int i = 0 ; i < SIZE ; i ++ ) { // printf ("{ %d, %d, %ld, %ld, %d }\n", BestParticle[i].corenum, BestParticle[i].tam_width, BestParticle[i]. starttime, BestParticle[i]. endtime, BestParticle[i]. tsv); } print_csv(mint, BestParticle); return 0; }