diff --git a/notebook.ipynb b/notebook.ipynb index d355dff9eef6785ffdd422298629d5beb2c4f331..77f4005e03e0799534bc551961bb63b28d25dc30 100644 --- a/notebook.ipynb +++ b/notebook.ipynb @@ -17,9 +17,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import logging\n", @@ -29,10 +27,12 @@ "import ipywidgets as widgets\n", "from xlap.parse import evaluate, evaluate_side, parse_config\n", "import xlap.analyse.jitter as jitter\n", + "from xlap.analyse.cdf import multi_cdf\n", "from xlap.analyse.regress import linear as linear_regression\n", "from xlap.analyse.trace import traces\n", - "from xlap.analyse.correlation import correlation\n", + "from xlap.analyse.correlation import correlation, multi_correlation\n", "from xlap.analyse.latency import analyse\n", + "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "%matplotlib inline" ] @@ -51,8 +51,17 @@ "outputs": [], "source": [ "config = parse_config()\n", - "data_files = config[\"data_files\"]\n", - "original = evaluate(data_files[\"sender\"], data_files[\"receiver\"], config=config, kind=0)" + "data_files = {\n", + " \"sender\": \"~/Work/Publications/rtn-2018/eval/20180417_testbed/\",\n", + " \"receiver\": \"~/Work/Publications/rtn-2018/eval/20180417_testbed/\"\n", + "}\n", + "original1 = evaluate(data_files[\"sender\"] + \"sender-1000000.csv\", data_files[\"receiver\"] + \"receiver-1000000.csv\", config=config, kind=0)\n", + "original1.name = \"1GHz\"\n", + "original2 = evaluate(data_files[\"sender\"] + \"sender-2000000.csv\", data_files[\"receiver\"] + \"receiver-2000000.csv\", config=config, kind=0)\n", + "original2.name = \"2GHz\"\n", + "original3 = evaluate(data_files[\"sender\"] + \"sender-3000000.csv\", data_files[\"receiver\"] + \"receiver-3000000.csv\", config=config, kind=0)\n", + "original3.name = \"3GHz\"\n", + "dfs = [original1, original2, original3]" ] }, { @@ -68,7 +77,7 @@ "metadata": {}, "outputs": [], "source": [ - "traces(original, config)" + "traces(original1, config)" ] }, { @@ -84,8 +93,28 @@ "metadata": {}, "outputs": [], "source": [ - "df = jitter.prep(original, config=config)\n", - "jitter.trace_jitter(df, threshold=500)" + "def multi_trace_jitter(dfs, config):\n", + " for df in dfs:\n", + " print(\"############################ {} ############################\".format(df.name))\n", + " jitter.trace_jitter(df, config=config, threshold=300)\n", + " \n", + "multi_trace_jitter(dfs, config)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## CDFs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "multi_cdf(dfs, config, export=True)" ] }, { @@ -101,7 +130,7 @@ "metadata": {}, "outputs": [], "source": [ - "correlation(df[df[\"EndToEnd_D\"] < 500], config)" + "multi_correlation(dfs, config, export=True)" ] }, { @@ -119,7 +148,7 @@ "metadata": {}, "outputs": [], "source": [ - "d = analyse(original, config)" + "d = analyse(original1, config)" ] }, { @@ -153,6 +182,65 @@ "source": [ "d.cfg" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Kolmogorov\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from scipy import stats\n", + "from xlap.analyse.util import extract_durations\n", + "import numpy as np\n", + "\n", + "def timing_behaviour(df1, df2, config, confidence=0.9):\n", + " durations = [x + \"_D\" for x in extract_durations(config)]\n", + " \n", + " norm = lambda x: x / np.max(x)\n", + " \n", + " for duration in durations:\n", + " rvs1 = norm(df1[duration])\n", + " rvs2 = norm(df2[duration])\n", + " stat, pvalue = stats.ks_2samp(rvs1, rvs2)\n", + " result = \"CANNOT REJECT\"\n", + " if pvalue < 1 - confidence:\n", + " result = \"REJECT\"\n", + " print(duration.ljust(20), \"{:.6f}\".format(pvalue), result, sep=\"\\t\\t\")\n", + "\n", + "timing_behaviour(original1, original2, config)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "timing_behaviour(original1, original3, config)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "timing_behaviour(original2, original3, config)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -171,7 +259,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.3" }, "widgets": { "state": { diff --git a/xlap.yml b/xlap.yml index 6112a85bf1fbac446a5126a0a9a4ea20d3041de5..fc974bafe758676c4367f0c62cdb9cb8cbb00698 100644 --- a/xlap.yml +++ b/xlap.yml @@ -39,6 +39,14 @@ stamps: Source: sender Thread: app_send Type: time + PrrtSendPacketStart: + Source: sender + Thread: trans_send + Type: none + PrrtSendPacketEnd: + Source: sender + Thread: trans_send + Type: none PrrtTransmitStart: Source: sender