Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Use amdgpu_top to get AMDGPU stats #981

Closed
Umio-Yasuno opened this issue Apr 5, 2023 · 2 comments
Closed

[Feature] Use amdgpu_top to get AMDGPU stats #981

Umio-Yasuno opened this issue Apr 5, 2023 · 2 comments

Comments

@Umio-Yasuno
Copy link

Hello, I am now developing amdgpu_top which displays AMDGPU usage and sensors.
The tool collects AMDGPU utilization from performance counters (GRBM, GRBM2, CP_STAT) and fdinfo.
I recently added output JSON features to that tool, such as intel_gpu_top.

How about using amdgpu_top to get AMDGPU stats as well as intel_gpu_top in MangoHub?

working branch: https://github.com/Umio-Yasuno/amdgpu_top/tree/json-output

/// command:
/// -i: select gpu instance, default is 0 (/dev/dri/render128)
/// -J: output JSON
/// -s, --ms: refresh period in milliseconds
/// -p: PID

<amdgpu_top> -i 0 -J -s 500 -p <pid>

Related issue

Example:
[
{
	"Device Name": "AMD Radeon RX 560 Series",
	"CU Count": 16,
	"ResizableBAR": true,
	"period": {
		"duration": 508,
		"unit": "ms"
	},
	"GRBM": {
		"Graphics Pipe": {
			"val": 6,
			"unit": "%"
		},
		"Texture Pipe": {
			"val": 6,
			"unit": "%"
		},
		"Shader Export": {
			"val": 6,
			"unit": "%"
		},
		"Shader Processor Interpolator": {
			"val": 6,
			"unit": "%"
		},
		"Primitive Assembly": {
			"val": 0,
			"unit": "%"
		},
		"Depth Block": {
			"val": 6,
			"unit": "%"
		},
		"Color Block": {
			"val": 6,
			"unit": "%"
		},
		"Vertext Grouper / Tessellator": {
			"val": 0,
			"unit": "%"
		},
		"Input Assembly": {
			"val": 0,
			"unit": "%"
		},
		"Work Distributor": {
			"val": 0,
			"unit": "%"
		}
	},
	"GRBM2": {
		"Texture Cache": {
			"val": 7,
			"unit": "%"
		},
		"Command Processor -  Fetcher": {
			"val": 7,
			"unit": "%"
		},
		"Command Processor -  Compute": {
			"val": 0,
			"unit": "%"
		},
		"Command Processor - Graphics": {
			"val": 7,
			"unit": "%"
		}
	},
	"CP_STAT": {
		"Prefetch Parser": {
			"val": 4,
			"unit": "%"
		},
		"Micro Engine": {
			"val": 7,
			"unit": "%"
		},
		"DMA": {
			"val": 1,
			"unit": "%"
		},
		"Scratch Memory": {
			"val": 0,
			"unit": "%"
		}
	},
	"VRAM": {
		"Total VRAM": {
			"val": 4096,
			"unit": "MiB"
		},
		"Total VRAM Usage": {
			"val": 886,
			"unit": "MiB"
		},
		"Total GTT": {
			"val": 7939,
			"unit": "MiB"
		},
		"Total GTT Usage": {
			"val": 83,
			"unit": "MiB"
		}
	},
	"glxgears fdinfo": {
		"VRAM Usage": {
			"val": 11,
			"unit": "MiB"
		},
		"GTT Usage": {
			"val": 8,
			"unit": "MiB"
		},
		"GFX": {
			"val": 0,
			"unit": "%"
		},
		"Compute": {
			"val": 0,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"DEC": {
			"val": 0,
			"unit": "%"
		},
		"ENC": {
			"val": 0,
			"unit": "%"
		}
	},
	"Sensors": {
		"PCIe Link Speed": {
			"gen": 3,
			"width": 8
		},
		"GFX_SCLK": {
			"val": 955,
			"unit": "MHz"
		},
		"GFX_MCLK": {
			"val": 1750,
			"unit": "MHz"
		},
		"GPU_TEMP": {
			"val": 37,
			"unit": "C"
		},
		"GPU_LOAD": {
			"val": 0,
			"unit": "%"
		},
		"GPU_AVG_POWER": {
			"val": 13,
			"unit": "W"
		},
		"VDDGFX": {
			"val": 856,
			"unit": "mV"
		},
		"FAN1": {
			"val": 1228,
			"unit": "RPM"
		}
	}
},
{
	"Device Name": "AMD Radeon RX 560 Series",
	"CU Count": 16,
	"ResizableBAR": true,
	"period": {
		"duration": 1017,
		"unit": "ms"
	},
	"GRBM": {
		"Graphics Pipe": {
			"val": 5,
			"unit": "%"
		},
		"Texture Pipe": {
			"val": 2,
			"unit": "%"
		},
		"Shader Export": {
			"val": 2,
			"unit": "%"
		},
		"Shader Processor Interpolator": {
			"val": 2,
			"unit": "%"
		},
		"Primitive Assembly": {
			"val": 0,
			"unit": "%"
		},
		"Depth Block": {
			"val": 2,
			"unit": "%"
		},
		"Color Block": {
			"val": 2,
			"unit": "%"
		},
		"Vertext Grouper / Tessellator": {
			"val": 0,
			"unit": "%"
		},
		"Input Assembly": {
			"val": 0,
			"unit": "%"
		},
		"Work Distributor": {
			"val": 0,
			"unit": "%"
		}
	},
	"GRBM2": {
		"Texture Cache": {
			"val": 3,
			"unit": "%"
		},
		"Command Processor -  Fetcher": {
			"val": 3,
			"unit": "%"
		},
		"Command Processor -  Compute": {
			"val": 0,
			"unit": "%"
		},
		"Command Processor - Graphics": {
			"val": 3,
			"unit": "%"
		}
	},
	"CP_STAT": {
		"Prefetch Parser": {
			"val": 2,
			"unit": "%"
		},
		"Micro Engine": {
			"val": 3,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"Scratch Memory": {
			"val": 0,
			"unit": "%"
		}
	},
	"VRAM": {
		"Total VRAM": {
			"val": 4096,
			"unit": "MiB"
		},
		"Total VRAM Usage": {
			"val": 886,
			"unit": "MiB"
		},
		"Total GTT": {
			"val": 7939,
			"unit": "MiB"
		},
		"Total GTT Usage": {
			"val": 83,
			"unit": "MiB"
		}
	},
	"glxgears fdinfo": {
		"VRAM Usage": {
			"val": 11,
			"unit": "MiB"
		},
		"GTT Usage": {
			"val": 8,
			"unit": "MiB"
		},
		"GFX": {
			"val": 0,
			"unit": "%"
		},
		"Compute": {
			"val": 0,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"DEC": {
			"val": 0,
			"unit": "%"
		},
		"ENC": {
			"val": 0,
			"unit": "%"
		}
	},
	"Sensors": {
		"PCIe Link Speed": {
			"gen": 3,
			"width": 8
		},
		"GFX_SCLK": {
			"val": 1017,
			"unit": "MHz"
		},
		"GFX_MCLK": {
			"val": 1750,
			"unit": "MHz"
		},
		"GPU_TEMP": {
			"val": 37,
			"unit": "C"
		},
		"GPU_LOAD": {
			"val": 0,
			"unit": "%"
		},
		"GPU_AVG_POWER": {
			"val": 13,
			"unit": "W"
		},
		"VDDGFX": {
			"val": 856,
			"unit": "mV"
		},
		"FAN1": {
			"val": 1233,
			"unit": "RPM"
		}
	}
},
{
	"Device Name": "AMD Radeon RX 560 Series",
	"CU Count": 16,
	"ResizableBAR": true,
	"period": {
		"duration": 1526,
		"unit": "ms"
	},
	"GRBM": {
		"Graphics Pipe": {
			"val": 4,
			"unit": "%"
		},
		"Texture Pipe": {
			"val": 4,
			"unit": "%"
		},
		"Shader Export": {
			"val": 4,
			"unit": "%"
		},
		"Shader Processor Interpolator": {
			"val": 4,
			"unit": "%"
		},
		"Primitive Assembly": {
			"val": 0,
			"unit": "%"
		},
		"Depth Block": {
			"val": 4,
			"unit": "%"
		},
		"Color Block": {
			"val": 4,
			"unit": "%"
		},
		"Vertext Grouper / Tessellator": {
			"val": 0,
			"unit": "%"
		},
		"Input Assembly": {
			"val": 0,
			"unit": "%"
		},
		"Work Distributor": {
			"val": 0,
			"unit": "%"
		}
	},
	"GRBM2": {
		"Texture Cache": {
			"val": 4,
			"unit": "%"
		},
		"Command Processor -  Fetcher": {
			"val": 4,
			"unit": "%"
		},
		"Command Processor -  Compute": {
			"val": 0,
			"unit": "%"
		},
		"Command Processor - Graphics": {
			"val": 4,
			"unit": "%"
		}
	},
	"CP_STAT": {
		"Prefetch Parser": {
			"val": 1,
			"unit": "%"
		},
		"Micro Engine": {
			"val": 4,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"Scratch Memory": {
			"val": 0,
			"unit": "%"
		}
	},
	"VRAM": {
		"Total VRAM": {
			"val": 4096,
			"unit": "MiB"
		},
		"Total VRAM Usage": {
			"val": 886,
			"unit": "MiB"
		},
		"Total GTT": {
			"val": 7939,
			"unit": "MiB"
		},
		"Total GTT Usage": {
			"val": 83,
			"unit": "MiB"
		}
	},
	"glxgears fdinfo": {
		"VRAM Usage": {
			"val": 11,
			"unit": "MiB"
		},
		"GTT Usage": {
			"val": 8,
			"unit": "MiB"
		},
		"GFX": {
			"val": 0,
			"unit": "%"
		},
		"Compute": {
			"val": 0,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"DEC": {
			"val": 0,
			"unit": "%"
		},
		"ENC": {
			"val": 0,
			"unit": "%"
		}
	},
	"Sensors": {
		"PCIe Link Speed": {
			"gen": 3,
			"width": 8
		},
		"GFX_SCLK": {
			"val": 912,
			"unit": "MHz"
		},
		"GFX_MCLK": {
			"val": 1750,
			"unit": "MHz"
		},
		"GPU_TEMP": {
			"val": 37,
			"unit": "C"
		},
		"GPU_LOAD": {
			"val": 0,
			"unit": "%"
		},
		"GPU_AVG_POWER": {
			"val": 12,
			"unit": "W"
		},
		"VDDGFX": {
			"val": 850,
			"unit": "mV"
		},
		"FAN1": {
			"val": 1234,
			"unit": "RPM"
		}
	}
},
{
	"Device Name": "AMD Radeon RX 560 Series",
	"CU Count": 16,
	"ResizableBAR": true,
	"period": {
		"duration": 2035,
		"unit": "ms"
	},
	"GRBM": {
		"Graphics Pipe": {
			"val": 5,
			"unit": "%"
		},
		"Texture Pipe": {
			"val": 3,
			"unit": "%"
		},
		"Shader Export": {
			"val": 3,
			"unit": "%"
		},
		"Shader Processor Interpolator": {
			"val": 4,
			"unit": "%"
		},
		"Primitive Assembly": {
			"val": 1,
			"unit": "%"
		},
		"Depth Block": {
			"val": 4,
			"unit": "%"
		},
		"Color Block": {
			"val": 3,
			"unit": "%"
		},
		"Vertext Grouper / Tessellator": {
			"val": 1,
			"unit": "%"
		},
		"Input Assembly": {
			"val": 1,
			"unit": "%"
		},
		"Work Distributor": {
			"val": 1,
			"unit": "%"
		}
	},
	"GRBM2": {
		"Texture Cache": {
			"val": 4,
			"unit": "%"
		},
		"Command Processor -  Fetcher": {
			"val": 6,
			"unit": "%"
		},
		"Command Processor -  Compute": {
			"val": 0,
			"unit": "%"
		},
		"Command Processor - Graphics": {
			"val": 5,
			"unit": "%"
		}
	},
	"CP_STAT": {
		"Prefetch Parser": {
			"val": 4,
			"unit": "%"
		},
		"Micro Engine": {
			"val": 4,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"Scratch Memory": {
			"val": 0,
			"unit": "%"
		}
	},
	"VRAM": {
		"Total VRAM": {
			"val": 4096,
			"unit": "MiB"
		},
		"Total VRAM Usage": {
			"val": 886,
			"unit": "MiB"
		},
		"Total GTT": {
			"val": 7939,
			"unit": "MiB"
		},
		"Total GTT Usage": {
			"val": 83,
			"unit": "MiB"
		}
	},
	"glxgears fdinfo": {
		"VRAM Usage": {
			"val": 11,
			"unit": "MiB"
		},
		"GTT Usage": {
			"val": 8,
			"unit": "MiB"
		},
		"GFX": {
			"val": 0,
			"unit": "%"
		},
		"Compute": {
			"val": 0,
			"unit": "%"
		},
		"DMA": {
			"val": 0,
			"unit": "%"
		},
		"DEC": {
			"val": 0,
			"unit": "%"
		},
		"ENC": {
			"val": 0,
			"unit": "%"
		}
	},
	"Sensors": {
		"PCIe Link Speed": {
			"gen": 3,
			"width": 8
		},
		"GFX_SCLK": {
			"val": 1116,
			"unit": "MHz"
		},
		"GFX_MCLK": {
			"val": 1750,
			"unit": "MHz"
		},
		"GPU_TEMP": {
			"val": 37,
			"unit": "C"
		},
		"GPU_LOAD": {
			"val": 0,
			"unit": "%"
		},
		"GPU_AVG_POWER": {
			"val": 14,
			"unit": "W"
		},
		"VDDGFX": {
			"val": 950,
			"unit": "mV"
		},
		"FAN1": {
			"val": 1233,
			"unit": "RPM"
		}
	}
}
]
@Umio-Yasuno Umio-Yasuno changed the title [Feature] Use amdgpu_top to get AMDGPU utilization [Feature] Use amdgpu_top to get AMDGPU stats Apr 5, 2023
@flightlessmango
Copy link
Owner

The reason we've resorted to using intel_gpu_top is because there is no other way at this point.
amdgpu on the other hand is possible, so it should be done directly in mangohud

@Umio-Yasuno
Copy link
Author

Ok, thanks for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants