Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linux] associate threads with cores #2149

Open
nschloe opened this issue Sep 28, 2022 · 1 comment
Open

[linux] associate threads with cores #2149

nschloe opened this issue Sep 28, 2022 · 1 comment

Comments

@nschloe
Copy link

nschloe commented Sep 28, 2022

Summary

  • OS: Linux
  • Type: core

Description

With

psutil.cpu_percent(percpu=True)

I get eight percentages on machine, one for each thread. (My machine has four cores with two threads each.)

I would like to know which thread belongs to which core to be able to associate temperatures (psutil.sensors_temperatures()["coretemp"]) accordingly.

This becomes increasingly interesting with the advent of machines where only a number of cores have multiple threads, and others don't (efficiency cores).

On Linux (Unix?), this information is given in /proc/cpuinfo as core id:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
stepping	: 10
microcode	: 0xf0
cpu MHz		: 3100.396
cache size	: 6144 KB
physical id	: 0
siblings	: 8
core id		: 0
cpu cores	: 4
apicid		: 0
initial apicid	: 0
[...]

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
stepping	: 10
microcode	: 0xf0
cpu MHz		: 3099.999
cache size	: 6144 KB
physical id	: 0
siblings	: 8
core id		: 1
cpu cores	: 4
apicid		: 2
initial apicid	: 2

[...]
@dbwiddis
Copy link
Contributor

Probably relates to #2034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants