-
Notifications
You must be signed in to change notification settings - Fork 5
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
Duplication of opmon "info" struct counter variables #172
Comments
Hi, sorry for not having managed to answer before. I think there are 2 different aspects to this issue. I agree that having to keep a copy of each variable as a data member is cumbersome/error prone/generally suboptimal, and that If I recall correctly, this is one of the reasons why we moved away from the original monitoring model based on In terms of where the issue belongs, I'd say with |
Incidentally, a recent fix to |
@alessandrothea , @philiprodrigues can this issue be followed up and eventually closed? |
I think so |
(Maybe this issue should go in a different package, but probably the solution should go here).
The opmon
get_info()
function is typically called from a different thread than the one in which the opmon counters are actually filled. That means we have to duplicate each of the members of the info struct (egmymoduleinfo::Info
) with astd::atomic
member variable ofMyModule
, and then copy the value of each atomic into theInfo
object insideget_info()
. Wecould avoid this duplication by holding a
mymodule::Info
as a member variable ofMyModule
and updating the counters in that object. Then the implementation ofget_info()
is justci.add(m_info);
. This approach would require the counters in theInfo
object to be atomic. Branchphiliprodrigues/atomic-info-struct
of appfwk has a proof-of-concept for one way to achieve this with moo templates.The text was updated successfully, but these errors were encountered: