-
Notifications
You must be signed in to change notification settings - Fork 5
#88/add performance timing instrumentation #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yunlishao
wants to merge
11
commits into
main
Choose a base branch
from
bug/#88
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds logic to build_sumo_executables.ps1 that: - Patches tools/build_config/templates.py before building to fix escape issues - Restores templates.py to upstream state after build completes - Handles restoration in error cases Also updates cav_casestudy submodule and adds CLAUDE.md project instructions.
Creates tests/UserScenarios/ with workflow for handling user-provided scenarios: - Folder structure tracked via .gitkeep (exists in all branches) - README.md documents workflow from OneDrive portal to debugging - All scenario contents gitignored (maintains privacy) - Enables full IDE/debugging access without committing proprietary files This establishes a standardized process for receiving user scenarios via OneDrive file request, creating issue-specific branches, debugging locally, and cleaning up after resolution. Addresses Task 1 of #80
Adds intelligent config file discovery to streamline debugging without manual VS project settings changes: **Auto-discovery logic:** 1. Check TrafficLayer/.active_config for explicit path 2. Auto-discover single YAML in tests/UserScenarios/ 3. Error with guidance if multiple YAMLs or none found 4. Always allows -f override **Implementation:** - Cross-platform file discovery (WIN32 and POSIX) - C++11 compatible (no std::filesystem dependency for discovery) - Works when working directory is repo root (VS debugging scenario) - Deployed executables still require explicit -f flag **Changes:** - Add findYamlFiles() with platform-specific implementations - Remove hardcoded LocalDebuggerCommandArguments from .vcxproj.user - Update UserScenarios/README.md with new workflow - Gitignore TrafficLayer/.active_config (per-worktree) **Usage:** - Single scenario: Just F5 in VS - Multiple scenarios: echo path/to/config.yaml > TrafficLayer/.active_config - Deployment: TrafficLayer.exe -f path/to/config.yaml Part of #80 (Task 2)
Update SENDBUFFERSIZE in RealSimSocket.cpp and buffer allocations in RealSimPack.m to support larger message payloads. The previous 200-byte limit was insufficient for messages with all fields enabled and maximum-length string values (calculated max: 444 bytes).
Added PerformanceTimer.h integration to measure execution time of key operations in runStep(): - receive_realsim: Data reception from traffic simulator - map_ids: Vehicle ID mapping - cleanup_vehicles: Vehicle removal - update_traffic_state: Traffic state updates - sync_signals: Traffic signal synchronization - send_ego: Ego vehicle data transmission - refresh_visualization: Visualization updates Timing disabled by default, enable with ENABLE_PERF_TIMING define.
- Remove unconditional ENABLE_PERF_TIMING define from header - Each .cpp file must now define flag before including header - Add PERF_LOG for printf-style diagnostic messages - Truncate log file on init instead of append
- Add PERF_LOG calls for receive operations - Log socket buffer status and message counts - Wrap diagnostics under ENABLE_PERF_TIMING flag
- Add timing for main loop, traffic step, send operations - Log vehicle counts and send buffer status - Wrap all timing under ENABLE_PERF_TIMING flag
cjffly
approved these changes
Dec 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in performance timing instrumentation to TrafficLayer and VirEnvHelper to diagnose why FIXS co-simulation runs slower than real-time as traffic scales up.
This PR does not fix the performance issue - it adds measurement capabilities. Investigation found that SUMO's
traffic_stepdegrades from ~3.5ms to ~20ms over ~2 minutes of simulation, which is a SUMO limitation.Related Issues / Tasks
Closes #88
See investigation findings: #88 (comment)
Type of Change
Affected Modules / Components
CommonLib/PerformanceTimer.h- new opt-in performance timing utility withPERF_LOGmacroCommonLib/VirEnvHelper.cpp- socket timing at lines 423-428 (recv_socket), 405-452 (receive_realsim)TrafficLayer/TrafficLayer/mainTrafficLayer.cpp- timing at lines 911-1384 (main_loop), 917-943 (traffic_step)tests/UserScenarios/- folder for proprietary user test casesCode Snippets
recv_socket timing (VirEnvHelper.cpp:423-428)
traffic_step timing (mainTrafficLayer.cpp:917-943)
Performance Logs
https://gist.github.com/yunlishao/f4d9dc8e9a0af653242db83ed909caaf
or download here:
Test Cases
Performance logs generated from
tests/UserScenarios/issue_88_runningSlowIssue/Environment
Checklist
Additional Notes
Performance timing is opt-in via
PERF_LOGmacro to avoid overhead in normal builds.