summaryrefslogtreecommitdiffstats
path: root/ml/ml-private.h
diff options
context:
space:
mode:
Diffstat (limited to 'ml/ml-private.h')
-rw-r--r--ml/ml-private.h36
1 files changed, 10 insertions, 26 deletions
diff --git a/ml/ml-private.h b/ml/ml-private.h
index 8535c9262d..173b82e265 100644
--- a/ml/ml-private.h
+++ b/ml/ml-private.h
@@ -33,7 +33,6 @@ typedef struct {
/*
* KMeans
*/
-
typedef struct {
size_t num_clusters;
size_t max_iterations;
@@ -124,7 +123,6 @@ enum ml_training_result {
typedef struct {
// Chart/dimension we want to train
- STRING *host_id;
STRING *chart_id;
STRING *dimension_id;
@@ -170,7 +168,6 @@ typedef struct {
/*
* Queue
*/
-
typedef struct {
std::queue<ml_training_request_t> internal;
netdata_mutex_t mutex;
@@ -178,6 +175,7 @@ typedef struct {
std::atomic<bool> exit;
} ml_queue_t;
+
typedef struct {
RRDDIM *rd;
@@ -209,13 +207,20 @@ typedef struct {
RRDHOST *rh;
ml_machine_learning_stats_t mls;
+ ml_training_stats_t ts;
calculated_number_t host_anomaly_rate;
- netdata_mutex_t mutex;
+ std::atomic<bool> threads_running;
+ std::atomic<bool> threads_cancelled;
+ std::atomic<bool> threads_joined;
ml_queue_t *training_queue;
+ netdata_mutex_t mutex;
+
+ netdata_thread_t training_thread;
+
/*
* bookkeeping for anomaly detection charts
*/
@@ -244,19 +249,6 @@ typedef struct {
RRDSET *detector_events_rs;
RRDDIM *detector_events_above_threshold_rd;
RRDDIM *detector_events_new_anomaly_event_rd;
-} ml_host_t;
-
-typedef struct {
- size_t id;
- netdata_thread_t nd_thread;
- netdata_mutex_t nd_mutex;
-
- ml_queue_t *training_queue;
- ml_training_stats_t training_stats;
-
- calculated_number_t *training_cns;
- calculated_number_t *scratch_training_cns;
- std::vector<DSample> training_samples;
RRDSET *queue_stats_rs;
RRDDIM *queue_stats_queue_size_rd;
@@ -273,7 +265,7 @@ typedef struct {
RRDDIM *training_results_not_enough_collected_values_rd;
RRDDIM *training_results_null_acquired_dimension_rd;
RRDDIM *training_results_chart_under_replication_rd;
-} ml_training_thread_t;
+} ml_host_t;
typedef struct {
bool enable_anomaly_detection;
@@ -310,14 +302,6 @@ typedef struct {
std::vector<uint32_t> random_nums;
netdata_thread_t detection_thread;
- std::atomic<bool> detection_stop;
-
- size_t num_training_threads;
-
- std::vector<ml_training_thread_t> training_threads;
- std::atomic<bool> training_stop;
-
- bool enable_statistics_charts;
} ml_config_t;
void ml_config_load(ml_config_t *cfg);