// Software Name : cppuprofile // SPDX-FileCopyrightText: Copyright (c) 2022 Orange // SPDX-License-Identifier: BSD-3-Clause // // This software is distributed under the BSD License; // see the LICENSE file for more details. // // Author: Cédric CHEDALEUX et al. #ifndef CPUMONITOR_H_ #define CPUMONITOR_H_ #include #include using namespace std; namespace uprofile { class CpuMonitor { public: explicit CpuMonitor(); virtual ~CpuMonitor(); vector getUsage(); private: static size_t getNumberOfCPUCores(); static void extractCpuTimes(const string& cpuInfo, size_t& idleTime, size_t& totalTime); // Store the last idle and total time for each CPU vector m_lastIdleTimes; vector m_lastTotalTimes; size_t m_nbCpus; }; } #endif /* CPUMONITOR_H_ */