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

iox-1391 Move time-related classes to Time module #1863

Conversation

mossmaurice
Copy link
Contributor

@mossmaurice mossmaurice commented Jan 31, 2023

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-123-this-is-a-branch)
  5. Commits messages are according to this guideline
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. All touched (C/C++) source code files from iceoryx_hoofs are added to ./clang-tidy-diff-scans.txt
  11. Assign PR to reviewer

Notes for Reviewer

  • Move deadline_timer, adaptive_wait and Duration to Time module
  • Remove 2nd level namespace cxx
  • Create legacy header for backwards compatibility

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • All touched (C/C++) source code files from iceoryx_hoofs have been added to ./clang-tidy-diff-scans.txt
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

@mossmaurice mossmaurice added refactoring Refactor code without adding features globex labels Jan 31, 2023
@mossmaurice mossmaurice added this to the High prio milestone Jan 31, 2023
@mossmaurice mossmaurice self-assigned this Jan 31, 2023
@mossmaurice mossmaurice force-pushed the iox-1391-move-time-classes-to-time-module branch 2 times, most recently from e770c38 to 0266452 Compare January 31, 2023 21:51
@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

Merging #1863 (a264a65) into master (e832ccb) will increase coverage by 0.00%.
The diff coverage is 83.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1863   +/-   ##
=======================================
  Coverage   74.97%   74.97%           
=======================================
  Files         383      383           
  Lines       14692    14692           
  Branches     2099     2099           
=======================================
+ Hits        11015    11016    +1     
  Misses       3031     3031           
+ Partials      646      645    -1     
Flag Coverage Δ
unittests 74.64% <58.33%> (+<0.01%) ⬆️
unittests_timing 15.28% <50.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../include/iceoryx_dust/posix_wrapper/named_pipe.hpp 100.00% <ø> (ø)
iceoryx_dust/source/posix_wrapper/named_pipe.cpp 51.53% <0.00%> (ø)
...oofs/internal/posix_wrapper/unix_domain_socket.hpp 100.00% <ø> (ø)
iceoryx_hoofs/source/units/duration.cpp 92.85% <ø> (ø)
iceoryx_hoofs/time/include/iox/detail/duration.inl 94.47% <ø> (ø)
...nternal/popo/building_blocks/chunk_distributor.hpp 100.00% <ø> (ø)
...eoryx_posh/internal/runtime/ipc_interface_base.hpp 100.00% <ø> (ø)
...yx_posh/internal/runtime/ipc_runtime_interface.hpp 100.00% <ø> (ø)
...clude/iceoryx_posh/roudi/roudi_cmd_line_parser.hpp 100.00% <ø> (ø)
iceoryx_posh/source/roudi/roudi.cpp 58.44% <0.00%> (ø)
... and 6 more

Copy link
Contributor

@elfenpiff elfenpiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No please do not name this Time it is a Units module. Otherwise we will create in the near future a lot of additional tiny modules with one or two classes of content.

It may makes sense that in this Units module is later also a unit for velocity, acceleration etc. for our users or we have an abstraction for of the unit memory

@elfenpiff
Copy link
Contributor

No please do not name this Time it is a Units module. Otherwise we will create in the near future a lot of additional tiny modules with one or two classes of content.

It may makes sense that in this Units module is later also a unit for velocity, acceleration etc. for our users or we have an abstraction for of the unit memory

@mossmaurice The high level classes like adaptive_wait etc. would not be stored in a units module but here I would try to find something more generic than Time.

@mossmaurice
Copy link
Contributor Author

mossmaurice commented Feb 1, 2023

@elfenpiff Thanks for your review and remarks.

No please do not name this Time it is a Units module. Otherwise we will create in the near future a lot of additional tiny modules with one or two classes of content.

It may makes sense that in this Units module is later also a unit for velocity, acceleration etc. for our users or we have an abstraction for of the unit memory

I remember we had this discussion in #1600 during October 2022. I can definitely see your point that Units is something different and might be extended later. Back in Oct we concluded that, as you mentioned, in order to keep the number of overall modules as low as possible, we will not further differentiate and just use one module for all time- and units-related classes. IMHO that's still a good idea and we should not change this decision. I would be ok with renaming the current module to something like Units and time utilities. The STL has a similar module Date and time utilites, which contains the clocks, time points, duration, etc. What do you think?

@elBoberido What's your take? Shall we change the plan?

@mossmaurice mossmaurice force-pushed the iox-1391-move-time-classes-to-time-module branch 2 times, most recently from c5d5c25 to d84afd9 Compare February 1, 2023 11:06
@mossmaurice mossmaurice requested a review from elfenpiff February 1, 2023 11:06
@elfenpiff
Copy link
Contributor

@elBoberido What's your take? Shall we change the plan?

@mossmaurice Let it be Time then. In the readme you linked there we also concluded that every posix construct is stored inside the posix folder and that we there replicate the component structure.
Duration is a posix abstraction (see timeval, timespec and clock_gettime) and belongs therefore in posix/time but I would also agree to simply posix

The deadline timer uses the duration and has no posix dependency and can therefore be stored simply in time.

The adaptive wait is a little bit more complicated. It uses std::this_thread::yield() and std::this_thread::sleep_for calls which are not allowed for us in the final implementation and they have to be replaced with the posix calls sched_yield and nanosleep.
So I would recommend to move adaptive_wait into posix/time since this is the correct final resting place for it. If you have time you can use the posix call and replace std::this_thread::yield() and std::this_thread::sleep_for for the previously mentioned calls - then it is cleaned up correctly. For me it makes sense since those are only 3 additional line changes.

@mossmaurice
Copy link
Contributor Author

mossmaurice commented Feb 1, 2023

@elfenpiff Got it. It's now as follows:

  1. Classes which depend on a low-level OSI API go into posix, I would like to rename this folder at some point after v3.0
posix/time/include/iox/deadline_timer.hpp
posix/time/include/iox/detail/adaptive_wait.hpp
posix/time/source/adaptive_wait.cpp
posix/time/source/deadline_timer.cpp
  1. Classes which only depend on allowed STL headers go into the iceoryx_hoofs/$MODULE_NAME
time/include/iox/duration.hpp
time/include/iox/detail/duration.inl

I'll carve out the std::chrono, timespec and timeval-dependecies into iceoryx_dust like std_string_support.hpp on a follow-up PR.

@mossmaurice mossmaurice force-pushed the iox-1391-move-time-classes-to-time-module branch from c41239a to 17e1f4d Compare February 1, 2023 19:10
@elBoberido
Copy link
Member

@mossmaurice while chrono can be moved to dust, timespec and timeval must remain in hoofs since it is our native way to convert a Duration to a time value for POSIX calls like sem_timedwait. These could potentially be moved to 'posix/time/whatever.hpp'

@mossmaurice mossmaurice force-pushed the iox-1391-move-time-classes-to-time-module branch 3 times, most recently from 39462aa to 525c006 Compare February 7, 2023 15:59
@mossmaurice mossmaurice removed the request for review from FerdinandSpitzschnueffler February 7, 2023 16:00
@mossmaurice mossmaurice force-pushed the iox-1391-move-time-classes-to-time-module branch from 525c006 to a264a65 Compare February 7, 2023 16:09
@mossmaurice
Copy link
Contributor Author

@elBoberido

while chrono can be moved to dust, timespec and timeval must remain in hoofs since it is our native way to convert a Duration to a time value for POSIX calls like sem_timedwait. These could potentially be moved to 'posix/time/whatever.hpp'

That's true, I'll address that on the follow-up PR.

@mossmaurice mossmaurice merged commit 53ee7c0 into eclipse-iceoryx:master Feb 8, 2023
@mossmaurice mossmaurice deleted the iox-1391-move-time-classes-to-time-module branch February 8, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
globex refactoring Refactor code without adding features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split iceoryx_hoofs into logical modules
3 participants