nwinfo icon indicating copy to clipboard operation
nwinfo copied to clipboard

Get GPU usage

Open a1ive opened this issue 1 year ago • 2 comments

https://stackoverflow.com/questions/77643749/getting-gpu-usage-statistics-with-pdh https://stackoverflow.com/questions/56830434/c-sharp-get-total-usage-of-gpu-in-percentage https://gist.github.com/fecf/2103a82afc76b5c88829c4383944a5aa https://stackoverflow.com/questions/29611611/c-windows-gpu-usage-load

a1ive avatar Jun 08 '24 13:06 a1ive

https://stackoverflow.com/questions/13017148/how-do-i-get-gpu-usage-per-process

a1ive avatar Jun 09 '24 12:06 a1ive

https://github.com/winsiderss/systeminformer/blob/master/plugins/ExtendedTools/gpumon.c

a1ive avatar Jun 22 '24 06:06 a1ive

https://stackoverflow.com/questions/34363404/how-do-i-query-direct3d9-for-the-total-amount-of-video-memory

a1ive avatar Aug 07 '24 13:08 a1ive

#pragma comment(lib, "dxgi.lib")
#include <dxgi.h>
HMODULE hModule = LoadLibraryW(L"dxgi.dll");
typedef HRESULT(WINAPI* FuncCreateDXGIFactory)(REFIID, void**);
FuncCreateDXGIFactory pCreateDXGIFactory = NULL;

if (hModule != NULL)
{
	pCreateDXGIFactory = (FuncCreateDXGIFactory)GetProcAddress(hModule, "CreateDXGIFactory");
}

if (pCreateDXGIFactory != NULL)
{
	IDXGIFactory* pFactory = nullptr;
	if (SUCCEEDED(pCreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&pFactory)))
	{
		IDXGIAdapter* pAdapter = nullptr;
		DXGI_ADAPTER_DESC adapterDesc;

		for (UINT i = 0; pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND; ++i)
		{
			pAdapter->GetDesc(&adapterDesc);

			printf("DESC: %ls\n", adapterDesc.Description);
			printf("RAM: %llu MB\n", adapterDesc.DedicatedVideoMemory / (1024ULL * 1024));

			pAdapter->Release();
		}
		pFactory->Release();
	}
}

a1ive avatar Aug 19 '24 11:08 a1ive