diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:04 +0000 |
commit | a836a244a3d2bdd4da1ee2641e3e957850668cea (patch) | |
tree | cb87c75b3677fab7144f868435243f864048a1e6 /ml/Host.h | |
parent | Adding upstream version 1.38.1. (diff) | |
download | netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.tar.xz netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.zip |
Adding upstream version 1.39.0.upstream/1.39.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | ml/Host.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/ml/Host.h b/ml/Host.h deleted file mode 100644 index 289cb5ab7..000000000 --- a/ml/Host.h +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef ML_HOST_H -#define ML_HOST_H - -#include "Mutex.h" -#include "Config.h" -#include "Dimension.h" -#include "Chart.h" -#include "Queue.h" - -#include "ml-private.h" -#include "json/single_include/nlohmann/json.hpp" - -namespace ml -{ - -class Host { - -friend void* train_main(void *); -friend void *detect_main(void *); - -public: - Host(RRDHOST *RH) : - RH(RH), - MLS(), - TS(), - HostAnomalyRate(0.0), - ThreadsRunning(false), - ThreadsCancelled(false), - ThreadsJoined(false) - {} - - void addChart(Chart *C); - void removeChart(Chart *C); - - void getConfigAsJson(nlohmann::json &Json) const; - void getModelsAsJson(nlohmann::json &Json); - void getDetectionInfoAsJson(nlohmann::json &Json) const; - - void startAnomalyDetectionThreads(); - void stopAnomalyDetectionThreads(bool join); - - void scheduleForTraining(TrainingRequest TR); - void train(); - - void detect(); - void detectOnce(); - -private: - RRDHOST *RH; - MachineLearningStats MLS; - TrainingStats TS; - CalculatedNumber HostAnomalyRate{0.0}; - std::atomic<bool> ThreadsRunning; - std::atomic<bool> ThreadsCancelled; - std::atomic<bool> ThreadsJoined; - - Queue<TrainingRequest> TrainingQueue; - - Mutex M; - std::unordered_map<RRDSET *, Chart *> Charts; - - netdata_thread_t TrainingThread; - netdata_thread_t DetectionThread; -}; - -} // namespace ml - -#endif /* ML_HOST_H */ |