Fixed crash when BW_ENABLED=False, user-friendly README.md

This commit is contained in:
Maximilian Schmeller 2022-09-14 14:08:47 +02:00
parent dfbabe7ae0
commit 4268335e09
3 changed files with 43 additions and 11 deletions

View file

@ -24,10 +24,7 @@
"from misc.utils import ProgressPrinter, cached, parse_as\n",
"\n",
"%load_ext pyinstrument\n",
"%matplotlib inline\n",
"\n",
"A=True\n",
"B=None"
"%matplotlib inline"
]
},
{
@ -68,7 +65,7 @@
"OUT_PATH = \"out/\"\n",
"\n",
"# Whether to annotate topics/publications with bandwidth/message size\n",
"BW_ENABLED = True\n",
"BW_ENABLED = False\n",
"# Path to a results folder as output by ma-hw-perf-tools/messages/record.bash\n",
"# Used to annotate message sizes in E2E latency calculations\n",
"BW_PATH = \"../ma-hw-perf-tools/data/results\"\n",
@ -139,7 +136,9 @@
"TR_PATH = _expand_path(TR_PATH)\n",
"OUT_PATH = _expand_path(OUT_PATH)\n",
"BW_PATH = _expand_path(BW_PATH)\n",
"CL_PATH = _expand_path(CL_PATH)"
"CL_PATH = _expand_path(CL_PATH)\n",
"\n",
"os.makedirs(OUT_PATH, exist_ok=True)"
]
},
{
@ -226,7 +225,6 @@
"execution_count": null,
"outputs": [],
"source": [
"%%skip_if_false DFG_ENABLED\n",
"from latency_graph import latency_graph as lg\n",
"\n",
"def _make_latency_graph():\n",
@ -1251,7 +1249,7 @@
" if \"DDS\" not in legend_entries:\n",
" legend_entries[\"DDS\"] = r\n",
"\n",
" topic_stats = msg_sizes.get(pub.topic_name)\n",
" topic_stats = msg_sizes.get(pub.topic_name) if BW_ENABLED else None\n",
" if topic_stats:\n",
" size_str = bw_str(topic_stats)\n",
" ax.text(r_x + r_w / 2, r_y + arr_width + margin_y, size_str, ha=\"center\", backgroundcolor=(1,1,1,.5), zorder=11000)\n",
@ -1346,7 +1344,10 @@
"items = list(critical_paths.items())\n",
"items.sort(key=lambda pair: len(pair[1]), reverse=True)\n",
"\n",
"out_df = pd.DataFrame(columns=[\"path\", \"timestamp\", \"e2e_latency\"])\n",
"for key, paths in items:\n",
" path_records = [(\" -> \".join(key), p[0].timestamp, p[0].timestamp - p[-1].timestamp) for p in paths]\n",
" out_df.append(path_records)\n",
" print(f\"======== {len(paths)}x: {sum(map(lambda p: p[0].timestamp - p[-1].timestamp, paths))/len(paths)*1000:.3f}ms\")\n",
" paths_durations = []\n",
" for path in paths:\n",
@ -1381,7 +1382,8 @@
" E2E_PLOT_TIMESTAMP = j\n",
" dur_str = colored(f\"{duration * 1000 :>.3f}ms\", colors[E2E_PLOT_TIMESTAMP])\n",
" print(f\" -> {dur_str} {part}\")\n",
"\n"
"\n",
"out_df.to_csv(os.path.join(OUT_PATH, \"e2e.csv\"), sep=\"\\t\")"
],
"metadata": {
"collapsed": false,