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.

186 lines
101 KiB

3 months ago
{
"cells": [
{
"cell_type": "code",
3 months ago
"execution_count": 2,
3 months ago
"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",
3 months ago
"execution_count": 3,
3 months ago
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
3 months ago
"13485\n",
"13485\n",
"13485\n",
"13485\n"
3 months ago
]
},
{
"data": {
3 months ago
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAGwCAYAAABIC3rIAAAAP3RFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMS5wb3N0MSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8kixA/AAAACXBIWXMAAA9hAAAPYQGoP6dpAADThUlEQVR4nOx9eXwU5f3/e3chgZADslmBZhdRUbFqPVptqVJIoaL1QA5FtBWtR/0JSgTj1SBuq5VaIWA92qoV+41BExd7KmhwodTiWfCCeoIccikQ7sDufn5/zM5mdnaOZ2ae2SN53q/X84Lszj7zzDPP8X4+p4eICAICAgICAgICXRjeXDdAQEBAQEBAQCDXEIRIQEBAQEBAoMtDECIBAQEBAQGBLg9BiAQEBAQEBAS6PAQhEhAQEBAQEOjyEIRIQEBAQEBAoMtDECIBAQEBAQGBLo9uuW5AISCRSODLL79EWVkZPB5PrpsjICAgICAgwAAiwp49e/CNb3wDXq+xDEgQIgZ8+eWXCIVCuW6GgICAgICAgA1s2LABwWDQ8BpBiBhQVlYGQOrQ8vLyHLdGQEBAQEBAgAW7d+9GKBRK7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rPN33TTTXjxxRcxZ84cfPLJJ/jDH/6Al156SeQrywewnnRzYO8gIJC3GDpUkvLorWEeD+D3S9coEQzmzOUeAEA5xI4dO+jII4+kq666it544w36/PPPafHixfTpp5+mrpk1axZVVFTQX/7
3 months ago
"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",
3 months ago
"plt.scatter(np.array(x), y_runnable, c='r')\n",
"plt.scatter(np.array(x), y_blocking,c ='b')\n",
3 months ago
"\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": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHACAYAAABONwdOAAAAP3RFWHRTb2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Cw8Nx6aWXYtq0aSguLsaHH34IAHjooYcwd+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
}