Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1468

Community Tips & Tricks • Re: Calculating E-core count

$
0
0
Hi all. I've looked for this topic and anything relating to it, and did not find anything. So I hope I am not repeating anything here.

I've been wanting a way to figure out how many P-cores and E-cores there are on the newer Intel CPUs.
So I think I have it figured out. I put together a quick skin to test the idea, and show you.
Also, I am hoping you all can review the code and if there are better ways to get this answer, I am willing to hear it.

You can get to the numbers of Cores and number of Logical processors in Windows, but not the actual P-core of E-core count. Not without using 3rd party tools. I wanted to keep this native. So I am using the wmic windows command to get that. Is there a better way?
And then I use those 2 numbers to calculate the P-cores and E-cores.
As best I can tell, I think this should work on all CPUs. If you don't have E-cores, it will just be 0.

I'll post the code here and you can look it over. Or use it if you have a need for it.
Here are 2 examples. One with E-cores and one without.

[...]

My thoughts were to highlight the E-cores differently or something in my skins.
Let me know what you think.
Hello TGonZo!
This logic does work for 99.9% of cases. The .1% where it won't work is when you have more than 64 logical cores (i.e., Threadrippers and the like), or when running a processor in NUMA mode, or when running on machines with more than 1 socket (SMP). In all these edge cases you will get half (or a quarter, whatever) of the actual number, or some other weird problem. (This actually isn't a hybrid CPU issue, it's anything with more than 64 threads or more than 1 "processor group". Windows itself cannot "see" more than 64 logical processors per process, unless specifically written to do otherwise.)

Another part of the .1% where it won't work is in virtual machines (which use single threaded vCPUs) and in cases where hyperthreading is disabled. Your logic will assume your i7, for example, has 14 P-cores and 0 E-cores, and if you were to assume hyperthreading was actually on, you'd end up with a weird 7-core hyperthreaded CPU. Not many folks would turn off hyperthreading, other than certain *cough* "entities" *cough* hyper-concerned about security and who wouldn't be allowed to run Rainmeter anyway.

It's difficult (as far I as know) to tell the difference between a P-core and an E-core if all you can see is the difference in physical/logical core count. I suspect you'd have to look at the base clock of each core to figure it out, and I have not figured out a way to do that (Windows doesn't seem to know). I assume HWiNFO and the like know this because they have a library of CPUs to draw from.

If you want to cover the full 100% of CPU architectures instead of 99.9% then your options are limited. I note that your objective is to not use third-party tools. I'm not sure if this extends to Rainmeter plugins. If plugins are acceptable, the only option I know of is my ActiveNet plugin I use in my Gadgets suite. I call the Win32 library functions (GetLogicalProcessorInformation, et al., same as SysInternals CoreInfo). This will get you all sorts of low level info; it still can't tell between P-cores and E-cores, but it CAN tell you how many threads are being used by each physical core, which will get you really really close to the info you want for any CPU architecture.

Code:

C:\> Coreinfo64 -cCoreinfo v3.6 - Dump information on system CPU and memory topologyCopyright (C) 2008-2022 Mark RussinovichSysinternals - www.sysinternals.comLogical to Physical Processor Map:**----------------------  Physical Processor 0 (Hyperthreaded)--**--------------------  Physical Processor 1 (Hyperthreaded)----**------------------  Physical Processor 2 (Hyperthreaded)------**----------------  Physical Processor 3 (Hyperthreaded)--------**--------------  Physical Processor 4 (Hyperthreaded)----------**------------  Physical Processor 5 (Hyperthreaded)------------**----------  Physical Processor 6 (Hyperthreaded)--------------**--------  Physical Processor 7 (Hyperthreaded)----------------*-------  Physical Processor 8-----------------*------  Physical Processor 9------------------*-----  Physical Processor 10-------------------*----  Physical Processor 11--------------------*---  Physical Processor 12---------------------*--  Physical Processor 13----------------------*-  Physical Processor 14-----------------------*  Physical Processor 15

Statistics: Posted by SilverAzide — Yesterday, 11:42 pm



Viewing all articles
Browse latest Browse all 1468

Trending Articles