public override string GetReport()
        {
            StringBuilder r = new StringBuilder();

            r.AppendLine("Nvidia GPU");
            r.AppendLine();

            r.AppendFormat("Name: {0}{1}", name, Environment.NewLine);
            NVML.NvmlDeviceGetIndex(handle, out uint index);
            r.AppendFormat("Index: {0}{1}", index, Environment.NewLine);

            if (NVML.GetDriverVersionString(out string drvVer) == NvmlReturn.SUCCESS)
            {
                r.AppendLine("Driver Version: " + drvVer);
            }
            r.AppendLine();

            NvmlPciInfo pciInfo = new NvmlPciInfo();

            if (NVML.NvmlDeviceGetPciInfo(handle, ref pciInfo) == NvmlReturn.SUCCESS)
            {
                r.AppendLine("PCIBus: " + pciInfo.busId);
                r.Append("PCIBusId: 0x");
                r.AppendLine(pciInfo.bus.ToString("X", CultureInfo.InvariantCulture));
                r.Append("PCISubSystemID: 0x");
                r.AppendLine(pciInfo.pciSubSystemId.ToString("X", CultureInfo.InvariantCulture));
                r.Append("DeviceID: 0x");
                r.AppendLine(pciInfo.pciDeviceId.ToString("X", CultureInfo.InvariantCulture));
                r.AppendLine();
            }

            if (NVML.NvmlDeviceGetCurrPcieLinkGeneration(handle, out uint linkGen) == NvmlReturn.SUCCESS)
            {
                r.AppendLine("PCIE Generation: " + linkGen);
            }

            if (NVML.NvmlDeviceGetCurrPcieLinkWidth(handle, out uint linkWidth) == NvmlReturn.SUCCESS)
            {
                r.AppendLine("PCIE Width: x" + linkWidth);
            }
            r.AppendLine();

            if (NVML.GetDeviceUUID(handle, out string uuid) == NvmlReturn.SUCCESS)
            {
                r.AppendLine("Device UUID: " + uuid);
            }

            if (NVML.GetDeviceVbiosVersionString(handle, out string vbios) == NvmlReturn.SUCCESS)
            {
                r.AppendLine("VBIOS Version: " + vbios);
            }
            r.AppendLine();

            r.AppendLine();
            return(r.ToString());
        }
Beispiel #2
0
 public static extern NvmlReturn NvmlDeviceGetPciInfo(
     NvmlDevice device, ref NvmlPciInfo pci);