-
Notifications
You must be signed in to change notification settings - Fork 374
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 #489 replace introspection threads with periodic task #490
Iox #489 replace introspection threads with periodic task #490
Conversation
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
…essIntrospection Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
…Introspection Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
-
Could be the TimeSpecReference in the run() method maybe Monotonic? I think the timeout interval does not depend on the current value of time.
-
This is maybe for future use: For validation purpose the user maybe wants to know how often the task was executed. A getter method like
uint64_t getExecutionCount()
could be helpful for tests.
iceoryx_utils/include/iceoryx_utils/internal/concurrent/periodic_task.hpp
Show resolved
Hide resolved
iceoryx_utils/include/iceoryx_utils/internal/concurrent/periodic_task.hpp
Outdated
Show resolved
Hide resolved
@dkroenke I will have a look if a monotonic clock is possible with the semaphore. Regarding the |
@dkroenke regarding the monotonic clock, I just checked the the semaphore documentation and an absolute timeout is required, therefore we cannot use a monotonic clock |
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improves the sending process of introspection data. I just would consider to use chrono
(why would we not use it?) . Tests are missing but this is a draft anyway.
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/port_introspection.hpp
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/port_introspection.inl
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
done with #502 |
…oolIntrospection Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
@elfenpiff 350cb50 has no iox number. |
3e1ad66
to
3b495ff
Compare
|
||
/// @brief copy data fro internal struct into interface struct | ||
void copyMemPoolInfo(const MemoryManager& memoryManager, MemPoolInfoContainer& dest) noexcept; | ||
|
||
private: | ||
units::Duration m_sendInterval{units::Duration::seconds<unsigned long long int>(1)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using namespace iox::units::duration_literals
will enable you to use the user-defined literal operation 1_s
Locally in a class it should not lead to evil namespace polution.
Reminds me of plan to clean up the using namespace
in iceoryx_posh_types.hpp 😋
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's unfortunately not possible within a class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right. One thing I saw when checking the coreguidlines. They explicitly exclude using namespace std::units::duration_literals
, see. So we might leave them in headers but probably not in iceoryx_posh_types.hpp as this will increase lookup times.
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/mempool_introspection.hpp
Outdated
Show resolved
Hide resolved
auto elapsedTime{std::chrono::duration_cast<std::chrono::milliseconds>(stop - start)}; | ||
|
||
EXPECT_THAT(elapsedTime, Ge(SLEEP_TIME)); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding a test case that call start()
again while the thread/task is still running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what PeriodicTaskWhichIsActiveAppliesNewIntervalAfterStart
is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, ok you're calling start()
indirectly via the other c'tor. That's what I missed. Could we make the user more aware that the behaviour of the two c'tors is very different? One does start the other not. I have the feeling folks will do the same mistake as I in the near future (and my future self, too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestions? An @attention
doxygen tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm torn inbetween. What about removing the "automatic start c'tor"? An explicit start call might be simpler for most users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do that, but then you have the opposite problem to not forget to start it. I'm also not quite sure about this.
Just as food for thought, how about something like this
class PeriodicTask {
enum class OnInit {
STOPPED,
RUNNING
}
PeriodicTask(OnInit onInit, ...)
};
PeriodicTask task{PeriodicTask::OnInit::RUNNING, ...}
It could also be the separator between the actual PeriodicTask
args and the variadic args forwarded to the callable and thus help prevent ambiguities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your approach, but it might create too much noise. There can be already quite a lot of args. If we leave out the "automatic start c'tor" won't the user notice this right away and then add start?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, I think it will take as much time as when starting immediately and noticing it's not what you wanted. Maybe even longer because noticing that something is not happening might take longer to realize.
Maybe we also need input from others :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a struct to indicate the automatic or manual start of the task
iceoryx_utils/include/iceoryx_utils/internal/concurrent/periodic_task.hpp
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/port_introspection.hpp
Outdated
Show resolved
Hide resolved
#define private public | ||
#define protected public | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only 5 remaining. Those also need to go the way of the dodo in order to support Windows.
…r msvc and mac Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
…ction tests Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
bf5dbb8
to
d9872a0
Compare
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/port_introspection.hpp
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/port_introspection.hpp
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/port_introspection.inl
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.hpp
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.inl
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.inl
Outdated
Show resolved
Hide resolved
iceoryx_utils/include/iceoryx_utils/internal/concurrent/periodic_task.hpp
Outdated
Show resolved
Hide resolved
…ction classes Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
oh, and could the one of the reviewer please take care to the reviewer task list ;) |
@@ -62,12 +62,12 @@ class PortIntrospection | |||
|
|||
struct PublisherInfo | |||
{ | |||
PublisherInfo() = default; | |||
PublisherInfo() noexcept {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elBoberido This will generate a warning in more strict builds:
https://rextester.com/live/WANPI61259
-Weverything
504430806/source.cpp:7:32: warning: extra ';' after member function definition [-Wextra-semi]
PublisherInfo() noexcept {};
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sculpordwarf thanks for the hint. I'll fix it with my next PR. I'm wondering why our CI didn't catch it
Pre-Review Checklist for the PR Author
iox-#123-this-is-a-branch
)iox-#123 commit text
)git commit -s
)Notes for Reviewer
This PR replaces the thread in the introspection classes with a
PeriodicTask
and simplifies the code. The test time with the RouDiEnvironment will also be reduced a little bit (1s posh_modultetests and 2s in posh_integrationtests), since the stopping of the threads is not done by a polling with 100ms period.Checklist for the PR Reviewer
Post-review Checklist for the PR Author
Post-review Checklist for the Eclipse Committer
References