summaryrefslogtreecommitdiffstats
path: root/ml/Host.h
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2022-03-30 13:38:18 +0300
committerGitHub <noreply@github.com>2022-03-30 13:38:18 +0300
commit41a40dc3a406c3c8dc70f41038e7d75ef2601f8b (patch)
treed889c164f2be7588a4c5940cf777ccd94cb39e7a /ml/Host.h
parentffee2317885bf8ceab7224ba23aad08421986cd5 (diff)
ML-related changes to address issue/discussion comments. (#12494)
* Increase training thread's max sleep time. With this change we will only cap the allotted time when it is more than ten seconds. The previous limit was one second, which had the effect of scheduling dimensions near the beggining of each training window. This was not desirable because it would cause high CPU usage on parents with many children. * Only exclude netdata.* charts from training. * Use heartbeat in detection thread. * Track rusage of prediction thread. * Track rusage of training thread. * Add support for random sampling of extracted features. * Rebase * Skip RNG when ML is disabled and fix undef behaviour
Diffstat (limited to 'ml/Host.h')
-rw-r--r--ml/Host.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ml/Host.h b/ml/Host.h
index 574b18aa36..ee2a805885 100644
--- a/ml/Host.h
+++ b/ml/Host.h
@@ -70,9 +70,22 @@ public:
void train();
+ void updateResourceUsage() {
+ std::lock_guard<std::mutex> Lock(ResourceUsageMutex);
+ getrusage(RUSAGE_THREAD, &ResourceUsage);
+ }
+
+ void getResourceUsage(struct rusage *RU) {
+ std::lock_guard<std::mutex> Lock(ResourceUsageMutex);
+ memcpy(RU, &ResourceUsage, sizeof(struct rusage));
+ }
+
private:
std::pair<Dimension *, Duration<double>> findDimensionToTrain(const TimePoint &NowTP);
void trainDimension(Dimension *D, const TimePoint &NowTP);
+
+ std::mutex ResourceUsageMutex;
+ struct rusage ResourceUsage;
};
class DetectableHost : public TrainableHost {