Files
automatic/modules/dml/pdh/structures.py
T
Seunghoon Lee d711880aa9 New option for DirectML: memory stats provider.
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.
2023-08-01 01:58:04 +09:00

42 lines
971 B
Python

from ctypes import *
from ctypes.wintypes import *
PDH_HQUERY = HANDLE
PDH_HCOUNTER = HANDLE
class PDH_FMT_COUNTERVALUE_U(Union):
_fields_ = [
("longValue", LONG),
("doubleValue", c_double),
("largeValue", c_longlong),
("AnsiStringValue", LPCSTR),
("WideStringValue", LPCWSTR),
]
longValue: int
doubleValue: float
largeValue: int
AnsiStringValue: LPCSTR
WideStringValue: LPCWSTR
class PDH_FMT_COUNTERVALUE(Structure):
_anonymous_ = ("u",)
_fields_ = [
("CStatus", DWORD),
("u", PDH_FMT_COUNTERVALUE_U),
]
CStatus: DWORD
u: PDH_FMT_COUNTERVALUE_U
PPDH_FMT_COUNTERVALUE = POINTER(PDH_FMT_COUNTERVALUE)
class PDH_FMT_COUNTERVALUE_ITEM_W(Structure):
_fields_ = [
("szName", LPWSTR),
("FmtValue", PDH_FMT_COUNTERVALUE),
]
szName: str
FmtValue: PDH_FMT_COUNTERVALUE
PPDH_FMT_COUNTERVALUE_ITEM_W = POINTER(PDH_FMT_COUNTERVALUE_ITEM_W)