mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-09 00:33:33 -05:00
Use libcpuid for detect optimal threads count.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -32,21 +32,17 @@ void cpu_init_common();
|
||||
|
||||
|
||||
void cpu_init() {
|
||||
# ifdef XMRIG_NO_LIBCPUID
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
|
||||
cpu_info.count = sysinfo.dwNumberOfProcessors;
|
||||
cpu_info.total_logical_cpus = sysinfo.dwNumberOfProcessors;
|
||||
# endif
|
||||
|
||||
cpu_init_common();
|
||||
}
|
||||
|
||||
|
||||
int get_optimal_threads_count(int mining_algo) {
|
||||
int count = cpu_info.count / 2;
|
||||
return count < 1 ? 1 : count;
|
||||
}
|
||||
|
||||
|
||||
int affine_to_cpu_mask(int id, unsigned long mask)
|
||||
{
|
||||
if (id == -1) {
|
||||
|
||||
Reference in New Issue
Block a user