mirror of
https://github.com/vladmandic/automatic
synced 2026-09-09 06:18:43 +02:00
d711880aa9
1. Performance Counter.
Get vram size allocated to & used by python.exe from pdh.dll.
Generation can be slower than atiadlxx.
Use memory less greedy then atiadlxx.
Windows only.
2. atiadlxx.
Get max vram size and available vram size from AMD GPU driver (atiadlxx.dll).
Use memory more greedy than Performance Counter.
Windows & WSL are supported.
3. None.
Assume available vram size is 8GB.
Use memory regardless of current vram usage.
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
from ctypes import *
|
|
from ctypes.wintypes import *
|
|
from typing import Callable
|
|
|
|
from .structures import *
|
|
from .defines import *
|
|
|
|
pdh = CDLL("pdh.dll")
|
|
|
|
PdhExpandWildCardPathW: Callable = pdh.PdhExpandWildCardPathW
|
|
PdhExpandWildCardPathW.restype = PDH_FUNCTION
|
|
PdhExpandWildCardPathW.argtypes = [LPCWSTR, LPCWSTR, PZZWSTR, LPDWORD, DWORD]
|
|
|
|
PdhOpenQueryW: Callable = pdh.PdhOpenQueryW
|
|
PdhOpenQueryW.restype = PDH_FUNCTION
|
|
PdhOpenQueryW.argtypes = [LPCWSTR, DWORD_PTR, POINTER(PDH_HQUERY)]
|
|
|
|
PdhAddEnglishCounterW: Callable = pdh.PdhAddEnglishCounterW
|
|
PdhAddEnglishCounterW.restype = PDH_FUNCTION
|
|
PdhAddEnglishCounterW.argtypes = [PDH_HQUERY, LPCWSTR, DWORD_PTR, POINTER(PDH_HCOUNTER)]
|
|
|
|
PdhCollectQueryData: Callable = pdh.PdhCollectQueryData
|
|
PdhCollectQueryData.restype = PDH_FUNCTION
|
|
PdhCollectQueryData.argtypes = [PDH_HQUERY]
|
|
|
|
PdhGetFormattedCounterValue: Callable = pdh.PdhGetFormattedCounterValue
|
|
PdhGetFormattedCounterValue.restype = PDH_FUNCTION
|
|
PdhGetFormattedCounterValue.argtypes = [PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE]
|
|
|
|
PdhGetFormattedCounterArrayW: Callable = pdh.PdhGetFormattedCounterArrayW
|
|
PdhGetFormattedCounterArrayW.restype = PDH_FUNCTION
|
|
PdhGetFormattedCounterArrayW.argtypes = [PDH_HCOUNTER, DWORD, LPDWORD, LPDWORD, PPDH_FMT_COUNTERVALUE_ITEM_W]
|
|
|
|
PdhCloseQuery: Callable = pdh.PdhCloseQuery
|
|
PdhCloseQuery.restype = PDH_FUNCTION
|
|
PdhCloseQuery.argtypes = [PDH_HQUERY]
|