You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sledge/runtime/tests/plot.ipynb

186 lines
58 KiB

3 months ago
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"import matplotlib.colors as mcolors\n",
"import numpy as np\n",
"import sys\n",
"from matplotlib.ticker import MultipleLocator, FormatStrFormatter\n",
"import matplotlib.ticker as ticker\n",
"import os\n",
"from collections import defaultdict\n",
"import matplotlib.pyplot as plt\n",
"import re\n",
"import argparse\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"12983\n",
"12983\n",
"12983\n",
"12983\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAGwCAYAAABmTltaAAAAP3RFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMS5wb3N0MSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8kixA/AAAACXBIWXMAAA9hAAAPYQGoP6dpAABRu0lEQVR4nO3deVhU9f4H8PcMMAMIwyLLgCLihhviVsgtt0SWzCU1S02xTLPQVNKMbuXSvWFa5m7XyuxXrnnRcr0hiituJIKipIahBmgqjGiyDN/fHz6cHAHh4MAM8H49zzwPc853zvl858zy5pwz36MQQggQERERUaUpTV0AERERUW3DAEVEREQkEwMUERERkUwMUEREREQyMUARERERycQARURERCQTAxQRERGRTJamLqA2KC4uxh9//AF7e3soFApTl0NERESVIITA7du34enpCaXSuPuMGKAq4Y8//oCXl5epyyAiIqIquHz5Mho3bmzUZTJAVYK9vT2A+xtAo9GYuBoiIiKqDJ1OBy8vL+l73JgYoCqh5LCdRqNhgCIiIqplquP0G55ETkRERCQTAxQRERGRTAxQRERERDLxHCgj0uv1KCwsNHUZVMdZWVnBwsLC1GUQEdVrDFBGIIRAVlYWcnJy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+73+yb3F5idOnVC69at8fnnn+Oll14yOA/q1KlT2L17N5YuXQoAcHV1BXB/iIGSsPXw+FKdO3fGf//7XzRt2hSWlmW/NVxdXZGZ+ffeQJ1Oh/T0dFl1P8zX1xfHjx83mPb
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import json\n",
"f = open('/home/weihao/sledge/sledge_tree/runtime/tests/request_time.txt', 'r')\n",
"js = f.read()\n",
"f.close()\n",
"times = json.loads(js)\n",
"keys = list(times.keys())\n",
"int_keys = list(map(int, keys))\n",
"x=sorted(int_keys)\n",
"#print(x)\n",
"print(len(x))\n",
"y_list=list(times.values())\n",
"\n",
"y_queuing=[]\n",
"y_runnable=[]\n",
"y_blocking=[]\n",
"\n",
"for k in range(len(x)):\n",
" y_queuing.append(times[str(x[k])][0])\n",
" y_runnable.append(times[str(x[k])][1])\n",
" y_blocking.append(times[str(x[k])][2])\n",
"print(len(y_queuing))\n",
"print(len(y_runnable))\n",
"print(len(y_blocking))\n",
"#print(y_queuing)\n",
"legend_list=[\"Global Queuing\", \"Local Queuing\", \"Blocking\"]\n",
"#legend_list=[\"Local Queuing\", \"Blocking\"]\n",
"\n",
"#legend_list=[\"Global Queuing\", \"Blocking\"]\n",
"plt.scatter(np.array(x), y_queuing,c='g')\n",
"#plt.scatter(np.array(x), y_runnable, c='r')\n",
"#plt.scatter(np.array(x), y_blocking,c ='b')\n",
"\n",
"#plt.ylim((0, 90000)) \n",
"#plt.ylim((0,400000))\n",
"plt.xlabel(\"Request id\")\n",
"plt.ylabel(\"Duration(us)\")\n",
"\n",
"plt.legend(legend_list)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"12983\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHACAYAAABONwdOAAAAP3RFWHRTb2Z0d2FyZQBNYXRwbG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guLsaHH34IAHjooYcwd+5cPPXUU7j//vvxxRdfYMWKFVi3bp1WRSDSpfR0YOhQzixNRL5P00Rox44dGDRokO3vyZMnAwAyMjKwePFilJSUoLCw0PZ4p06dsG7dOjz++OOYM2cOOnTogHfffZdD54k0YDRyiDwR+T6DEI6mRvNflZWVCA0NRUVFBZvJiIiIfIRa12+f6iNEREREpCQmQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpFhMhIiIi0i0mQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpFhMhIiIi0i0mQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpFhMhIiIi0i0mQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpFhMhIiIi0i0mQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpFhMhIiIi0i0mQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpFhMhIiIi0i0mQkRERKRbTISIiIhIt5gIERERkW4xESIiIiLdYiJEREREusVEiIiIiHSLiRARERHpluaJ0Lx585CQkIDg4GAkJSVh+/btTW6fnZ2N7t27o1WrVjCZTHj88cdx7tw5D0VLRERE/kTTRGj58uWYPHkyMjMzsWvXLvTu3RtpaWk4evSow+2XLl2KqVOnIjMzE/v378d7772H5cuXY/r06R6OnIiIiPyBponQG2+8gXHjxmHs2LG44oorsGDBArRu3Rrvv/++w+2/+eYb/OUvf8GoUaOQkJCAm2++GSNHjmy2FomIiIjIEc0SodraWuzcuROpqakXgwkIQGpqKvLz8x0+Z8CAAdi5c6ct8fntt9+wfv163HrrrR6JmYiIiPxLC61euLy8HGazGdHR0Xbro6Oj8csvvzh8zqhRo1BeXo7rrrsOQghcuHABDz30UJNNYzU1NaipqbH9XVlZqUwBiIiIyOdp3llajry8PLz00kt45513sGvXLuTk5GDdunX45z//6fQ5WVlZCA0NtS0mk8mDERMREZE3MwghhBYvXFtbi9atW2PVqlUYNmyYbX1GRgZOnTqFtWvXNnpOSkoK+vfvj1dffdW2bsmSJXjwwQdRVVWFgIDGeZ2jGiGTyYSKigqEhIQoWygiIiJSRWVlJUJDQxW/fmtWIxQYGIjExETk5uba1tXV1SE3NxfJyckOn3PmzJlGyY7RaAQAOMvngoKCEBISYrcQERERARr2EQKAyZMnIyMjA/369cO1116L7OxsVFdXY+zYsQCAMWPGID4+HllZWQCAIUOG4I033kDfvn2RlJSEQ4cO4dlnn8WQIUNsCRERERGRVJomQiNGjMCxY8cwc+ZMlJaWok+fPtiwYYOtA3VhYaFdDdCMGTNgMBgwY8YMFBcXIzIyEkOGDMGLL76oVRGIiIjIh2nWR0grarUxEhERkXr8ro8QERERkdaYCBEREZFuMREiIiIi3WIiRERERLrFRIiIiIh0i4kQERER6RYTISIiItItJkJERESkW0yEiIiISLeYCBEREZFuMREiIiIi3WIiRERERLrFRIiIiIh0i4kQERER6RYTISIiItItJkJERESkW0yEiIiISLeYCBEREZFuMRE
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"31416 32 [32, 10, 23382, 31416, 0]\n"
]
}
],
"source": [
"import json\n",
"f = open('/home/weihao/sledge/sledge_tree/runtime/tests/request_time.txt', 'r')\n",
"js = f.read()\n",
"f.close()\n",
"times = json.loads(js)\n",
"keys = list(times.keys())\n",
"int_keys = list(map(int, keys))\n",
"x=sorted(int_keys)\n",
"#print(x)\n",
"print(len(x))\n",
"y_list=list(times.values())\n",
"\n",
"#deadline = 73076\n",
"deadline = 472592\n",
"y_latency=[]\n",
"yqueuing=[]\n",
"\n",
"for k in range(len(x)):\n",
" y_latency.append(times[str(x[k])][3])\n",
" yqueuing.append(times[str(x[k])][0])\n",
"\n",
"#print(y_latency)\n",
"plt.scatter(np.array(x), y_latency,c='b')\n",
"#plt.scatter(np.array(x), yqueuing,c='g')\n",
"plt.axhline(y=deadline,color='r')\n",
"plt.xlabel(\"Request id\")\n",
"plt.ylabel(\"Total Latency(us)\")\n",
"\n",
"plt.show()\n",
"\n",
"print(y_latency[1289], yqueuing[1289], times[str(x[1289])])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "haiwan_env",
"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.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}