mathoudebine / mathoudebine/turing-smart-screen-python

Temperature on MacOS for Intell CPU

Open
#642 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rich Text Format
Stars
2.3k
Forks
412
Avg merge
21h 10m
Merged PRs (30d)
7

Description

Is your feature request related to a problem? If so, please describe the problem.
At the moment, the temperature for Intel processors is not available on MacOS.

Describe the feature / solution to your problem you'd like
Are there any plans to release it?

Describe alternatives you've considered / and or tested
For example, with the help of IntelPowerGadget?

if sys.platform == 'darwin':
    bundle = objc.loadBundle(
        "IntelPowerGadget",
        bundle_path="/Library/Frameworks/IntelPowerGadget.framework",
        module_globals=globals(),
    )
    functions = [
        ('PG_Initialize', objc._C_BOOL),
        ('PG_ReadSample', objc._C_BOOL + objc._C_INT + objc._C_OUT + objc._C_PTR + objc._C_ULNG_LNG),
        ('PGSample_GetPackageTemperature', objc._C_BOOL + objc._C_ULNG_LNG + objc._C_OUT + objc._C_PTR + objc._C_DBL),
    ]
    objc.loadBundleFunctions(bundle, globals(), functions)
    if not PG_Initialize():
        print("Failed to initialize Intel Power Gadget")
        sys.exit(1)
        if sys.platform == 'darwin':
            iPackage = 0
            result, sample_id = PG_ReadSample(iPackage, None)
            if result:
                # print("Sample read successfully")

                # Use PGSample_GetPackageTemperature
                temp_result, cpu_temp = PGSample_GetPackageTemperature(sample_id, None)
                if temp_result:
                    pass
                    # print(f"Package Temperature: {cpu_temp}°C")
                    # cpu_temp = -100.0
                else:
                    # print("Failed to get package temperature")
                    cpu_temp = -100.0
            else:
                # print("Failed to read sample")
                pass

Environment:

  • OS with version: Ventura 13.7.2 (Hackintosh)
  • Python version: Python 3.11.9
  • Hardware Intel CPU i7-14700KF

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files or tests; begin by locating the existing temperature collection path and reviewing the IntelPowerGadget APIs shown in the report. Confirm how macOS Intel hardware is detected and define done as reporting Intel CPU temperature on supported macOS systems, with appropriate failure handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.