diff --git a/misc/utils.py b/misc/utils.py
index 1490ce4..5e65d4e 100644
--- a/misc/utils.py
+++ b/misc/utils.py
@@ -1,15 +1,11 @@
-import base64
-import glob
import hashlib
import json
-import math
import os
import pickle
-import time
from typing import List
-from IPython.core.magic import (register_cell_magic, needs_local_scope)
from IPython import get_ipython
+from IPython.core.magic import (register_cell_magic, needs_local_scope)
@register_cell_magic
@@ -26,33 +22,6 @@ def left_abbreviate(string, limit=120):
return string if len(string) <= limit else f"...{string[:limit - 3]}"
-class ProgressPrinter:
- def __init__(self, verb, n) -> None:
- self.verb = verb
- self.n = n
- self.i = 0
- self.fmt_len = math.ceil(math.log10(n if n > 0 else 1))
-
- def step(self, msg):
- self.i += 1
- print(f"({self.i:>{self.fmt_len}d}/{self.n}) {self.verb} {left_abbreviate(msg):<120}", end="\r")
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_value, exc_traceback):
- self.i -= 1
-
- if exc_value:
- self.step("error.")
- print()
- print(exc_value)
- return
-
- self.step("done.")
- print()
-
-
def stable_hash(obj):
return hashlib.md5(json.dumps(obj).encode("utf-8")).hexdigest()[:10]
@@ -65,6 +34,7 @@ def parse_as(type, string):
return type(val)
raise ValueError(f"Unknown type {type.__name__}")
+
def cached(name, function, file_deps: List[str]):
if not os.path.isdir("cache"):
os.makedirs("cache", exist_ok=True)
diff --git a/trace-analysis.ipynb b/trace-analysis.ipynb
index 4fdf9cc..a57a1bc 100644
--- a/trace-analysis.ipynb
+++ b/trace-analysis.ipynb
@@ -2,12 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "pycharm": {
- "name": "#%%\n"
- }
- },
+ "execution_count": null,
"outputs": [],
"source": [
"import glob\n",
@@ -25,16 +20,17 @@
"\n",
"%load_ext pyinstrument\n",
"%matplotlib inline"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 43,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"outputs": [],
"source": [
"##################################################\n",
@@ -141,16 +137,17 @@
"CL_PATH = _expand_path(CL_PATH)\n",
"\n",
"os.makedirs(OUT_PATH, exist_ok=True)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"outputs": [],
"source": [
"from clang_interop.cl_types import ClContext\n",
@@ -165,37 +162,30 @@
"\n",
"from tracing_interop.tr_types import TrTimer, TrTopic, TrPublisher, TrPublishInstance, TrCallbackInstance, \\\n",
"TrCallbackSymbol, TrCallbackObject, TrSubscriptionObject, TrContext"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "pycharm": {
- "name": "#%% md\n"
- }
- },
- "source": [
- "# Organize Trace Data"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[CACHE] Found up-to-date cache entry (cache/tr_objects_507fec94db.pkl) for tr_objects, loading.\n",
- "Done.\n"
- ]
- }
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Organize Trace Data"
],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%% md\n"
+ }
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"def _load_traces():\n",
" file = load_file(TR_PATH)\n",
@@ -214,86 +204,46 @@
" globals()[name] = getattr(_tracing_context, name)\n",
"\n",
"print(\"Done.\")"
- ]
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ }
},
{
"cell_type": "code",
- "execution_count": 42,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "/control/external_cmd_selector/current_selector_mode\n",
- "/system/emergency/control_cmd\n",
- "/control/command/hazard_lights_cmd\n",
- "/control/command/turn_indicators_cmd\n",
- "/api/external/set/command/local/control\n",
- "/control/trajectory_follower/lane_departure_checker_node/debug/deviation/yaw\n",
- "/control/command/control_cmd\n",
- "/api/iv_msgs/vehicle/status/control_mode\n",
- "/control/trajectory_follower/control_cmd\n",
- "/api/external/set/command/remote/control\n",
- "/control/trajectory_follower/lateral/diagnostic\n",
- "/control/trajectory_follower/lane_departure_checker_node/debug/deviation/yaw_deg\n",
- "/control/trajectory_follower/lane_departure_checker_node/debug/deviation/lateral\n",
- "/control/vehicle_cmd_gate/operation_mode\n",
- "/control/trajectory_follower/longitudinal/slope_angle\n",
- "/vehicle/status/control_mode\n",
- "/external/selected/external_control_cmd\n",
- "/control/is_autonomous_available\n",
- "/control/trajectory_follower/lane_departure_checker_node/debug/processing_time_ms\n",
- "/control/operation_mode\n",
- "/control/trajectory_follower/lane_departure_checker_node/debug/marker_array\n",
- "/external/selected/control_cmd\n",
- "/control/operation_mode_transition_manager/debug_info\n",
- "/control/trajectory_follower/lateral/predicted_trajectory\n",
- "/control/shift_decider/gear_cmd\n",
- "/control/command/emergency_cmd\n",
- "/planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner/adaptive_cruise_control/debug_values\n",
- "/control/current_gate_mode\n",
- "/api/external/get/command/selected/control\n",
- "/control/command/gear_cmd\n",
- "/control/gate_mode_cmd\n",
- "/control/trajectory_follower/longitudinal/diagnostic\n"
- ]
- }
- ],
+ "execution_count": null,
+ "outputs": [],
"source": [
"for t in topics:\n",
" if \"control\" in t.name:\n",
" print(t.name)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "pycharm": {
- "name": "#%% md\n"
- }
- },
- "source": [
- "# E2E Latency Calculation"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[CACHE] Found up-to-date cache entry (cache/lat_graph_507fec94db.pkl) for lat_graph, loading.\n"
- ]
- }
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# E2E Latency Calculation"
],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%% md\n"
+ }
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"from latency_graph import latency_graph as lg\n",
"\n",
@@ -301,5693 +251,18 @@
" return lg.LatencyGraph(_tracing_context)\n",
"\n",
"lat_graph = cached(\"lat_graph\", _make_latency_graph, [TR_PATH])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- " Processing INPUT: 1\n",
- " Processing OUTPUT: 1\n",
- " Processing simulation: 0\n",
- " Processing openscenario_visualizer: 2\n",
- " Processing simple_sensor_simulator: 1\n",
- " Processing openscenario_interpreter: 19\n",
- " Processing concealer: 22\n",
- " Processing system: 0\n",
- " Processing system_monitor: 0\n",
- " Processing system_monitor: 0\n",
- " Processing system_monitor_container: 1\n",
- " Processing cpu_monitor: 2\n",
- " Processing hdd_monitor: 3\n",
- " Processing mem_monitor: 2\n",
- " Processing net_monitor: 2\n",
- " Processing ntp_monitor: 2\n",
- " Processing process_monitor: 3\n",
- " Processing gpu_monitor: 2\n",
- " Processing emergency_handler: 7\n",
- " Processing system_error_monitor: 6\n",
- " Processing ad_service_state_monitor: 9\n",
- " Processing transform_listener_impl_5640698e3b70: 3\n",
- " Processing map: 0\n",
- " Processing map_container: 1\n",
- " Processing lanelet2_map_loader: 1\n",
- " Processing lanelet2_map_visualization: 2\n",
- " Processing pointcloud_map_loader: 1\n",
- " Processing vector_map_tf_generator: 2\n",
- " Processing planning: 0\n",
- " Processing mission_planning: 0\n",
- " Processing mission_planning_container: 1\n",
- " Processing mission_planner: 4\n",
- " Processing transform_listener_impl_55f81237fb00: 3\n",
- " Processing goal_pose_visualizer: 2\n",
- " Processing scenario_planning: 0\n",
- " Processing lane_driving: 0\n",
- " Processing behavior_planning: 0\n",
- " Processing rtc_auto_approver: 13\n",
- " Processing behavior_planning_container: 1\n",
- " Processing behavior_path_planner: 9\n",
- " Processing transform_listener_impl_7ff5980c97d0: 3\n",
- " Processing behavior_velocity_planner: 13\n",
- " Processing transform_listener_impl_7ff5705c51f8: 3\n",
- " Processing motion_planning: 0\n",
- " Processing motion_planning_container: 1\n",
- " Processing obstacle_avoidance_planner: 5\n",
- " Processing transform_listener_impl_7fbc48096dc0: 3\n",
- " Processing obstacle_stop_planner: 6\n",
- " Processing transform_listener_impl_7fbc54027818: 3\n",
- " Processing surround_obstacle_checker: 6\n",
- " Processing transform_listener_impl_7fbc6000af58: 3\n",
- " Processing scenario_selector: 8\n",
- " Processing external_velocity_limit_selector: 4\n",
- " Processing transform_listener_impl_55de7185f3b8: 3\n",
- " Processing parking: 0\n",
- " Processing parking_container: 1\n",
- " Processing costmap_generator: 6\n",
- " Processing transform_listener_impl_559279168428: 3\n",
- " Processing freespace_planner: 6\n",
- " Processing transform_listener_impl_5592795af670: 3\n",
- " Processing motion_velocity_smoother: 4\n",
- " Processing transform_listener_impl_5625d002bd30: 3\n",
- " Processing planning_diagnostics: 0\n",
- " Processing planning_error_monitor: 4\n",
- " Processing aggregator_node: 3\n",
- " Processing robot_state_publisher: 2\n",
- " Processing control: 0\n",
- " Processing control_container: 1\n",
- " Processing trajectory_follower: 0\n",
- " Processing controller_node_exe: 5\n",
- " Processing lane_departure_checker_node: 8\n",
- " Processing transform_listener_impl_56044e5ef540: 3\n",
- " Processing transform_listener_impl_56044e64ced0: 3\n",
- " Processing external_cmd_selector: 11\n",
- " Processing external_cmd_converter: 8\n",
- " Processing transform_listener_impl_56044e7e8a60: 3\n",
- " Processing shift_decider: 3\n",
- " Processing vehicle_cmd_gate: 21\n",
- " Processing operation_mode_transition_manager: 7\n",
- " Processing awapi: 0\n",
- " Processing awapi_relay_container: 1\n",
- " Processing awapi_awiv_adapter_node: 28\n",
- " Processing transform_listener_impl_555fb141cf58: 3\n",
- " Processing route_relay: 2\n",
- " Processing predict_object_relay: 2\n",
- " Processing nearest_traffic_signal_relay: 2\n",
- " Processing ready_module_relay: 2\n",
- " Processing force_available_relay: 2\n",
- " Processing running_modules_relay: 2\n",
- " Processing autoware_engage_relay: 2\n",
- " Processing vehicle_engage_relay: 2\n",
- " Processing put_route_relay: 2\n",
- " Processing put_goal_relay: 2\n",
- " Processing lane_change_approval_relay: 2\n",
- " Processing force_lane_change_relay: 2\n",
- " Processing external_approval_relay: 2\n",
- " Processing force_approval_relay: 2\n",
- " Processing obstacle_avoid_approval_relay: 2\n",
- " Processing traffic_signal_relay: 2\n",
- " Processing overwrite_traffic_signals_relay: 2\n",
- " Processing speed_exceeded_relay: 2\n",
- " Processing crosswalk_status_relay: 2\n",
- " Processing intersection_status_relay: 2\n",
- " Processing expand_stop_range_relay: 2\n",
- " Processing pose_initialization_request_relay: 2\n",
- " Processing autoware_api: 0\n",
- " Processing external: 0\n",
- " Processing autoware_iv_adaptor: 1\n",
- " Processing cpu_usage: 2\n",
- " Processing start: 2\n",
- " Processing diagnostics: 2\n",
- " Processing door: 2\n",
- " Processing emergency: 2\n",
- " Processing engage: 3\n",
- " Processing fail_safe_state: 2\n",
- " Processing initial_pose: 1\n",
- " Processing map: 2\n",
- " Processing operator: 3\n",
- " Processing metadata_packages: 1\n",
- " Processing route: 3\n",
- " Processing service: 1\n",
- " Processing vehicle_status: 8\n",
- " Processing velocity: 1\n",
- " Processing version: 1\n",
- " Processing internal: 0\n",
- " Processing traffic_signals: 2\n",
- " Processing autoware_iv_adaptor: 1\n",
- " Processing intersection_states: 2\n",
- " Processing initial_pose_2d: 2\n",
- " Processing crosswalk_states: 2\n",
- " Processing initial_pose: 1\n",
- " Processing iv_msgs: 6\n",
- " Processing operator: 5\n",
- " Processing route: 2\n",
- " Processing velocity: 2\n",
- " Processing initial_pose_2d: 2\n",
- " Processing fault_injection: 3\n",
- " Processing perception: 0\n",
- " Processing object_recognition: 0\n",
- " Processing tracking: 0\n",
- " Processing multi_object_tracker: 2\n",
- " Processing transform_listener_impl_55f0d0d59108: 3\n",
- " Processing prediction: 0\n",
- " Processing map_based_prediction: 3\n",
- " Processing transform_listener_impl_560d413e4c40: 3\n",
- " Processing rviz2: 56\n",
- " Processing rosbag2_player: 1\n",
- " Processing transform_listener_impl_563ba1d22770: 2\n",
- " Processing transform_listener_impl_563ba1d857c0: 7\n"
- ]
- },
- {
- "data": {
- "image/svg+xml": [
- "\n",
- "\n",
- "\n",
- "\n",
- "\n"
- ],
- "text/plain": [
- ""
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false DFG_ENABLED\n",
"%%skip_if_false DFG_PLOT\n",
@@ -6076,1377 +351,18 @@
"g.render(\"latency_graph.svg\")\n",
"\n",
"g"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "/control/external_cmd_converter, /awapi/awapi_relay_container, /awapi/awapi_awiv_adapter_node, /awapi/route_relay, /awapi/predict_object_relay, /awapi/nearest_traffic_signal_relay, /awapi/ready_module_relay, /awapi/force_available_relay, /awapi/running_modules_relay, /awapi/autoware_engage_relay, /awapi/vehicle_engage_relay, /awapi/put_route_relay, /awapi/put_goal_relay, /awapi/lane_change_approval_relay, /awapi/force_lane_change_relay, /awapi/external_approval_relay, /awapi/force_approval_relay, /awapi/obstacle_avoid_approval_relay, /awapi/traffic_signal_relay, /awapi/overwrite_traffic_signals_relay, /awapi/speed_exceeded_relay, /awapi/crosswalk_status_relay, /awapi/intersection_status_relay, /awapi/expand_stop_range_relay, /awapi/pose_initialization_request_relay\n",
- "/INPUT, /OUTPUT, /[NONE], /simulation/openscenario_visualizer, /simulation/simple_sensor_simulator, /simulation/openscenario_interpreter, /simulation/concealer, /system/system_monitor/system_monitor/system_monitor_container, /system/system_monitor/cpu_monitor, /system/system_monitor/hdd_monitor, /system/system_monitor/mem_monitor, /system/system_monitor/net_monitor, /system/system_monitor/ntp_monitor, /system/system_monitor/process_monitor, /system/system_monitor/gpu_monitor, /system/emergency_handler, /system/system_error_monitor, /system/ad_service_state_monitor, /map/map_container, /map/lanelet2_map_loader, /map/lanelet2_map_visualization, /map/pointcloud_map_loader, /map/vector_map_tf_generator, /planning/mission_planning/mission_planning_container, /planning/mission_planning/mission_planner, /planning/mission_planning/goal_pose_visualizer, /planning/scenario_planning/lane_driving/behavior_planning/rtc_auto_approver, /planning/scenario_planning/lane_driving/behavior_planning/behavior_planning_container, /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner, /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner, /planning/scenario_planning/lane_driving/motion_planning/motion_planning_container, /planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner, /planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner, /planning/scenario_planning/lane_driving/motion_planning/surround_obstacle_checker, /planning/scenario_planning/scenario_selector, /planning/scenario_planning/external_velocity_limit_selector, /planning/scenario_planning/parking/parking_container, /planning/scenario_planning/parking/costmap_generator, /planning/scenario_planning/parking/freespace_planner, /planning/scenario_planning/motion_velocity_smoother, /planning/planning_diagnostics/planning_error_monitor, /aggregator_node, /robot_state_publisher, /control/control_container, /control/trajectory_follower/controller_node_exe, /control/trajectory_follower/lane_departure_checker_node, /control/external_cmd_selector, /control/external_cmd_converter, /control/shift_decider, /control/vehicle_cmd_gate, /control/operation_mode_transition_manager, /awapi/awapi_relay_container, /awapi/awapi_awiv_adapter_node, /awapi/route_relay, /awapi/predict_object_relay, /awapi/nearest_traffic_signal_relay, /awapi/ready_module_relay, /awapi/force_available_relay, /awapi/running_modules_relay, /awapi/autoware_engage_relay, /awapi/vehicle_engage_relay, /awapi/put_route_relay, /awapi/put_goal_relay, /awapi/lane_change_approval_relay, /awapi/force_lane_change_relay, /awapi/external_approval_relay, /awapi/force_approval_relay, /awapi/obstacle_avoid_approval_relay, /awapi/traffic_signal_relay, /awapi/overwrite_traffic_signals_relay, /awapi/speed_exceeded_relay, /awapi/crosswalk_status_relay, /awapi/intersection_status_relay, /awapi/expand_stop_range_relay, /awapi/pose_initialization_request_relay, /autoware_api/external/autoware_iv_adaptor, /autoware_api/external/cpu_usage, /autoware_api/external/start, /autoware_api/external/diagnostics, /autoware_api/external/door, /autoware_api/external/emergency, /autoware_api/external/engage, /autoware_api/external/fail_safe_state, /autoware_api/external/initial_pose, /autoware_api/external/map, /autoware_api/external/operator, /autoware_api/external/metadata_packages, /autoware_api/external/route, /autoware_api/external/service, /autoware_api/external/vehicle_status, /autoware_api/external/velocity, /autoware_api/external/version, /autoware_api/internal/traffic_signals, /autoware_api/internal/autoware_iv_adaptor, /autoware_api/internal/intersection_states, /autoware_api/internal/initial_pose_2d, /autoware_api/internal/crosswalk_states, /autoware_api/internal/initial_pose, /autoware_api/internal/iv_msgs, /autoware_api/internal/operator, /autoware_api/internal/route, /autoware_api/internal/velocity, /initial_pose_2d, /fault_injection, /perception/object_recognition/tracking/multi_object_tracker, /perception/object_recognition/prediction/map_based_prediction, /rosbag2_player\n",
- "/control/vehicle_cmd_gate /autoware_api/external/emergency 1\n",
- "/system/emergency_handler /control/vehicle_cmd_gate 4\n",
- "/control/external_cmd_selector /autoware_api/internal/operator 1\n",
- "/simulation/openscenario_interpreter /simulation/openscenario_visualizer 1\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner /control/vehicle_cmd_gate 2\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner /awapi/awapi_awiv_adapter_node 2\n",
- "/perception/object_recognition/prediction/map_based_prediction /planning/scenario_planning/parking/costmap_generator 1\n",
- "/perception/object_recognition/prediction/map_based_prediction /planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner 1\n",
- "/perception/object_recognition/prediction/map_based_prediction /planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner 1\n",
- "/perception/object_recognition/prediction/map_based_prediction /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner 1\n",
- "/perception/object_recognition/prediction/map_based_prediction /planning/scenario_planning/lane_driving/motion_planning/surround_obstacle_checker 1\n",
- "/perception/object_recognition/prediction/map_based_prediction /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner 1\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner /planning/scenario_planning/lane_driving/behavior_planning/rtc_auto_approver 6\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner /planning/scenario_planning/lane_driving/behavior_planning/rtc_auto_approver 6\n",
- "/system/system_monitor/cpu_monitor /autoware_api/external/cpu_usage 1\n",
- "/autoware_api/internal/operator /autoware_api/external/operator 2\n",
- "/control/vehicle_cmd_gate /simulation/concealer 4\n",
- "/simulation/concealer /control/trajectory_follower/controller_node_exe 2\n",
- "/simulation/concealer /autoware_api/external/vehicle_status 4\n",
- "/simulation/concealer /awapi/awapi_awiv_adapter_node 5\n",
- "/simulation/concealer /control/vehicle_cmd_gate 1\n",
- "/control/vehicle_cmd_gate /system/emergency_handler 1\n",
- "/control/vehicle_cmd_gate /awapi/awapi_awiv_adapter_node 3\n",
- "/control/vehicle_cmd_gate /autoware_api/external/vehicle_status 1\n",
- "/control/vehicle_cmd_gate /control/operation_mode_transition_manager 2\n",
- "/control/vehicle_cmd_gate /system/ad_service_state_monitor 1\n",
- "/control/vehicle_cmd_gate /autoware_api/external/engage 1\n",
- "/perception/object_recognition/tracking/multi_object_tracker /autoware_api/internal/iv_msgs 1\n",
- "/perception/object_recognition/tracking/multi_object_tracker /perception/object_recognition/prediction/map_based_prediction 1\n",
- "/control/trajectory_follower/controller_node_exe /control/vehicle_cmd_gate 1\n",
- "/control/trajectory_follower/controller_node_exe /control/shift_decider 1\n",
- "/planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner /awapi/awapi_awiv_adapter_node 1\n",
- "/planning/scenario_planning/lane_driving/motion_planning/surround_obstacle_checker /awapi/awapi_awiv_adapter_node 1\n",
- "/autoware_api/internal/route /autoware_api/external/route 1\n",
- "/planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner /planning/scenario_planning/scenario_selector 1\n",
- "/planning/scenario_planning/scenario_selector /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner 1\n",
- "/planning/scenario_planning/scenario_selector /planning/scenario_planning/parking/costmap_generator 1\n",
- "/planning/scenario_planning/scenario_selector /planning/scenario_planning/parking/freespace_planner 1\n",
- "/system/ad_service_state_monitor /simulation/concealer 1\n",
- "/system/ad_service_state_monitor /system/system_error_monitor 1\n",
- "/system/ad_service_state_monitor /autoware_api/external/engage 1\n",
- "/system/ad_service_state_monitor /autoware_api/internal/iv_msgs 1\n",
- "/system/ad_service_state_monitor /autoware_api/external/route 1\n",
- "/planning/scenario_planning/parking/freespace_planner /planning/scenario_planning/scenario_selector 1\n",
- "/simulation/concealer /system/ad_service_state_monitor 2\n",
- "/simulation/concealer /autoware_api/internal/operator 1\n",
- "/simulation/concealer /control/operation_mode_transition_manager 2\n",
- "/simulation/concealer /system/emergency_handler 2\n",
- "/simulation/concealer /system/system_error_monitor 1\n",
- "/simulation/concealer /autoware_api/internal/iv_msgs 1\n",
- "/simulation/openscenario_interpreter /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner 1\n",
- "/simulation/concealer /planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner 1\n",
- "/simulation/concealer /control/external_cmd_converter 1\n",
- "/simulation/concealer /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner 1\n",
- "/simulation/concealer /planning/scenario_planning/lane_driving/motion_planning/surround_obstacle_checker 2\n",
- "/simulation/concealer /planning/scenario_planning/motion_velocity_smoother 1\n",
- "/simulation/concealer /planning/scenario_planning/scenario_selector 1\n",
- "/simulation/concealer /planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner 1\n",
- "/simulation/concealer /control/trajectory_follower/lane_departure_checker_node 1\n",
- "/simulation/concealer /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner 1\n",
- "/simulation/concealer /planning/scenario_planning/parking/freespace_planner 1\n",
- "/planning/scenario_planning/scenario_selector /planning/scenario_planning/motion_velocity_smoother 1\n",
- "/control/operation_mode_transition_manager /control/vehicle_cmd_gate 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /planning/planning_diagnostics/planning_error_monitor 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /control/trajectory_follower/controller_node_exe 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /control/trajectory_follower/lane_departure_checker_node 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /simulation/concealer 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /control/operation_mode_transition_manager 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /autoware_api/internal/iv_msgs 1\n",
- "/planning/scenario_planning/motion_velocity_smoother /awapi/awapi_awiv_adapter_node 1\n",
- "/planning/mission_planning/mission_planner /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner 1\n",
- "/planning/mission_planning/mission_planner /control/trajectory_follower/lane_departure_checker_node 1\n",
- "/planning/mission_planning/mission_planner /system/ad_service_state_monitor 1\n",
- "/planning/mission_planning/mission_planner /planning/scenario_planning/scenario_selector 1\n",
- "/planning/mission_planning/mission_planner /autoware_api/internal/route 1\n",
- "/planning/mission_planning/mission_planner /planning/scenario_planning/parking/freespace_planner 1\n",
- "/planning/mission_planning/mission_planner /planning/mission_planning/goal_pose_visualizer 1\n",
- "/autoware_api/external/operator /autoware_api/external/start 1\n",
- "/control/trajectory_follower/controller_node_exe /control/trajectory_follower/lane_departure_checker_node 1\n",
- "/control/shift_decider /control/vehicle_cmd_gate 1\n",
- "/control/vehicle_cmd_gate /system/system_error_monitor 2\n",
- "/control/vehicle_cmd_gate /autoware_api/internal/operator 2\n",
- "/control/vehicle_cmd_gate /control/external_cmd_converter 2\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner /planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner 1\n",
- "/planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner /planning/scenario_planning/lane_driving/motion_planning/obstacle_stop_planner 1\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner 1\n",
- "/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner /simulation/concealer 1\n",
- "/system/emergency_handler /simulation/concealer 1\n",
- "/system/emergency_handler /awapi/awapi_awiv_adapter_node 1\n",
- "/system/emergency_handler /autoware_api/internal/iv_msgs 1\n",
- "/system/emergency_handler /autoware_api/external/fail_safe_state 1\n",
- "/autoware_api/internal/iv_msgs /awapi/awapi_awiv_adapter_node 1\n",
- "/system/system_error_monitor /system/emergency_handler 2\n",
- "/system/system_error_monitor /awapi/awapi_awiv_adapter_node 1\n"
- ]
- },
- {
- "data": {
- "image/svg+xml": [
- "\n",
- "\n",
- "\n",
- "\n",
- "\n"
- ],
- "text/plain": [
- ""
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false DFG_ENABLED\n",
"%%skip_if_false DFG_PLOT\n",
@@ -7567,16 +483,17 @@
"g.render(\"level_graph.svg\")\n",
"\n",
"g"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 51,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
@@ -7743,39 +660,18 @@
" deps = [get_dep_tree(dep, lvl + 1, set(visited_topics), children_are_dep_cbs, start_time) for dep in deps]\n",
" deps = [dep for dep in deps if dep is not None]\n",
" return DepTree(inst, deps)"
- ]
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ }
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "pycharm": {
- "name": "#%%\n"
- }
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[CACHE] Creating cache entry for trees (in cache/trees_507fec94db.pkl).\n"
- ]
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "572f74ee819445209689768947f4e6fb",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Building message chains for topic /control/command/control_cmd: 0%| | 0/1500 [00:00, ?it/s]"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"\n",
@@ -7796,28 +692,18 @@
" return all_trees\n",
"\n",
"trees = cached(\"trees\", build_dep_trees, [TR_PATH])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 28,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'Skipped (evaluated BW_ENABLED to False)'"
- ]
- },
- "execution_count": 28,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"%%skip_if_false BW_ENABLED\n",
@@ -7867,16 +753,17 @@
" 'min': parse_bytes(m.group(\"min\")),\n",
" 'mean': parse_bytes(m.group(\"mean\")),\n",
" 'max': parse_bytes(m.group(\"max\"))}\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 29,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
@@ -7941,16 +828,17 @@
" e2es, e2e_paths = zip(*relevant_e2es(tree, [\"\"]))\n",
" e2ess.append(e2es)\n",
" e2e_pathss.append(e2e_paths)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 30,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"outputs": [],
"source": [
"#from matplotlib.animation import FuncAnimation\n",
@@ -7991,28 +879,18 @@
"#\n",
"# print(f\" {i:>3d}: N\", node.path)\n",
"# print(\"==================\")\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 31,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'Skipped (evaluated E2E_PLOT to False)'"
- ]
- },
- "execution_count": 31,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"%%skip_if_false E2E_PLOT\n",
@@ -8050,16 +928,17 @@
"ax.set_ylabel(\"End-to-End latency [s]\")\n",
"ax2.set_ylabel(\"End-to-End path length\")\n",
"None"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 32,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
@@ -8114,28 +993,18 @@
"\n",
"relevant_trees = [get_relevant_tree(tree, _leaf_filter) for tree in trees]\n",
"relevant_trees = [t for t in relevant_trees if t]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 33,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'Skipped (evaluated E2E_PLOT to False)'"
- ]
- },
- "execution_count": 33,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"%%skip_if_false E2E_PLOT\n",
@@ -8218,28 +1087,18 @@
"ax_rel.legend()\n",
"\n",
"None"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 34,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'Skipped (evaluated E2E_PLOT to False)'"
- ]
- },
- "execution_count": 34,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"%%skip_if_false E2E_PLOT\n",
@@ -8267,28 +1126,18 @@
"ax.legend()\n",
"\n",
"None"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 35,
+ ],
"metadata": {
+ "collapsed": false,
"pycharm": {
"name": "#%%\n"
}
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'Skipped (evaluated E2E_PLOT to False)'"
- ]
- },
- "execution_count": 35,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"%%skip_if_false E2E_PLOT\n",
@@ -8460,82 +1309,126 @@
"labels, handles = list(zip(*legend_entries.items()))\n",
"ax.legend(handles, labels)\n",
"print(len(y_labels))"
- ]
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ }
},
{
"cell_type": "markdown",
- "metadata": {
- "pycharm": {
- "name": "#%% md\n"
- }
- },
"source": [
"# Find Top Critical Paths\n",
"\n",
"For each message tree, find its critical path and runner-up candidates. Then, for the whole timeseries, find the top critical paths by occurence count.\n",
"Critical paths are abstracted by their E2E-latency and a list of passed CBs and topics.\n"
- ]
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%% md\n"
+ }
+ }
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": null,
+ "outputs": [],
+ "source": [
+ "%%skip_if_false E2E_ENABLED\n",
+ "\n",
+ "from termcolor import colored\n",
+ "from tqdm import tqdm\n",
+ "from matching.subscriptions import sanitize\n",
+ "\n",
+ "critical_paths = {}\n",
+ "print(len(relevant_trees))\n",
+ "for tree in tqdm(trees):\n",
+ " crit = critical_path(tree)\n",
+ "\n",
+ " def _owner(inst):\n",
+ " match inst:\n",
+ " case TrCallbackInstance(callback_obj=cb_obj):\n",
+ " cb_obj: TrCallbackObject\n",
+ " if cb_obj and cb_obj.callback_symbol:\n",
+ " sym = repr(sanitize(cb_obj.callback_symbol.symbol))\n",
+ " else:\n",
+ " sym = str(cb_obj.id)\n",
+ " return sym\n",
+ " case TrPublishInstance(publisher=pub):\n",
+ " pub: TrPublisher\n",
+ " topic = pub.topic_name\n",
+ " return topic\n",
+ " case _:\n",
+ " raise ValueError()\n",
+ "\n",
+ " key = tuple(map(_owner, crit[::-1]))\n",
+ " if key not in critical_paths:\n",
+ " critical_paths[key] = []\n",
+ " critical_paths[key].append(crit)\n",
+ "\n",
+ "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",
+ " next_inst = None\n",
+ " durations = []\n",
+ " for inst in path:\n",
+ " match inst:\n",
+ " case TrCallbackInstance(timestamp=t, duration=d):\n",
+ " if not next_inst:\n",
+ " durations.append(d)\n",
+ " else:\n",
+ " durations.append(min(d, next_inst.timestamp - t))\n",
+ " case TrPublishInstance(timestamp=t):\n",
+ " if not next_inst:\n",
+ " durations.append(0.0)\n",
+ " else:\n",
+ " durations.append(next_inst.timestamp - t)\n",
+ " case _:\n",
+ " raise ValueError()\n",
+ " next_inst = inst\n",
+ " paths_durations.append(durations)\n",
+ "\n",
+ " durations = list(map(lambda l: sum(l) / len(l), zip(*paths_durations)))[::-1]\n",
+ " assert len(durations) == len(key)\n",
+ " perc = np.percentile(durations, [70, 90, 95, 100])\n",
+ " colors = [\"green\", \"yellow\", \"red\", \"magenta\"]\n",
+ " for part, duration in zip(key, durations):\n",
+ " E2E_PLOT_TIMESTAMP = 0\n",
+ " for j, p in enumerate(perc):\n",
+ " if duration < p:\n",
+ " break\n",
+ " 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",
+ "out_df.to_csv(os.path.join(OUT_PATH, \"e2e.csv\"), sep=\"\\t\")"
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "0\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 83.44it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "======== 1x: 5092.585ms\n",
- " -> \u001b[35m101.022ms\u001b[0m /map/vector_map\n",
- " -> \u001b[33m42.454ms\u001b[0m void(mission_planner::MissionPlannerLanelet2)(autoware_auto_mapping_msgs::msg::HADMapBin)\n",
- " -> \u001b[32m1.466ms\u001b[0m void(mission_planner::MissionPlanner)(geometry_msgs::msg::PoseStamped)\n",
- " -> \u001b[32m1.153ms\u001b[0m /planning/mission_planning/route\n",
- " -> \u001b[32m0.050ms\u001b[0m void(behavior_path_planner::BehaviorPathPlannerNode)(autoware_auto_planning_msgs::msg::HADMapRoute)\n",
- " -> \u001b[32m3.374ms\u001b[0m void(behavior_path_planner::BehaviorPathPlannerNode)()\n",
- " -> \u001b[32m2.681ms\u001b[0m /planning/scenario_planning/lane_driving/behavior_planning/path_with_lane_id\n",
- " -> \u001b[32m8.293ms\u001b[0m void(behavior_velocity_planner::BehaviorVelocityPlannerNode)(autoware_auto_planning_msgs::msg::PathWithLaneId)\n",
- " -> \u001b[32m2.795ms\u001b[0m /planning/scenario_planning/lane_driving/behavior_planning/path\n",
- " -> \u001b[32m1.711ms\u001b[0m void(ObstacleAvoidancePlanner)(autoware_auto_planning_msgs::msg::Path)\n",
- " -> \u001b[32m0.173ms\u001b[0m /planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner/trajectory\n",
- " -> \u001b[32m0.580ms\u001b[0m void(motion_planning::ObstacleStopPlannerNode)(autoware_auto_planning_msgs::msg::Trajectory)\n",
- " -> \u001b[32m0.776ms\u001b[0m /planning/scenario_planning/lane_driving/trajectory\n",
- " -> \u001b[32m0.005ms\u001b[0m void(ScenarioSelectorNode)(autoware_auto_planning_msgs::msg::Trajectory)\n",
- " -> \u001b[32m0.877ms\u001b[0m /planning/scenario_planning/scenario_selector/trajectory\n",
- " -> \u001b[32m11.947ms\u001b[0m void(motion_velocity_smoother::MotionVelocitySmootherNode)(autoware_auto_planning_msgs::msg::Trajectory)\n",
- " -> \u001b[32m0.248ms\u001b[0m /planning/scenario_planning/trajectory\n",
- " -> \u001b[32m0.001ms\u001b[0m void(autoware::motion::control::trajectory_follower_nodes::Controller)(autoware_auto_planning_msgs::msg::Trajectory)\n",
- " -> \u001b[32m2.186ms\u001b[0m void(autoware::motion::control::trajectory_follower_nodes::Controller)()\n",
- " -> \u001b[32m0.000ms\u001b[0m /control/trajectory_follower/control_cmd\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "/tmp/ipykernel_9555/3745443004.py:37: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
- " out_df.append(path_records)\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"%%skip_if_false E2E_ENABLED\n",
"\n",
@@ -8650,4 +1543,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
-}
+}
\ No newline at end of file