Changeset 49a047f


Ignore:
Timestamp:
11/14/18 16:50:04 (2 years ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
96ec511
Parents:
eeef260
Message:

Added Zipf's Distribution to plot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/tutorial/ipdist-parallel.c

    r4d1d3a3 r49a047f  
    6262uint64_t tickrate;
    6363
    64 char *stats_outputdir = "";
     64char *stats_outputdir = "/home/jcv9/output-spectre/";
    6565/* Calculate and plot the percentage change from the previous plot */
    6666int stats_percentage_change = 0;
     
    484484                FILE *gnuplot = popen("gnuplot -persistent", "w");
    485485                /* send all commands to gnuplot */
    486                 fprintf(gnuplot, "set term pngcairo size 1280,960 \n");
    487                 fprintf(gnuplot, "set title 'IP Distribution - Octet %d'\n", i+1);
     486                fprintf(gnuplot, "set term pngcairo dashed enhanced size 1280,960\n");
     487                fprintf(gnuplot, "set output '%s'\n", outputplot);
     488                fprintf(gnuplot, "set multiplot layout 2,1\n");
     489                fprintf(gnuplot, "set title 'IP Distribution'\n");
    488490                fprintf(gnuplot, "set xrange[0:255]\n");
    489491                fprintf(gnuplot, "set xlabel 'Prefix'\n");
    490492                fprintf(gnuplot, "set ylabel 'Hits'\n");
    491493                fprintf(gnuplot, "set xtics 0,10,255\n");
    492                 fprintf(gnuplot, "set output '%s'\n", outputplot);
    493494                fprintf(gnuplot, "plot '%s' using %d:%d title 'Source octet %d' smooth unique with boxes,", outputfile, (i*4)+3,(i*4)+4, i+1);
    494495                fprintf(gnuplot, "'%s' using %d:%d title 'Destination octet %d' smooth unique with boxes\n", outputfile, (i*4)+5, (i*4)+6, i+1);
     496                fprintf(gnuplot, "set title 'Zipf Distribution'\n");
     497                fprintf(gnuplot, "set xlabel 'Rank'\n");
     498                fprintf(gnuplot, "set ylabel 'Frequency'\n");
     499                fprintf(gnuplot, "set xrange[1:255]\n");
     500                fprintf(gnuplot, "set logscale xy 10\n");
     501                fprintf(gnuplot, "plot '%s' using 2:%d title 'Source octet %d',", outputfile, (i*4)+4, i+1);
     502                fprintf(gnuplot, "'%s' using 2:%d title 'Destination octet %d'\n", outputfile, (i*4)+6, i+1);
    495503                fprintf(gnuplot, "replot");
    496504                pclose(gnuplot);
     
    515523                        }
    516524                        fprintf(gnuplot, "set xtics rotate\n");
    517                         fprintf(gnuplot, "set key off\n");
     525                        fprintf(gnuplot, "set key out vert\n");
     526                        fprintf(gnuplot, "set key right\n");
    518527                        //fprintf(gnuplot, "set xdata time\n");
    519528                        //fprintf(gnuplot, "set timefmt '%%s'\n");
Note: See TracChangeset for help on using the changeset viewer.