From: Torge Matthies tmatthies@codeweavers.com
Signed-off-by: Torge Matthies tmatthies@codeweavers.com --- dlls/ntdll/unix/system.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 04755fac5ea..b78f9b3f9a7 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -231,6 +231,7 @@ struct smbios_chassis_args SYSTEM_CPU_INFORMATION cpu_info = { 0 }; static SYSTEM_PROCESSOR_FEATURES_INFORMATION cpu_features; static char cpu_name[49]; +static ULONG performance_cores[1024]; static SYSTEM_LOGICAL_PROCESSOR_INFORMATION *logical_proc_info; static unsigned int logical_proc_info_len, logical_proc_info_alloc_len; static SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *logical_proc_info_ex; @@ -643,7 +644,10 @@ static BOOL logical_proc_info_ex_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel, dataex->u.Processor.Flags = count_bits( mask ) > 1 ? LTP_PC_SMT : 0; else dataex->u.Processor.Flags = 0; - dataex->u.Processor.EfficiencyClass = 0; + if (rel == RelationProcessorCore && id < ARRAY_SIZE(performance_cores) * 32) + dataex->u.Processor.EfficiencyClass = (performance_cores[id / 32] >> (id & 31)) & 1; + else + dataex->u.Processor.EfficiencyClass = 0; dataex->u.Processor.GroupCount = 1; dataex->u.Processor.GroupMask[0].Mask = mask; dataex->u.Processor.GroupMask[0].Group = 0; @@ -846,6 +850,28 @@ static BOOL sysfs_count_list_elements(const char *filename, unsigned int *result return TRUE; }
+static void fill_performance_core_info(void) +{ + FILE *fpcore_list; + unsigned int beg, end, i; + char op = ','; + + if (access("/sys/devices/cpu_atom/cpus", R_OK)) return; + + fpcore_list = fopen("/sys/devices/cpu_core/cpus", "r"); + if (!fpcore_list) return; + + while (!feof(fpcore_list) && op == ',') + { + if (!fscanf(fpcore_list, "%u %c ", &beg, &op)) break; + if (op == '-') fscanf(fpcore_list, "%u %c ", &end, &op); + else end = beg; + + for(i = beg; i <= end; i++) + performance_cores[i >> 5] |= 1 << (i & 31); + } +} + /* for 'data', max_len is the array count. for 'dataex', max_len is in bytes */ static NTSTATUS create_logical_proc_info(void) { @@ -872,6 +898,8 @@ static NTSTATUS create_logical_proc_info(void) max_cpus, MAXIMUM_PROCESSORS); }
+ fill_performance_core_info(); + fcpu_list = fopen("/sys/devices/system/cpu/online", "r"); if (!fcpu_list) return STATUS_NOT_IMPLEMENTED;