Changeset eac29c7
 Timestamp:
 11/15/18 17:01:27 (4 years ago)
 Branches:
 develop
 Children:
 f611921
 Parents:
 96ec511
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

examples/tutorial/ipdistparallel.c
r96ec511 reac29c7 33 33 double mean_src[4]; 34 34 double mean_dst[4]; 35 double median_src[4]; 36 double median_dst[4]; 35 37 double stddev_src[4]; 36 38 double stddev_dst[4]; … … 64 66 uint64_t tickrate; 65 67 66 char *stats_outputdir = " /home/jcv9/outputspectre/";68 char *stats_outputdir = ""; 67 69 /* Calculate and plot the percentage change from the previous plot */ 68 70 int stats_percentage_change = 0; … … 159 161 } 160 162 } 163 161 164 tally>stats>mean_src[k] = (k + (ex / n)); 162 165 tally>stats>variance_src[k] = ((ex2  (ex*ex)/n) / n); … … 180 183 tally>stats>variance_dst[k] = ((ex2  (ex*ex)/n) / n); 181 184 tally>stats>stddev_dst[k] = sqrt(tally>stats>variance_dst[k]); 182 185 /* Get the median */ 186 int c = (n/2)  tally>src[k][0]; 187 int c2 = 0; 188 while(c > 0) { 189 c2 += 1; 190 c = tally>src[k][c2]; 191 } 192 tally>stats>median_src[k] = c2; 193 c = (n/2)  tally>dst[k][0]; 194 c2 = 0; 195 while(c > 0) { 196 c2 += 1; 197 c = tally>dst[k][c2]; 198 } 199 tally>stats>median_dst[k] = c2; 200 /* Get the mode which is the first item in the priority queue */ 183 201 tally>stats>mode_src[k] = peak(&tally>stats>rank_src[k]); 184 202 tally>stats>mode_dst[k] = peak(&tally>stats>rank_src[k]); 185 /* Calculate skewness using pearsons mode method. This is accurate with large amounts of data */ 186 tally>stats>skewness_src[k] = (tally>stats>mean_src[k]  tally>stats>mode_src[k]) / tally>stats>stddev_src[k]; 187 tally>stats>skewness_dst[k] = (tally>stats>mean_dst[k]  tally>stats>mode_dst[k]) / tally>stats>stddev_dst[k]; 188 } 189 190 printf("skewnesss: %f\n", tally>stats>skewness_dst[1]); 203 /* Calculate skewness */ 204 tally>stats>skewness_src[k] = (tally>stats>mean_src[k]  tally>stats>median_src[k]) / tally>stats>stddev_src[k]; 205 tally>stats>skewness_dst[k] = (tally>stats>mean_dst[k]  tally>stats>median_dst[k]) / tally>stats>stddev_dst[k]; 206 } 191 207 192 208 } … … 392 408 tally>stats>mean_src[i] = 0; 393 409 tally>stats>mean_dst[i] = 0; 410 tally>stats>median_src[i] = 0; 411 tally>stats>median_dst[i] = 0; 394 412 tally>stats>stddev_src[i] = 0; 395 413 tally>stats>stddev_dst[i] = 0; … … 452 470 tmp = fopen(outputfile_stats, "w"); 453 471 /* append stats data to end of file */ 454 fprintf(tmp, "#\tmean\tstddev\tvariance\tm ode\tskewness\n");472 fprintf(tmp, "#\tmean\tstddev\tvariance\tmedian\tmode\tskewness\n"); 455 473 for(i=0;i<4;i++) { 456 fprintf(tmp, "src%d\t%0.f\t%0.f\t%0.f\t\t%0.f\t% f\n", i+1, tally>stats>mean_src[i], tally>stats>stddev_src[i], tally>stats>variance_src[i], tally>stats>mode_src[i], tally>stats>skewness_src[i]);457 fprintf(tmp, "dst%d\t%0.f\t%0.f\t%0.f\t\t%0.f\t% f\n", i+1, tally>stats>mean_dst[i], tally>stats>stddev_dst[i], tally>stats>variance_dst[i], tally>stats>mode_dst[i], tally>stats>skewness_dst[i]);474 fprintf(tmp, "src%d\t%0.f\t%0.f\t%0.f\t\t%0.f\t%0.f\t%f\n", i+1, tally>stats>mean_src[i], tally>stats>stddev_src[i], tally>stats>variance_src[i], tally>stats>median_src[i], tally>stats>mode_src[i], tally>stats>skewness_src[i]); 475 fprintf(tmp, "dst%d\t%0.f\t%0.f\t%0.f\t\t%0.f\t%0.f\t%f\n", i+1, tally>stats>mean_dst[i], tally>stats>stddev_dst[i], tally>stats>variance_dst[i], tally>stats>median_src[i], tally>stats>mode_dst[i], tally>stats>skewness_dst[i]); 458 476 fprintf(tmp, "\n\n"); 459 477 }
Note: See TracChangeset
for help on using the changeset viewer.