Use libcpuid for detect optimal threads count.

This commit is contained in:
XMRig 2017-05-03 13:48:08 +03:00
parent 0a6d70c499
commit f329410940
9 changed files with 180 additions and 87 deletions

View file

@ -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) {