Papermill outputs, output all user settings
This commit is contained in:
parent
4fb32188d4
commit
55138d7c87
1 changed files with 45 additions and 17 deletions
|
@ -5,6 +5,7 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Importing libraries\n",
|
||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import re\n",
|
"import re\n",
|
||||||
|
@ -40,6 +41,7 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Parsing user settings\n",
|
||||||
"##################################################\n",
|
"##################################################\n",
|
||||||
"# User Settings\n",
|
"# User Settings\n",
|
||||||
"##################################################\n",
|
"##################################################\n",
|
||||||
|
@ -145,7 +147,14 @@
|
||||||
"BW_PATH = _expand_path(BW_PATH)\n",
|
"BW_PATH = _expand_path(BW_PATH)\n",
|
||||||
"CL_PATH = _expand_path(CL_PATH)\n",
|
"CL_PATH = _expand_path(CL_PATH)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"os.makedirs(OUT_PATH, exist_ok=True)"
|
"os.makedirs(OUT_PATH, exist_ok=True)\n",
|
||||||
|
"\n",
|
||||||
|
"print(\"User Settings:\")\n",
|
||||||
|
"g = globals()\n",
|
||||||
|
"for k, v in g.items():\n",
|
||||||
|
" if not k.isupper():\n",
|
||||||
|
" continue\n",
|
||||||
|
" print(f\" {k:.<40s} := {v}\")"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
|
@ -159,6 +168,7 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Importing system-dependent libraries\n",
|
||||||
"sys.path.append(os.path.join(TRACING_WS_BUILD_PATH, \"tracetools_read/\"))\n",
|
"sys.path.append(os.path.join(TRACING_WS_BUILD_PATH, \"tracetools_read/\"))\n",
|
||||||
"sys.path.append(os.path.join(TRACING_WS_BUILD_PATH, \"tracetools_analysis/\"))\n",
|
"sys.path.append(os.path.join(TRACING_WS_BUILD_PATH, \"tracetools_analysis/\"))\n",
|
||||||
"from tracetools_read.trace import *\n",
|
"from tracetools_read.trace import *\n",
|
||||||
|
@ -193,6 +203,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Loading traces\n",
|
||||||
|
"\n",
|
||||||
"def _load_traces():\n",
|
"def _load_traces():\n",
|
||||||
" file = load_file(TR_PATH)\n",
|
" file = load_file(TR_PATH)\n",
|
||||||
" handler = Ros2Handler.process(file)\n",
|
" handler = Ros2Handler.process(file)\n",
|
||||||
|
@ -223,6 +235,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Printing message counts\n",
|
||||||
|
"\n",
|
||||||
"for topic in sorted(topics, key=lambda t: t.name):\n",
|
"for topic in sorted(topics, key=lambda t: t.name):\n",
|
||||||
" topic: TrTopic\n",
|
" topic: TrTopic\n",
|
||||||
" print(f\"{topic.name:.<120s} | {sum(map(lambda p: len(p.instances), topic.publishers))}\")"
|
" print(f\"{topic.name:.<120s} | {sum(map(lambda p: len(p.instances), topic.publishers))}\")"
|
||||||
|
@ -251,6 +265,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Building latency graph\n",
|
||||||
|
"\n",
|
||||||
"from latency_graph import latency_graph as lg\n",
|
"from latency_graph import latency_graph as lg\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -272,6 +288,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Plotting full data flow graph\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false DFG_ENABLED\n",
|
"%%skip_if_false DFG_ENABLED\n",
|
||||||
"%%skip_if_false DFG_PLOT\n",
|
"%%skip_if_false DFG_PLOT\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -370,6 +388,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Plotting high-level data flow graph\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false DFG_ENABLED\n",
|
"%%skip_if_false DFG_ENABLED\n",
|
||||||
"%%skip_if_false DFG_PLOT\n",
|
"%%skip_if_false DFG_PLOT\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -503,6 +523,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Defining tree helper functions\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -670,6 +692,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Building message trees\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"\n",
|
"\n",
|
||||||
"end_topics = [t for t in _tracing_context.topics if any(re.search(f, t.name) for f in E2E_OUTPUT_TOPIC_PATTERNS)]\n",
|
"end_topics = [t for t in _tracing_context.topics if any(re.search(f, t.name) for f in E2E_OUTPUT_TOPIC_PATTERNS)]\n",
|
||||||
|
@ -707,6 +731,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Parsing message stats\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"%%skip_if_false BW_ENABLED\n",
|
"%%skip_if_false BW_ENABLED\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -768,6 +794,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Calculating E2E latencies\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def leaf_topics(tree: DepTree, lvl=0):\n",
|
"def leaf_topics(tree: DepTree, lvl=0):\n",
|
||||||
|
@ -840,6 +868,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Animating latency distribution over time\n",
|
||||||
|
"\n",
|
||||||
"#from matplotlib.animation import FuncAnimation\n",
|
"#from matplotlib.animation import FuncAnimation\n",
|
||||||
"#from IPython import display\n",
|
"#from IPython import display\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -891,6 +921,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Plotting E2E latencies\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"%%skip_if_false E2E_PLOT\n",
|
"%%skip_if_false E2E_PLOT\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -943,6 +975,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Decimating irrelevant trees\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def critical_path(self):\n",
|
"def critical_path(self):\n",
|
||||||
|
@ -1009,12 +1043,11 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Plotting E2E latency breakdown\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"%%skip_if_false E2E_PLOT\n",
|
"%%skip_if_false E2E_PLOT\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"def dict_safe_append(dictionary, key, value):\n",
|
"def dict_safe_append(dictionary, key, value):\n",
|
||||||
" if key not in dictionary:\n",
|
" if key not in dictionary:\n",
|
||||||
" dictionary[key] = []\n",
|
" dictionary[key] = []\n",
|
||||||
|
@ -1106,6 +1139,9 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Plotting E2E distribution\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"%%skip_if_false E2E_PLOT\n",
|
"%%skip_if_false E2E_PLOT\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -1143,6 +1179,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Visualizing E2E tree\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"%%skip_if_false E2E_PLOT\n",
|
"%%skip_if_false E2E_PLOT\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -1345,6 +1383,8 @@
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"#papermill_description=Finding top critical paths\n",
|
||||||
|
"\n",
|
||||||
"%%skip_if_false E2E_ENABLED\n",
|
"%%skip_if_false E2E_ENABLED\n",
|
||||||
"\n",
|
"\n",
|
||||||
"critical_paths = {}\n",
|
"critical_paths = {}\n",
|
||||||
|
@ -1421,7 +1461,7 @@
|
||||||
" dur_str = colored(f\"{duration * 1000 :>.3f}ms\", colors[E2E_PLOT_TIMESTAMP])\n",
|
" dur_str = colored(f\"{duration * 1000 :>.3f}ms\", colors[E2E_PLOT_TIMESTAMP])\n",
|
||||||
" print(f\" -> {dur_str} {part}\")\n",
|
" print(f\" -> {dur_str} {part}\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"out_df.to_csv(os.path.join(OUT_PATH, \"e2e.csv\"), sep=\"\\t\", index=False)"
|
"out_df.to_csv(os.path.join(OUT_PATH, \"e2e.csv\"), sep=\"\\t\", index=False)\n"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
|
@ -1429,18 +1469,6 @@
|
||||||
"name": "#%%\n"
|
"name": "#%%\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"outputs": [],
|
|
||||||
"source": [],
|
|
||||||
"metadata": {
|
|
||||||
"collapsed": false,
|
|
||||||
"pycharm": {
|
|
||||||
"name": "#%%\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue