Skip to content
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

[Debug] Add debugging support for timestamps in socket communication (optional) #371

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

loumalouomega
Copy link
Member

@loumalouomega loumalouomega commented Feb 14, 2025

📝 Description

This PR introduces a DebugTimeInfo function to log timestamped messages for key socket communication operations. This update enhances the ability to monitor and debug the timing of network communication operations.

Details:

The following updates were made:

  • New Method Added: DebugTimeInfo was added to print debug messages with timestamps in a human-readable format. It is guarded by the CO_SIM_IO_TIMESTAMP_DEBUG preprocessor flag, ensuring the feature can be enabled or disabled as needed.

  • Time Debug Logs: The DebugTimeInfo function was integrated into various methods like ConnectDetail, DisconnectDetail, SendString, ReceiveString, SendDataContainer, ReceiveDataContainer, SendSize, and ReceiveSize to log timestamps before and after important communication steps.

  • Chrono Header: The chrono, ctime, and iomanip headers were included to handle time formatting and timestamp generation. Only when required.

🆕 Changelog

Commits:

Patch breakdown:

  • CMakeLists.txt: Minor modifications to define preprocessor flag.
  • base_socket_communication.hpp: Added the declaration of the new DebugTimeInfo function.
  • base_socket_communication.cpp:
    • Implemented the DebugTimeInfo function.
    • Integrated debug logging with timestamps before and after key socket operations.
    • Introduced chrono and time formatting utilities to capture and display time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant