// SPDX-License-Identifier: GPL-3.0-or-later // Copyright 2019 Juan Palacios #pragma once #include "../icpuinfo.h" #include "core/idatasource.h" #include #include #include #include #include class CPUInfoLsCpu final : public ICPUInfo::IProvider { public: struct Keys { static constexpr std::string_view arch{"arch"}; static constexpr std::string_view opMode{"opmode"}; static constexpr std::string_view byteOrder{"byteorder"}; static constexpr std::string_view virt{"virt"}; static constexpr std::string_view l1dCache{"l1dcache"}; static constexpr std::string_view l1iCache{"l1icache"}; static constexpr std::string_view l2Cache{"l2cache"}; }; CPUInfoLsCpu(std::unique_ptr>> &&dataSource) noexcept; std::vector> provideInfo( int physicalId, std::vector const &executionUnits) override; std::vector provideCapabilities( int physicalId, std::vector const &executionUnits) override; private: std::string extractLineData(std::string const &line) const; void addInfo(std::string_view target, std::string_view key, std::vector> &info, std::vector const &data) const; std::unique_ptr>> const dataSource_; static bool registered_; };