Use libcpuid for detect optimal threads count.
This commit is contained in:
parent
0a6d70c499
commit
f329410940
9 changed files with 180 additions and 87 deletions
|
@ -33,18 +33,14 @@ void cpu_init_common();
|
|||
|
||||
|
||||
void cpu_init() {
|
||||
cpu_info.count = sysconf(_SC_NPROCESSORS_CONF);
|
||||
# ifdef XMRIG_NO_LIBCPUID
|
||||
cpu_info.total_logical_cpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||
# endif
|
||||
|
||||
cpu_init_common();
|
||||
}
|
||||
|
||||
|
||||
int get_optimal_threads_count() {
|
||||
int count = cpu_info.count / 2;
|
||||
return count < 1 ? 1 : count;
|
||||
}
|
||||
|
||||
|
||||
int affine_to_cpu_mask(int id, unsigned long mask)
|
||||
{
|
||||
cpu_set_t set;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue