Re-introduced TQDM for message tree loop

This commit is contained in:
Maximilian Schmeller 2022-09-19 15:39:17 +02:00
parent 98cd6fc3db
commit 062fcbe25a

View file

@ -61,7 +61,7 @@
"# Path to trace directory (e.g. ~/.ros/my-trace/ust) or to a converted trace file.\n", "# Path to trace directory (e.g. ~/.ros/my-trace/ust) or to a converted trace file.\n",
"# Using the path \"/ust\" at the end is optional but greatly reduces processing time\n", "# Using the path \"/ust\" at the end is optional but greatly reduces processing time\n",
"# if kernel traces are also present.\n", "# if kernel traces are also present.\n",
"TR_PATH = \"/home/max/Projects/optimization_framework/artifacts/iteration0_worker0/aw_replay/tracing/scenario-trace/ust\"\n", "TR_PATH = \"data/trace-awsim-x86/ust\"\n",
"\n", "\n",
"# Path to the folder all artifacts from this notebook are saved to.\n", "# Path to the folder all artifacts from this notebook are saved to.\n",
"# This entails plots as well as data tables.\n", "# This entails plots as well as data tables.\n",
@ -107,10 +107,10 @@
"# Whether to compute E2E latencies.\n", "# Whether to compute E2E latencies.\n",
"E2E_ENABLED = True\n", "E2E_ENABLED = True\n",
"# Whether to plot end-to-end latency information (ignored if E2E_ENABLED is False)\n", "# Whether to plot end-to-end latency information (ignored if E2E_ENABLED is False)\n",
"E2E_PLOT = False\n", "E2E_PLOT = True\n",
"# The index of the output message that shall be used in plots that visualize a specific\n", "# The index of the output message that shall be used in plots that visualize a specific\n",
"# message dependency tree. This index has to be 0 <= n < #output messages\n", "# message dependency tree. This index has to be 0 <= n < #output messages\n",
"E2E_PLOT_TIMESTAMP = 200\n", "E2E_PLOT_TIMESTAMP = 1000\n",
"# E2E latency threshold. Every E2E latency higher than this is discarded.\n", "# E2E latency threshold. Every E2E latency higher than this is discarded.\n",
"# Set this as low as comfortably possible to speed up calculations.\n", "# Set this as low as comfortably possible to speed up calculations.\n",
"# WARNING: If you set this too low (i.e. to E2E latencies that plausibly can happen)\n", "# WARNING: If you set this too low (i.e. to E2E latencies that plausibly can happen)\n",
@ -687,7 +687,6 @@
"\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",
"\n", "\n",
"\n",
"def build_dep_trees():\n", "def build_dep_trees():\n",
" all_trees = []\n", " all_trees = []\n",
" for end_topic in end_topics:\n", " for end_topic in end_topics:\n",
@ -695,18 +694,14 @@
" print(f\"====={end_topic.name}\")\n", " print(f\"====={end_topic.name}\")\n",
"\n", "\n",
" pubs = end_topic.publishers\n", " pubs = end_topic.publishers\n",
" print(len(pubs))\n",
" for pub in pubs:\n", " for pub in pubs:\n",
" msgs = list(pub.instances)\n", " msgs = list(pub.instances)\n",
" print(\"\\n\".join(map(str, msgs)))\n", " for msg in tqdm(msgs, desc=\"Processing output messages\"):\n",
" for msg in msgs:\n",
" msg: TrPublishInstance\n", " msg: TrPublishInstance\n",
" tree = get_dep_tree(msg)\n", " tree = get_dep_tree(msg)\n",
" all_trees.append(tree)\n", " all_trees.append(tree)\n",
" print()\n",
" return all_trees\n", " return all_trees\n",
"\n", "\n",
"\n",
"try:\n", "try:\n",
" trees = cached(\"trees\", build_dep_trees, [TR_PATH], not CACHING_ENABLED)\n", " trees = cached(\"trees\", build_dep_trees, [TR_PATH], not CACHING_ENABLED)\n",
"except Exception as e:\n", "except Exception as e:\n",
@ -1481,4 +1476,4 @@
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 2
} }