Initial setup for CLion

This commit is contained in:
2026-03-28 16:54:11 +11:00
parent 239cc02591
commit 7b4134133c
1136 changed files with 811916 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2019-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <deque>
#include <memory>
#include <vector>
class CpuMonitor {
public:
CpuMonitor();
~CpuMonitor();
void setHistorySize(std::size_t size);
std::size_t getHistorySize() const;
void collectData();
std::deque<std::vector<double>> getLastHistory() const;
std::vector<double> getMeanCpuLoad() const;
private:
unsigned samplesNumber;
unsigned historySize;
std::vector<double> cpuLoadSum;
std::deque<std::vector<double>> cpuLoadHistory;
class PerformanceCounter;
std::unique_ptr<PerformanceCounter> performanceCounter;
};

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2019-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <deque>
#include <memory>
class MemoryMonitor {
public:
MemoryMonitor();
~MemoryMonitor();
void setHistorySize(std::size_t size);
std::size_t getHistorySize() const;
void collectData();
std::deque<std::pair<double, double>> getLastHistory() const;
double getMeanMem() const; // in GiB
double getMeanSwap() const;
double getMaxMem() const;
double getMaxSwap() const;
double getMemTotal() const;
double getMaxMemTotal() const; // a system may have hotpluggable memory
private:
unsigned samplesNumber;
std::size_t historySize;
double memSum, swapSum;
double maxMem, maxSwap;
double memTotal;
double maxMemTotal;
std::deque<std::pair<double, double>> memSwapUsageHistory;
class PerformanceCounter;
std::unique_ptr<PerformanceCounter> performanceCounter;
};

View File

@@ -0,0 +1,44 @@
// Copyright (C) 2019-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <chrono>
#include <map>
#include <ostream>
#include <set>
#include <opencv2/imgproc.hpp>
#include "cpu_monitor.h"
#include "memory_monitor.h"
enum class MonitorType{CpuAverage, DistributionCpu, Memory};
class Presenter {
public:
explicit Presenter(std::set<MonitorType> enabledMonitors = {},
int yPos = 20,
cv::Size graphSize = {150, 60},
std::size_t historySize = 20);
explicit Presenter(const std::string& keys,
int yPos = 20,
cv::Size graphSize = {150, 60},
std::size_t historySize = 20);
void addRemoveMonitor(MonitorType monitor);
void handleKey(int key); // handles C, D, M, H keys
void drawGraphs(cv::Mat& frame);
std::vector<std::string> reportMeans() const;
const int yPos;
const cv::Size graphSize;
const int graphPadding;
private:
std::chrono::steady_clock::time_point prevTimeStamp;
std::size_t historySize;
CpuMonitor cpuMonitor;
bool distributionCpuEnabled;
MemoryMonitor memoryMonitor;
std::ostringstream strStream;
};