Reads the same PDH counters as Task Manager (\GPU Engine(*)\Utilization Percentage, locale-independent via PdhAddEnglishCounterW), which cover graphics work under WDDM — games are caught without an exe list and the offender is named. Windows-only; a missing or failing counter disables the path with one log line. dwm (the desktop compositor) joins the default ignore list.
17 lines
546 B
Go
17 lines
546 B
Go
//go:build !windows
|
|
|
|
package game
|
|
|
|
import "errors"
|
|
|
|
// errNoEngineCounters marks platforms without per-process GPU engine
|
|
// counters (the PDH path is Windows-only).
|
|
var errNoEngineCounters = errors.New("per-process GPU engine counters are only available on Windows")
|
|
|
|
// gpuEngineSampler is a stub on non-Windows platforms.
|
|
type gpuEngineSampler struct{}
|
|
|
|
func openGPUEngineSampler() (*gpuEngineSampler, error) { return nil, errNoEngineCounters }
|
|
|
|
func (s *gpuEngineSampler) sample() (map[int]float64, error) { return nil, errNoEngineCounters }
|