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).
The function
node_stats(N, Interval, FoldFun, Init)has an issue with the returned number of reductions. This is becauseerlang:statistics(reductions)returns a tuple with{Total, Count_since_last_call}but those calls are global.reconrelies on calling this function twice and using the count, but if any other process in the same VM callserlang: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, callerlang:statistics(reductions)manually. Alternatively, callrecon: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).