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

recon:node_stats - Issue in number of reductions #108

Open
rewritten opened this issue Sep 21, 2023 · 1 comment
Open

recon:node_stats - Issue in number of reductions #108

rewritten opened this issue Sep 21, 2023 · 1 comment

Comments

@rewritten
Copy link

The function node_stats(N, Interval, FoldFun, Init) has an issue with the returned number of reductions. This is because erlang:statistics(reductions) returns a tuple with {Total, Count_since_last_call} but those calls are global.

recon relies on calling this function twice and using the count, but if any other process in the same VM calls erlang:statistics(reductions), then the returned number is much lower than the real number.

You can see it for instance calling recon:node_stats_list(1, 1000) in a task and, just before one second has passed, call erlang:statistics(reductions) manually. Alternatively, call recon:node_stats_list(1, 1000) twice, concurrently: one of the two stats will have a very very low number of reductions.

Probably reductions should instead be computed as delta between the Total (first element).

@rewritten rewritten changed the title Issue in number of reductions recon:node_stats - Issue in number of reductions Sep 21, 2023
@ferd
Copy link
Owner

ferd commented Sep 22, 2023

yeah that's a good idea for a more accurate result. I never had to run into that issue in the past (recon used to be a bunch of snippets coworkers and I just ran in the shell), but with the amount of tooling that can run in the background, the risk of higher interference has grown over time.

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

No branches or pull requests

2 participants