-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# HTTP/2 Test Reults Analysis | ||
|
||
This tools provides an easy way to get statistical parameters using test results files. By the moment these are the calculated parameters: | ||
|
||
- **Cumulative Mean:** Evolution of the mean value along each test sample result. Used to view the mean stabilisation of value along the time. | ||
- **Mean:** Last value of cumulative mean evolution. | ||
- **Typical deviation.** | ||
|
||
|
||
## How to use? | ||
|
||
You must follow the following steps: | ||
|
||
1. Launch the installation script if it's the first time that you are using this tool. | ||
2. Put all test results files inside "data" directory. | ||
3. Launch the cumulative mean calculator script. | ||
4. Launch the statistical parameters calculator. The calculated values are shown under standard output. | ||
|
||
### Installation script: | ||
|
||
This tool is used to make the basic directory structure for the statistics tools. Run it only if it's the first time that you are using this tool. | ||
|
||
```sh | ||
$ ./install.sh | ||
``` | ||
|
||
### Cumulative mean calculator: | ||
|
||
This script should be executed with the following command: | ||
|
||
```sh | ||
$ ./cumulat_mean.sh | ||
``` | ||
|
||
The output files are stored under "mean" directory with its graph representation. | ||
|
||
### Statistical parameters calculator: | ||
|
||
This script should be executed with the following command: | ||
|
||
```sh | ||
$ python statistics.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
import glob | ||
# Reading all *.dat filenames with the tests time values | ||
files = glob.glob("data/*.dat") | ||
# Loading files and processing data | ||
i = 1 | ||
for datafile in files: | ||
print ('Current filename ' + str(i) + ': ' + datafile) | ||
i += 1 | ||
f = open(datafile + '_mean.mdat', 'w') # Calculated values of mean | ||
# Creating local variables for statistics | ||
index = 1 # Storage the index of the value | ||
currentValue = 0 # Value read from the file | ||
previousValue = 0 # Value read from the previous iteration | ||
mean = 0 # Contains the mean cumulative | ||
for fileLine in open(datafile): | ||
currentVal = float(fileLine) | ||
if index > 1: | ||
if index > 2: | ||
print('Index greather than 2') | ||
mean = (mean * (index - 1) + currentVal) / index | ||
else: | ||
print('Index equal than 2') | ||
mean = (currentVal + previousValue) / index | ||
print ('Mean value: ' + str(mean)) | ||
f.write(str(mean)+'\n') | ||
else: | ||
print('Readed first value from file...') | ||
# Preparing variables for the next iteration | ||
previousValue = currentVal | ||
index += 1 | ||
print 'End calculator' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "***************************************************" | ||
echo "* Calculating data files *" | ||
echo "***************************************************" | ||
python calculator.py | ||
cp data/*.mdat mean/ | ||
rm data/*.mdat | ||
FILES_TO_PLOT=$(find mean/ -type f) | ||
echo "Done!" | ||
|
||
echo "***************************************************" | ||
echo "* Drawing files... *" | ||
echo "***************************************************" | ||
for COMMAND in $FILES_TO_PLOT | ||
do | ||
echo "File to graph:" | ||
echo $COMMAND | ||
# Saving result to $FILENAME external file: | ||
testPage=$(echo $COMMAND | awk -F[/] '{print $2}') | ||
FILENAME_GRAPH="${testPage}_${NUMBERTESTS}_mgraph.png" | ||
echo $FILENAME_GRAPH | ||
gnuplot -e "set term png; plot '$COMMAND' w l; set output 'graph.png'; replot;" | ||
cp graph.png mean/$FILENAME_GRAPH | ||
rm graph.png | ||
done | ||
|
||
echo "===============================================" | ||
echo " DONE! ALL GRAPHS HAS BEEN CREATED SUSCESFULLY!" | ||
echo "===============================================" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
sudo apt-get install gnuplot -y | ||
|
||
mkdir -p data | ||
mkdir -p mean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# This tool provides an automatic way to get basic statistic values as: Mean value and Standar deviation | ||
# The mean data files should be inside "data" directory and "mean" for each file shoud be inside "mean" directory. | ||
# | ||
# | ||
import glob | ||
import os | ||
import math | ||
# Reading all *.dat filenames with the tests time values | ||
files = glob.glob("data/*.dat") | ||
# Loading files and processing data | ||
n = 0 | ||
for datafile in files: | ||
# Reading last value of accumulated mean for the curren test | ||
fshell = os.popen('tail -n 1 mean/' + os.path.basename(datafile) + '_mean.mdat') | ||
meanValue = float(fshell.read()) / 1000 # Parsing units us to ms. | ||
## Creating local variables for statistics | ||
sumatoryValue = 0 # Contains the result of the summatory used for calc Standard deviation | ||
n = 0 # Number of statistical samples storaged in to .dat file. | ||
for fileLine in open(datafile): | ||
fileLine = float(fileLine) / 1000 # Parsing units us to ms. | ||
sumatoryValue = sumatoryValue + math.pow(fileLine-meanValue, 2) | ||
#print str(sumatoryValue) | ||
n += 1 | ||
# Calculate Standard deviation | ||
sDeviation = math.sqrt((1 / float(n)) * sumatoryValue) | ||
print ('- Current filename: ' + os.path.basename(datafile) + '\tMean value: ' + str(meanValue) + '\tStandar Deviation: ' + str(sDeviation)) | ||
print 'End calculator' |