From 18c3badd052a36160ef3db91098d41786d638b72 Mon Sep 17 00:00:00 2001 From: Jaume Nin Date: Wed, 14 Nov 2012 14:12:48 +0100 Subject: [PATCH] Profiling scripts updated and documentation fixed --- src/lte/doc/source/lte-profiling.rst | 16 +++- src/lte/test/epc-test-run-gnuplot | 70 ++++++++++++++++ src/lte/test/epc-test-run-time.pl | 12 ++- src/lte/test/lte-test-run-gnuplot | 115 +++++++++++++++++++++++++++ src/lte/test/lte-test-run-time.pl | 22 ++--- 5 files changed, 218 insertions(+), 17 deletions(-) create mode 100644 src/lte/test/epc-test-run-gnuplot create mode 100644 src/lte/test/lte-test-run-gnuplot diff --git a/src/lte/doc/source/lte-profiling.rst b/src/lte/doc/source/lte-profiling.rst index ccdd80816..d93ede3b9 100644 --- a/src/lte/doc/source/lte-profiling.rst +++ b/src/lte/doc/source/lte-profiling.rst @@ -65,15 +65,23 @@ Running time is measured using default Linux shell command **time**. This comman Perl script ~~~~~~~~~~~ -To simplify the process of running the profiling script for a wide range of values and collecting its timing data, a simple Perl script to automate the complete process is provided. It is placed in ``src/lte/test/lte-test-run-time.pl`` for *lena-profiling* and in ``src/lte/epc-test-run-time.pl`` for *lena-simple-epc*. It simply runs a batch of simulations with a range of parameters and stores the timing results in a CSV file called *times.csv* and *epcTimes.csv* respectively. The range of values each parameter sweeps can be modified editing the corresponding script. +To simplify the process of running the profiling script for a wide range of values and collecting its timing data, a simple Perl script to automate the complete process is provided. It is placed in ``src/lte/test/lte-test-run-time.pl`` for *lena-profiling* and in ``src/lte/epc-test-run-time.pl`` for *lena-simple-epc*. It simply runs a batch of simulations with a range of parameters and stores the timing results in a CSV file called *lteTimes.csv* and *epcTimes.csv* respectively. The range of values each parameter sweeps can be modified editing the corresponding script. Requirements ------------ The following Perl modules are required to use the provided script, all of them available from CPAN: -* IO::CaptureOutput -* Statistics::Descriptive -* Cwd + * IO::CaptureOutput + * Statistics::Descriptive + +For installing the modules, simply use the follwing command: + +``perl -MCPAN -e 'install moduleName'`` + +Plotting results +---------------- + +To plot the results obtained from running the Perl scripts, two gnuplot scripts are provided, in ``src/lte/test/lte-test-run-plot`` and ``src/lte/test/epc-test-run-plot``. Most of the plots available in this documentation can be reproduced with those, typing the commands ``gnuplot < src/lte/test/lte-test-run-plot`` and ``gnuplot < src/lte/test/epc-test-run-plot``. Reference software and equipment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/lte/test/epc-test-run-gnuplot b/src/lte/test/epc-test-run-gnuplot new file mode 100644 index 000000000..733cd3ac8 --- /dev/null +++ b/src/lte/test/epc-test-run-gnuplot @@ -0,0 +1,70 @@ +set style line 11 lc rgb "black" lt 3 lw 2 pt 1 ps 2 +set style line 12 lc rgb "red" lt 3 lw 2 pt 2 ps 2 +set style line 13 lc rgb "blue" lt 3 lw 2 pt 1 ps 2 +set style line 14 lc rgb "orange" lt 3 lw 2 pt 1 ps 2 +set style line 15 lc rgb "green" lt 3 lw 2 pt 1 ps 2 +set style line 16 lc rgb "yellow" lt 3 lw 2 pt 1 ps 2 + + +set style line 21 lc rgb "black" lt 1 lw 2 pt 1 ps 1 +set style line 22 lc rgb "red" lt 1 lw 2 pt 2 ps 1 +set style line 23 lc rgb "blue" lt 1 lw 2 pt 3 ps 1 +set style line 24 lc rgb "orange" lt 1 lw 1 pt 4 ps 1 +set style line 25 lc rgb "green" lt 1 lw 1 pt 5 ps 1 +set style line 26 lc rgb "purple" lt 1 lw 1 pt 6 ps 1 +set style line 27 lc rgb "yellow" lt 1 lw 1 pt 7 ps 1 +set style line 28 lc rgb "pink" lt 1 lw 1 pt 8 ps 1 +set style line 29 lc rgb "magenta" lt 1 lw 1 pt 9 ps 1 + +set style line 31 lc rgb "black" lt 2 lw 2 pt 1 ps 1 +set style line 32 lc rgb "red" lt 2 lw 2 pt 2 ps 1 +set style line 33 lc rgb "blue" lt 2 lw 2 pt 3 ps 1 +set style line 34 lc rgb "orange" lt 2 lw 1 pt 4 ps 1 +set style line 35 lc rgb "green" lt 2 lw 1 pt 5 ps 1 +set style line 36 lc rgb "purple" lt 2 lw 1 pt 6 ps 1 +set style line 37 lc rgb "yellow" lt 2 lw 1 pt 7 ps 1 +set style line 38 lc rgb "pink" lt 2 lw 1 pt 8 ps 1 +set style line 39 lc rgb "magenta" lt 2 lw 1 pt 9 ps 1 + +set style line 50 lc rgb "black" lt 1 lw 2 pt 0 ps 0 + + + +set term postscript eps enhanced +set output 'epcRunningTime.eps' +set grid +set xrange [*:23] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Number eNodeB' +set title 'Simulation time = 5 s - 1 UE per eNodeB' +set key on top left +plot \ +"../../../epcTimes.csv" using 2:($1==5 ? $3 : 1/0) with linespoints ls 21 title "" + +set term postscript eps enhanced +set output 'epcSimulationTime.eps' +set grid +set xrange [*:11] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Simulation time [s]' +set title '1 UE per eNodeB' +set key on top left +plot \ +"../../../epcTimes.csv" using 1:2 with linespoints ls 21 title "8 eNodeBs" + + +set term postscript eps enhanced +set output 'epcEutranRunningTime.eps' +set grid +set xrange [*:23] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Number eNodeB' +set title 'Simulation time = 5 s - 1 UE per eNodeB' +set key on top left +plot \ +"../../../epcTimes.csv" using 2:3 with linespoints ls 21 title "EUTRAN + EPC", \ +"../../../lteTimes.csv" using 3:($3==$4 ? $5 : 1/0) with linespoints ls 22 title "EUTRAN" + diff --git a/src/lte/test/epc-test-run-time.pl b/src/lte/test/epc-test-run-time.pl index 78c4981a1..56200b6c6 100755 --- a/src/lte/test/epc-test-run-time.pl +++ b/src/lte/test/epc-test-run-time.pl @@ -10,7 +10,14 @@ open( FILE, '>epcTimes.csv' ); print FILE "#sTime\tnodes\trTime\trTDev\n"; my @nodes = ( 1,2,3,4,5,6,7, 8, 12, 14); -my @simTime = ( 1, 2, 5, 7, 10); +my @simTime = (5, 10); + + +# Configure and complite first the program to avoid counting compilation time as running time +my $launch = "CXXFLAGS=\"-O3 -w\" ./waf -d optimized configure --enable-static --enable-examples --enable-modules=lte" +my $out, my $err; +capture { system($launch ) } \$out, \$err; +$launch = "./waf --run \'lena-profiling --simTime=0.1 --nUe=1 --nEnb=1 --nFloors=0\'"; foreach my $time (@simTime) { @@ -19,8 +26,7 @@ foreach my $time (@simTime) my $timeStats = Statistics::Descriptive::Full->new(); for ( my $iteration = 0 ; $iteration < $nIterations ; $iteration++ ) { - my $launch = "time ./waf --run \'lena-simple-epc --simTime=$time --numberOfNodes=$node'"; - my $out, my $err; + $launch = "time ./waf --run \'lena-simple-epc --simTime=$time --numberOfNodes=$node'"; print "$launch\n"; capture { system($launch ) } \$out, \$err; $err =~ /real(.+)m(.+)s/; diff --git a/src/lte/test/lte-test-run-gnuplot b/src/lte/test/lte-test-run-gnuplot new file mode 100644 index 000000000..84d9d3e14 --- /dev/null +++ b/src/lte/test/lte-test-run-gnuplot @@ -0,0 +1,115 @@ +set style line 11 lc rgb "black" lt 3 lw 2 pt 1 ps 2 +set style line 12 lc rgb "red" lt 3 lw 2 pt 2 ps 2 +set style line 13 lc rgb "blue" lt 3 lw 2 pt 1 ps 2 +set style line 14 lc rgb "orange" lt 3 lw 2 pt 1 ps 2 +set style line 15 lc rgb "green" lt 3 lw 2 pt 1 ps 2 +set style line 16 lc rgb "yellow" lt 3 lw 2 pt 1 ps 2 + + +set style line 21 lc rgb "black" lt 1 lw 2 pt 1 ps 1 +set style line 22 lc rgb "red" lt 1 lw 2 pt 2 ps 1 +set style line 23 lc rgb "blue" lt 1 lw 2 pt 3 ps 1 +set style line 24 lc rgb "orange" lt 1 lw 1 pt 4 ps 1 +set style line 25 lc rgb "green" lt 1 lw 1 pt 5 ps 1 +set style line 26 lc rgb "purple" lt 1 lw 1 pt 6 ps 1 +set style line 27 lc rgb "yellow" lt 1 lw 1 pt 7 ps 1 +set style line 28 lc rgb "pink" lt 1 lw 1 pt 8 ps 1 +set style line 29 lc rgb "magenta" lt 1 lw 1 pt 9 ps 1 + +set style line 31 lc rgb "black" lt 2 lw 2 pt 1 ps 1 +set style line 32 lc rgb "red" lt 2 lw 2 pt 2 ps 1 +set style line 33 lc rgb "blue" lt 2 lw 2 pt 3 ps 1 +set style line 34 lc rgb "orange" lt 2 lw 1 pt 4 ps 1 +set style line 35 lc rgb "green" lt 2 lw 1 pt 5 ps 1 +set style line 36 lc rgb "purple" lt 2 lw 1 pt 6 ps 1 +set style line 37 lc rgb "yellow" lt 2 lw 1 pt 7 ps 1 +set style line 38 lc rgb "pink" lt 2 lw 1 pt 8 ps 1 +set style line 39 lc rgb "magenta" lt 2 lw 1 pt 9 ps 1 + +set style line 50 lc rgb "black" lt 1 lw 2 pt 0 ps 0 + + + +set term postscript eps enhanced +set output 'runningTime10s.eps' +set grid +set xrange [0:31] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Number of UEs per eNodeB' +set title 'Simulation time = 10 s - Friis Model' +set key on top left +plot \ +"../../../lteTimes.csv" using 4:($1==10 && $3==1 && $2==0 ? $5 : 1/0) with linespoints ls 21 title "1 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==2 && $2==0 ? $5 : 1/0) with linespoints ls 22 title "2 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==4 && $2==0 ? $5 : 1/0) with linespoints ls 23 title "4 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==6 && $2==0 ? $5 : 1/0) with linespoints ls 24 title "6 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==8 && $2==0 ? $5 : 1/0) with linespoints ls 25 title "8 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==12 && $2==0 ? $5 : 1/0) with linespoints ls 26 title "12 eNodeB",\ +"../../../lteTimes.csv" using 4:($1==10 && $3==14 && $2==0 ? $5 : 1/0) with linespoints ls 27 title "14 eNodeB",\ +"../../../lteTimes.csv" using 4:($1==10 && $3==18 && $2==0 ? $5 : 1/0) with linespoints ls 28 title "18 eNodeB",\ +"../../../lteTimes.csv" using 4:($1==10 && $3==22 && $2==0 ? $5 : 1/0) with linespoints ls 29 title "22 eNodeB" + +set term postscript eps enhanced +set output 'runningTime5s.eps' +set grid +set xrange [*:31] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Number of UEs per eNodeB' +set title 'Simulation time = 5 s - Friis Model' +set key on top left +plot \ +"../../../lteTimes.csv" using 4:($1==5 && $3==1 && $2==0 ? $5 : 1/0) with linespoints ls 21 title "1 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==5 && $3==2 && $2==0 ? $5 : 1/0) with linespoints ls 22 title "2 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==5 && $3==4 && $2==0 ? $5 : 1/0) with linespoints ls 23 title "4 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==5 && $3==6 && $2==0 ? $5 : 1/0) with linespoints ls 24 title "6 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==5 && $3==8 && $2==0 ? $5 : 1/0) with linespoints ls 25 title "8 eNodeB", \ +"../../../lteTimes.csv" using 4:($1==5 && $3==12 && $2==0 ? $5 : 1/0) with linespoints ls 26 title "12 eNodeB",\ +"../../../lteTimes.csv" using 4:($1==5 && $3==14 && $2==0 ? $5 : 1/0) with linespoints ls 27 title "14 eNodeB",\ +"../../../lteTimes.csv" using 4:($1==5 && $3==18 && $2==0 ? $5 : 1/0) with linespoints ls 28 title "18 eNodeB",\ +"../../../lteTimes.csv" using 4:($1==5 && $3==22 && $2==0 ? $5 : 1/0) with linespoints ls 29 title "22 eNodeB" + +set term postscript eps enhanced +set output 'propagationModel.eps' +set grid +set xrange [0:31] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Number of UEs per eNodeB' +set title 'Simulation time = 10 s' +set key on top left +plot \ +"../../../lteTimes.csv" using 4:($1==10 && $3==4 && $2==0 ? $5 : 1/0) with linespoints ls 21 title "4 eNodeB - Friis", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==4 && $2==1 ? $5 : 1/0) with linespoints ls 31 title "4 eNodeB - Building", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==8 && $2==0 ? $5 : 1/0) with linespoints ls 22 title "8 eNodeB - Friis", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==8 && $2==1 ? $5 : 1/0) with linespoints ls 32 title "8 eNodeB - Building", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==12 && $2==0 ? $5 : 1/0) with linespoints ls 23 title "12 eNodeB - Friis", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==12 && $2==1 ? $5 : 1/0) with linespoints ls 33 title "12 eNodeB - Building", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==14 && $2==0 ? $5 : 1/0) with linespoints ls 24 title "14 eNodeB - Friis", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==14 && $2==1 ? $5 : 1/0) with linespoints ls 34 title "14 eNodeB - Building", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==18 && $2==0 ? $5 : 1/0) with linespoints ls 25 title "18 eNodeB - Friis", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==18 && $2==1 ? $5 : 1/0) with linespoints ls 35 title "18 eNodeB - Building", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==22 && $2==0 ? $5 : 1/0) with linespoints ls 26 title "22 eNodeB - Friis", \ +"../../../lteTimes.csv" using 4:($1==10 && $3==22 && $2==1 ? $5 : 1/0) with linespoints ls 36 title "22 eNodeB - Building" + +set term postscript eps enhanced +set output 'simulationTime.eps' +set grid +set xrange [0:16] +set yrange [*:*] +set ylabel "Running time [s]" +set xlabel 'Simulation time' +set title 'Friis propagation model 15 UE per eNodeB' +set key on top left +plot \ +"../../../lteTimes.csv" using 1:($4==15 && $3==1 && $2==0 ? $5 : 1/0) with linespoints ls 21 title "1 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==2 && $2==0 ? $5 : 1/0) with linespoints ls 22 title "2 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==4 && $2==0 ? $5 : 1/0) with linespoints ls 23 title "4 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==6 && $2==0 ? $5 : 1/0) with linespoints ls 24 title "6 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==8 && $2==0 ? $5 : 1/0) with linespoints ls 25 title "8 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==12 && $2==0 ? $5 : 1/0) with linespoints ls 26 title "12 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==14 && $2==0 ? $5 : 1/0) with linespoints ls 27 title "14 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==18 && $2==0 ? $5 : 1/0) with linespoints ls 28 title "18 eNodeB", \ +"../../../lteTimes.csv" using 1:($4==15 && $3==22 && $2==0 ? $5 : 1/0) with linespoints ls 29 title "22 eNodeB" + diff --git a/src/lte/test/lte-test-run-time.pl b/src/lte/test/lte-test-run-time.pl index 9b76ed7b0..6dcdcb19d 100755 --- a/src/lte/test/lte-test-run-time.pl +++ b/src/lte/test/lte-test-run-time.pl @@ -2,20 +2,23 @@ use strict; use IO::CaptureOutput qw(capture qxx qxy); use Statistics::Descriptive; -use Cwd; my $nIterations = 1; -open( FILE, '>times.csv' ); +open( FILE, '>lteTimes.csv' ); print FILE "#sTime\tnFloors\tnEnb\tnUe\trTime\trTDev\n"; -my @nUe = ( 1, 5, 10, 15, 20, 25, 30 ); -my @nEnb = ( 1, 2, 4, 6, 8, 12, 14, 18, 22 ); -my @nFloors = ( 0, 1 ); -my @simTime = ( 1, 5); +my @nUe = (1, 5, 10, 15, 20, 25, 30); +my @nEnb = (1, 2, 4, 6, 8, 12, 14, 18, 22); +my @nFloors = (0, 1); +my @simTime = (5, 10); -my $traceDirectory = "."; -my $traceDirectory = getcwd() . "/"; +# Configure and complite first the program to avoid counting compilation time as running time +my $launch = "CXXFLAGS=\"-O3 -w\" ./waf -d optimized configure --enable-static --enable-examples --enable-modules=lte" +my $out, my $err; +capture { system($launch ) } \$out, \$err; +$launch = "./waf --run \'lena-profiling --simTime=0.1 --nUe=1 --nEnb=1 --nFloors=0\'"; +capture { system($launch ) } \$out, \$err; foreach my $time (@simTime) { @@ -28,8 +31,7 @@ foreach my $time (@simTime) my $timeStats = Statistics::Descriptive::Full->new(); for ( my $iteration = 0 ; $iteration < $nIterations ; $iteration++ ) { - my $launch = "time ./waf --run \'lena-profiling --simTime=$time --nUe=$ue --nEnb=$enb --nFloors=$floor --traceDirectory=$traceDirectory\'"; - my $out, my $err; + $launch = "time ./waf --run \'lena-profiling --simTime=$time --nUe=$ue --nEnb=$enb --nFloors=$floor\'"; print "$launch\n"; capture { system($launch ) } \$out, \$err; $err =~ /real(.+)m(.+)s/;