#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2023 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_PLATFORM_HARDWARE_PLATFORMAPPRAISER_H #define NUCLEX_PLATFORM_HARDWARE_PLATFORMAPPRAISER_H #include "Nuclex/Platform/Config.h" #include // for std::shared_ptr #include // for std::string #include // for std::vector #include // for std::future #include "Nuclex/Platform/Hardware/CpuInfo.h" #include "Nuclex/Platform/Hardware/MemoryInfo.h" #include "Nuclex/Platform/Hardware/GpuInfo.h" #include "Nuclex/Platform/Hardware/StoreInfo.h" // PlatformAnalyzer // -> I wouldn't think of a hardware inventory querying system reading this name // // SystemAppraiser // -> Sounds a bit too much like something from a video game // // SystemAssessor // -> Yeah, but 'assessor' sounds like 'accessor' and it's an uncommon term :-/ // // All of the above, with typedefs! // -> Woohoo! namespace Nuclex { namespace Platform { namespace Tasks { // ------------------------------------------------------------------------------------------- // class CancellationWatcher; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Platform::Tasks namespace Nuclex { namespace Platform { namespace Hardware { void removeTrailingSlash(std::wstring& volumeName); // ------------------------------------------------------------------------------------------- // /// /// Provides hardware metrics used to optimally schedule tasks and estimate durations /// /// /// Some of the image processors are GPU-based, so the application needs to know if /// Vulkan and/or CUDA are available. CPU-based processing stages are scheduled to make /// optimal use of CPU cores (i.e. put more resources towards a slow stage rather than /// just letting all stages burn as much CPU as they want). /// class NUCLEX_PLATFORM_TYPE PlatformAppraiser { /// Analyzes the CPUs installed in the system /// /// Allows cancellation of the data collection process before it is finished /// /// /// An that will provide a description of /// the CPU topology when the detection has completed /// public: NUCLEX_PLATFORM_API static std::future> AnalyzeCpuTopology( const std::shared_ptr &canceller = ( std::shared_ptr() ) ); /// Analyzes the installed and available memory in the system /// /// An that will provide a description of /// the installed and available memory in the system /// public: NUCLEX_PLATFORM_API static std::future AnalyzeMemory( const std::shared_ptr &canceller = ( std::shared_ptr() ) ); /// Analyzes the installed and mounted storage volumes in the system /// /// An that will provide a description of /// the installed and mounted storage volumes in the system /// public: NUCLEX_PLATFORM_API static std::future< std::vector > AnalyzeStorageVolumes( const std::shared_ptr &canceller = ( std::shared_ptr() ) ); /// Runs in a thread to analyze the system's CPU topology /// Allows the information collection to be cancelled /// A description of the system's CPU topology private: static std::vector analyzeCpuTopologyAsync( std::shared_ptr canceller ); /// Runs in a thread to analyze the system's memory /// Allows the information collection to be cancelled /// A description of the system's memory private: static MemoryInfo analyzeMemoryAsync( std::shared_ptr canceller ); /// Runs in a thread to analyze th system's storage volumes /// Allows the information collection to be cancelled /// A description of the system's storage volumes private: static std::vector analyzeStorageVolumesAsync( std::shared_ptr canceller ); // -------------------------------- // old from Videl // -------------------------------- #if 0 /// Re-queries the hardware metrics public: void Refresh(); /// Provides a short string summarizing the system's installed CPUs /// A short description of the CPUs in the system /// /// This is a simple string that can be displayed in the UI. It could be something /// like "AMD Ryzen ThreadRipper" or "2x Intel Xeon E5-2680". /// public: std::string DescribeCpuModels() const { return this->cpuNames; } /// Provides a short string describing cores and frequency of the CPUs /// A short description of the power of the CPUs in the system /// /// This is a simple string that can be displayed in the UI. It could be something /// like "32x 3.8 GHz (+HT)" or "16x 3.5 GHz". /// public: std::string DescribeCpuPower() const { return this->cpuPower; } /// Returns the amount of usable system memory in bytes /// The amount of usable system memory in bytes /// /// This will be a little less than actually installed in the system, subtracting /// a reasonable amount of space for use by the operating system which would otherwise /// be forced to use the page file if the applications makes full use of all memory. /// public: std::size_t CountUsableMemoryBytes() const { return this->memoryUsableBytes; } /// Provivdes a shot string describing the amount of installed memory /// A short description of the memory installed in the system /// /// This is a simple string intended to display in the UI. It could be something /// like "64 GiB". /// public: std::string DescribeInstalledMemory() const { return this->memoryInstalled; } /// Retrieves a list of GPUs present in the system /// A list of GPUs in the system with their specifications public: const std::vector &GetGpuTopology() const { return this->gpuTopology; } /// /// Returns the highest amount of video memory installed on any of the system's GPUs /// /// The highest amount of video memory that can be used on the system public: std::size_t GetMaximumVideoMemory() const { return this->gpuMaximumVideoMemoryBytes; } /// Provides a short string summarizing the system's installed GPUs /// A short description of the GPUs in the system /// /// This is a simple string that can be displayed in the UI. It could be something /// like "NVidia RTX 3090" or "AMD Radeon RX 6900 XT". /// public: std::string DescribeGpuModels() const { return this->gpuNames; } /// Queries the operating system for installed and available memory private: void queryMemoryInformation(); /// Queries the operating system about the installed CPUs private: void queryCpuInformation(); /// Forms some human-readable strings describing the installed CPUs private: void formCpuDescriptions(); /// Queries the system for GPUs supporting Vulkan Compute private: void queryVulkanGpuInformation(); /// Forms some human-readable strings describing the installed GPUs private: void formGpuDescriptions(); /// Topology of CPUs in the system private: std::vector cpuTopology; /// Number of CPU cores in the system (without HyperThreading) private: std::size_t cpuCoreCount; /// Number of usable processors in the system private: std::size_t cpuProcessorCount; /// Short string describing the make and model of the CPU(s) private: std::string cpuNames; /// Short string describing the power of the CPU(s) private: std::string cpuPower; /// Usable amount of system memory in bytes private: std::size_t memoryUsableBytes; /// Short string describing the installed memory private: std::string memoryInstalled; /// Topology of GPUs in the system private: std::vector gpuTopology; /// Highest amount of video memory present on any of the GPUs private: std::size_t gpuMaximumVideoMemoryBytes; /// Short string describing the make and model of the GPU(s) private: std::string gpuNames; #endif }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Platform::Hardware #endif // NUCLEX_PLATFORM_HARDWARE_PLATFORMAPPRAISER_H