mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Initial version of evaluate script
This commit is contained in:
parent
8a7c96feae
commit
381b0fc566
1 changed files with 179 additions and 0 deletions
179
tests/benchmarks/evaluate_logs.ipynb
Normal file
179
tests/benchmarks/evaluate_logs.ipynb
Normal file
|
@ -0,0 +1,179 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Benchmark"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Settings\n",
|
||||
"root_dir = '/home/dennis/VILLASnode/tests'\n",
|
||||
"benchmark_dir = 'benchmarks_20180730_17-16-39'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Load all files\n",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Loaded /home/dennis/VILLASnode/tests/benchmarks_20180730_17-16-39/0_TCP-3-10-300.log\n",
|
||||
"Loaded /home/dennis/VILLASnode/tests/benchmarks_20180730_17-16-39/1_TCP-3-100-300.log\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"# Initialize arrays\n",
|
||||
"result_files = []\n",
|
||||
"result_paths = []\n",
|
||||
"result_array = []\n",
|
||||
"\n",
|
||||
"# Save complete path of files in an array\n",
|
||||
"for subdir, dirs, files in os.walk(root_dir+'/'+benchmark_dir):\n",
|
||||
" for file in files:\n",
|
||||
" result_paths.append(os.path.join(subdir, file))\n",
|
||||
" \n",
|
||||
" result_files = files\n",
|
||||
"\n",
|
||||
"# Loop through array with files and save the comma separated data into a new array\n",
|
||||
"for file in result_paths:\n",
|
||||
" print(\"Loaded {}\".format(file))\n",
|
||||
" \n",
|
||||
" # Load file \n",
|
||||
" result_array.append(np.genfromtxt(file, delimiter=','))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Save characteristics of tests\n",
|
||||
"All important settings are contained in the name of the file. We will save them in a separate array. The structure of the name is as follows:\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"root_dir/benchmarks_${DATE}/${ID}_${MODE}-${VALUES IN SMP}-${RATE}-${SENT SMPS}\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"Thus, we will structure it in the settings_array as follows:\n",
|
||||
"\n",
|
||||
"* `settings_array[*][0] = ID`\n",
|
||||
"* `settings_array[*][1] = MODE`\n",
|
||||
"* `settings_array[*][2] = VALUES IN SAMPLE`\n",
|
||||
"* `settings_array[*][3] = RATE`\n",
|
||||
"* `settings_array[*][4] = TOTAL NUMBER OF SAMPLES`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import re\n",
|
||||
"\n",
|
||||
"# Initialize arrays\n",
|
||||
"settings_array = []\n",
|
||||
"\n",
|
||||
"for file in result_files:\n",
|
||||
" settings = []\n",
|
||||
" \n",
|
||||
" matchObj = re.match( r'(\\d*)_(\\w*)-(\\d*)-(\\d*)-(\\d*).log', file, re.M|re.I)\n",
|
||||
"\n",
|
||||
" # Fill values to array\n",
|
||||
" for i in range(0,4):\n",
|
||||
" settings.append(matchObj.group(i))\n",
|
||||
" \n",
|
||||
" # Append array to big array\n",
|
||||
" settings_array.append(settings)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Process data\n",
|
||||
"\n",
|
||||
"### Number of samples\n",
|
||||
"* First number which appears in `result_array[*][3]` will be the first sample in the benchmark. Ignore all missing samples before that entry.\n",
|
||||
"* After that, check how many samples are missing."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"###"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Plot data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"###"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
Loading…
Add table
Reference in a new issue