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

src: initialize prev_idle_time_ on ThreadMetrics #156

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

santigimeno
Copy link
Member

Make sure prev_idle_time_ is initialize in the
ThreadMetrics::ThreadMetrics(SharedEnvInst envinst) constructor so the loop utilization calculations are correct, otherwise the default value 0 is used which may lead to meaningless huge values (greater than 1 for the matter).
No need to initialize this value in the
ThreadMetrics::ThreadMetrics(uint64_t thread_id) as this is only used in the EnvInst constructor on which having a value of 0 makes sense.

Make sure `prev_idle_time_` is initialized in the
`ThreadMetrics::ThreadMetrics(SharedEnvInst envinst)` constructor
so the loop utilization calculations are correct, otherwise the default
value 0 is used which may lead to meaningless huge values (greater than
1 for the matter).
No need to initialize this value in the
`ThreadMetrics::ThreadMetrics(uint64_t thread_id)` as this is only used
in the `EnvInst` constructor on which having a value of 0 makes sense.

PR-URL: #156
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Juan José Arboleda <soyjuanarbol@gmail.com>
@santigimeno santigimeno merged commit 5da27a2 into node-v20.x-nsolid-v5.x Jul 24, 2024
16 of 18 checks passed
@santigimeno santigimeno deleted the santi/fix_loop_metrics_calc branch July 24, 2024 20:06
santigimeno added a commit that referenced this pull request Jul 24, 2024
Make sure `prev_idle_time_` is initialized in the
`ThreadMetrics::ThreadMetrics(SharedEnvInst envinst)` constructor
so the loop utilization calculations are correct, otherwise the default
value 0 is used which may lead to meaningless huge values (greater than
1 for the matter).
No need to initialize this value in the
`ThreadMetrics::ThreadMetrics(uint64_t thread_id)` as this is only used
in the `EnvInst` constructor on which having a value of 0 makes sense.

PR-URL: #156
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Juan José Arboleda <soyjuanarbol@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants