| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "icpuinfo.h" |
| 7 | #include <string> |
| 8 | #include <unordered_map> |
| 9 | #include <unordered_set> |
| 10 | #include <vector> |
| 11 | |
| 12 | class CPUInfo final : public ICPUInfo |
| 13 | { |
| 14 | public: |
| 15 | CPUInfo(int physicalId, |
| 16 | std::vector<ICPUInfo::ExecutionUnit> &&executionUnits) noexcept; |
| 17 | |
| 18 | int physicalId() const override; |
| 19 | std::vector<ICPUInfo::ExecutionUnit> const &executionUnits() const override; |
| 20 | std::vector<std::string> keys() const override; |
| 21 | std::string info(std::string_view key) const override; |
| 22 | bool hasCapability(std::string_view name) const override; |
| 23 | void initialize( |
| 24 | std::vector<std::unique_ptr<ICPUInfo::IProvider>> const &providers) override; |
| 25 | |
| 26 | void addExecutionUnit(ICPUInfo::ExecutionUnit &&unit); |
| 27 | |
| 28 | private: |
| 29 | int const physicalId_; |
| 30 | std::vector<ICPUInfo::ExecutionUnit> executionUnits_; |
| 31 | std::unordered_map<std::string, std::string> info_; |
| 32 | std::unordered_set<std::string> capabilities_; |
| 33 | }; |