1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2025-10-13 11:10:39 +00:00

Modify the table matcher a bit. Put some weights on the different fields.

Priously all fields in the matchtable were treated equal in importance.
With this change, the cache size a taken with half the weight in the decision.

Also add detection entries for some more recent Haswells, and the respective
tests. These are an i5 Haswell from a Mac Book Pro, and a i7 Haswel from
Thinkpad T540.
This commit is contained in:
Veselin Georgiev 2015-04-17 01:21:30 +03:00
commit 94fc6ae36a
4 changed files with 200 additions and 10 deletions

View file

@ -78,16 +78,16 @@ static int score(const struct match_entry_t* entry, const struct cpu_id_t* data,
int brand_code, int model_code)
{
int res = 0;
if (entry->family == data->family ) res++;
if (entry->model == data->model ) res++;
if (entry->stepping == data->stepping ) res++;
if (entry->ext_family == data->ext_family) res++;
if (entry->ext_model == data->ext_model ) res++;
if (entry->ncores == data->num_cores ) res++;
if (entry->l2cache == data->l2_cache ) res++;
if (entry->l3cache == data->l3_cache ) res++;
if (entry->brand_code == brand_code ) res++;
if (entry->model_code == model_code ) res++;
if (entry->family == data->family ) res += 2;
if (entry->model == data->model ) res += 2;
if (entry->stepping == data->stepping ) res += 2;
if (entry->ext_family == data->ext_family) res += 2;
if (entry->ext_model == data->ext_model ) res += 2;
if (entry->ncores == data->num_cores ) res += 2;
if (entry->l2cache == data->l2_cache ) res += 1;
if (entry->l3cache == data->l3_cache ) res += 1;
if (entry->brand_code == brand_code ) res += 2;
if (entry->model_code == model_code ) res += 2;
return res;
}