start

parent 69aa7864
{
"cells": [],
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import re"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"log_file_path = 'https://polaris.imag.fr/arnaud.legrand/teaching/2014/RICM4_EP_ping/liglab2.log.gz'"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"data = pd.read_csv(log_file_path, delimiter='\\t', header=None)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def extract_info(row):\n",
" timestamp = re.search(r'\\[(.*?)\\]', row).group(1)\n",
" message_size = re.search(r'(\\d+) bytes', row).group(1)\n",
" return float(timestamp), int(message_size)\n",
"\n",
"\n",
"data[['timestamp', 'message_size']] = data[0].apply(extract_info).apply(pd.Series)\n",
"\n",
"data.head()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(10, 6))\n",
"plt.plot(data['timestamp'], data['message_size'], label='Message Size over Time')\n",
"plt.xlabel('Time (s)')\n",
"plt.ylabel('Message Size (bytes)')\n",
"plt.title('Evolution of Transmission Size Over Time')\n",
"plt.grid(True)\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>[1421761682.052172] 665 bytes from lig-publig....</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>[1421761682.277315] 1373 bytes from lig-publig...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>[1421761682.502054] 262 bytes from lig-publig....</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>[1421761682.729257] 1107 bytes from lig-publig...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>[1421761682.934648] 1128 bytes from lig-publig...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0\n",
"0 [1421761682.052172] 665 bytes from lig-publig....\n",
"1 [1421761682.277315] 1373 bytes from lig-publig...\n",
"2 [1421761682.502054] 262 bytes from lig-publig....\n",
"3 [1421761682.729257] 1107 bytes from lig-publig...\n",
"4 [1421761682.934648] 1128 bytes from lig-publig..."
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
......@@ -16,10 +171,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment