Program Listing for File system-info.h

Return to documentation for file (include\system\system-info.h)

/******************************************************************************
© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.


 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once
#include <cstdint>
#include <cstdlib>
#include <string>

namespace gpa {
namespace system {

struct OSInfo
{
    enum class OSType {
        Windows,
        Linux,
        macOS,
        Android
    };
    struct Windows
    {
        bool developerModeEnabled = false;
        bool secureBootEnabled = false;
    };
    OSType type;
    std::string name;
    uint64_t major = 0;
    uint64_t minor = 0;
    std::string buildNumber;
    std::string computerName;
    std::string locale;
    Windows windows;
};

struct GPUInfo
{
    std::string name;
    std::string provider;
    std::string sku;  //StockKeeping Unit
    std::string driverVersion;
    std::string driverDate;
    std::string featureLevelsAsJson;

    enum API {
        kMetal,
        kDirectX,
        kVulkan,
        kOther,
    };

    API api = kOther;
    uint32_t vendorId = 0;
    uint32_t productId = 0;
    uint32_t stepping = 0;  //Revision number
    uint32_t apiVersionMajor = 0;
    uint32_t apiVersionMinor = 0;
    uint32_t apiVersionPatch = 0;
    bool isEnabled{};
};

struct ScreenInfo
{
    uint32_t width = 0;
    uint32_t height = 0;
    uint32_t colorDepth = 0;  //color depth in bits
};

struct CPUInfo
{
    enum class ArchitectureType {
        x86,
        x64,
        Unknown,
    };
    uint64_t coresCount = 0;
    ArchitectureType architecture = ArchitectureType::Unknown;
};

struct MemoryInfo
{
    uint64_t dramMemory = 0;
};

struct BIOSInfo
{
    std::string version;
    std::string date;
};

std::string GetGPUVendor(std::string const& vendor);
std::string GetGPUSku(std::string const& sku);
void GetGPUInformation(GPUInfo* gpuInfoArray, unsigned long* deviceCount);
void GetOSInfo(OSInfo* const osInfo);
const CPUInfo& GetCPUInfo();
void GetMemoryInfo(MemoryInfo* const memoryInfo);
void GetBIOSInfo(BIOSInfo* const biosInfo);
void GetScreenInfo(ScreenInfo* const screenInfo);

// retrieve PCI device/vendor information, given PCI IDs
void GetDeviceInfoFromID(uint16_t vendorId, char const** vendorName, uint16_t deviceId = 0, char const** deviceName = nullptr);

}  // namespace system
}  // namespace gpa