Skip to content

Instantly share code, notes, and snippets.

@herrfz
Created March 20, 2014 14:07
Show Gist options
  • Save herrfz/9664499 to your computer and use it in GitHub Desktop.
Save herrfz/9664499 to your computer and use it in GitHub Desktop.
nMAP tests
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import pandas as pd\n",
"import os\n",
"import subprocess as sp"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Collect data for bitrate statistics"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
">>> import os\n",
">>> import subprocess as sp\n",
">>> for dirname, subdirs, files in os.walk('.'):\n",
"... with open('python_test_results', 'a+') as f:\n",
"... if 'test.log' in files:\n",
"... f.write(' '.join([dirname, \n",
" sp.check_output([\"grep Mbps \" + dirname + \"/test.log \" + \"| grep -v average | cut -d' ' -f4\"], \n",
" shell=True).strip().replace('\\n', ' ')]) + '\\n')\n",
"'''\n",
"\n",
"df = pd.read_csv('python_test_results', sep=' ', \n",
" header=None, names=['path', 'stream1', 'stream2'])\n",
"df.head()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>path</th>\n",
" <th>stream1</th>\n",
" <th>stream2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td> ./03-12_21-00_DualWAP/192.168.1.10</td>\n",
" <td> 1.659238</td>\n",
" <td> 1.642646</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td> ./03-12_21-00_DualWAP/192.168.1.3</td>\n",
" <td> 1.377036</td>\n",
" <td> 1.443399</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td> ./03-12_21-00_DualWAP/192.168.1.15</td>\n",
" <td> 0.514400</td>\n",
" <td> 0.481213</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td> ./03-12_21-00_DualWAP/192.168.1.7</td>\n",
" <td> 1.476616</td>\n",
" <td> 1.360478</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td> ./03-12_21-00_DualWAP/192.168.1.11</td>\n",
" <td> 1.443402</td>\n",
" <td> 1.343857</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows \u00d7 3 columns</p>\n",
"</div>"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"text": [
" path stream1 stream2\n",
"0 ./03-12_21-00_DualWAP/192.168.1.10 1.659238 1.642646\n",
"1 ./03-12_21-00_DualWAP/192.168.1.3 1.377036 1.443399\n",
"2 ./03-12_21-00_DualWAP/192.168.1.15 0.514400 0.481213\n",
"3 ./03-12_21-00_DualWAP/192.168.1.7 1.476616 1.360478\n",
"4 ./03-12_21-00_DualWAP/192.168.1.11 1.443402 1.343857\n",
"\n",
"[5 rows x 3 columns]"
]
}
],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Statistics for dual nMAP tests; average stream (application) bitrate per stream, averaged over all RPis "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"df[df.path.apply(lambda x: 'Dual' in x)].mean(axis=1).describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 19,
"text": [
"count 120.000000\n",
"mean 1.123260\n",
"std 0.388230\n",
"min 0.447986\n",
"25% 0.638797\n",
"50% 1.306548\n",
"75% 1.410224\n",
"max 1.650981\n",
"dtype: float64"
]
}
],
"prompt_number": 19
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Statistics for single nMAP tests; average stream (application) bitrate per stream, averaged over all RPis"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"df[df.path.apply(lambda x: 'Singe' in x)].mean(axis=1).describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 20,
"text": [
"count 60.000000\n",
"mean 1.659164\n",
"std 0.000387\n",
"min 1.659057\n",
"25% 1.659097\n",
"50% 1.659121\n",
"75% 1.659133\n",
"max 1.662104\n",
"dtype: float64"
]
}
],
"prompt_number": 20
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Collect data for queue sizes"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"res = []\n",
"\n",
"for dirname, subdirs, files in os.walk('./test_logs/'):\n",
" if 'test.log' in files:\n",
" df2 = pd.read_csv(dirname + '/test.log', sep=' ', \n",
" header=None, names=['date', 'time', 'sid', 'qsize'], \n",
" error_bad_lines=False).dropna()\n",
" df2 = df2[df2.sid.apply(lambda x: ':' not in x)]\n",
" df2.sid = df2.sid.apply(lambda x: x.strip(',')).astype(int)\n",
" df2.qsize = df2.qsize.astype(int)\n",
" res.append( [dirname, df2.groupby('sid')['qsize'].max().max()] )"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 21
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"df3 = pd.DataFrame(res, columns=['path', 'max_qsize'])\n",
"df3.tail()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>path</th>\n",
" <th>max_qsize</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>175</th>\n",
" <td> ./test_logs/03-13_06-00_SingeWAP\\192.168.1.11</td>\n",
" <td> 1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>176</th>\n",
" <td> ./test_logs/03-13_06-00_SingeWAP\\192.168.1.12</td>\n",
" <td> 1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>177</th>\n",
" <td> ./test_logs/03-13_06-00_SingeWAP\\192.168.1.3</td>\n",
" <td> 1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>178</th>\n",
" <td> ./test_logs/03-13_06-00_SingeWAP\\192.168.1.7</td>\n",
" <td> 1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>179</th>\n",
" <td> ./test_logs/03-13_06-00_SingeWAP\\192.168.1.9</td>\n",
" <td> 1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows \u00d7 2 columns</p>\n",
"</div>"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 22,
"text": [
" path max_qsize\n",
"175 ./test_logs/03-13_06-00_SingeWAP\\192.168.1.11 1\n",
"176 ./test_logs/03-13_06-00_SingeWAP\\192.168.1.12 1\n",
"177 ./test_logs/03-13_06-00_SingeWAP\\192.168.1.3 1\n",
"178 ./test_logs/03-13_06-00_SingeWAP\\192.168.1.7 1\n",
"179 ./test_logs/03-13_06-00_SingeWAP\\192.168.1.9 1\n",
"\n",
"[5 rows x 2 columns]"
]
}
],
"prompt_number": 22
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Max queue sizes per stream for dual vs single nMAP, maximum over all RPis"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"df3.groupby(df3.path.map(lambda x: 'Dual' in x))['max_qsize'].max()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 23,
"text": [
"path\n",
"False 1\n",
"True 70\n",
"Name: max_qsize, dtype: int64"
]
}
],
"prompt_number": 23
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"up to 70 requests are queued for dual nMAP tests."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
@Masud2017
Copy link

Do you have any update distro nmap have no update distro yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment