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

cpuminer: Improve speed stat tracking. #1921

Merged
merged 1 commit into from
Oct 12, 2019

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Oct 9, 2019

Currently, in order to allow both the normal continuous and discrete CPU mining modes, a non-blocking channel send is used to update the number of hashes per second since the speed monitor is not running or required in discrete mode.

As a result, in the case the total hashes are already being updated by another goroutine, the update will be ignored which can lead to reporting a lower hash rate than is accurate.

In order to better handle the aforementioned case, this modifies the code to introduce a separate struct with its own mutex to be used for tracking the speed stats and uses a unique instance for the continuous and discrete mining modes. A separate instance is used to ensure the discrete mining mode is unable to interfere with the continuous mode stats.

Currently, in order to allow both the normal continuous and discrete CPU
mining modes, a non-blocking channel send is used to update the number
of hashes per second since the speed monitor is not running or required
in discrete mode.

As a result, in the case the total hashes are already being updated by
another goroutine, the update will be ignored which can lead to
reporting a lower hash rate than is accurate.

In order to better handle the aforementioned case, this modifies the
code to introduce a separate struct with its own mutex to be used for
tracking the speed stats and uses a unique instance for the continuous
and discrete mining modes.  A separate instance is used to ensure the
discrete mining mode is unable to interfere with the continuous mode
stats.
@davecgh davecgh added this to the 1.5.0 milestone Oct 9, 2019
@davecgh davecgh merged commit 9a9cd07 into decred:master Oct 12, 2019
@davecgh davecgh deleted the cpuminer_improve_speed_stat_tracking branch October 12, 2019 02:13
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.

2 participants