master
h 63 lines 1.83 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_NETDATA_CONF_PROFILE_H
4 #define NETDATA_NETDATA_CONF_PROFILE_H
5
6 #include "libnetdata/libnetdata.h"
7
8 typedef enum __attribute__((packed)) {
9 ND_PROFILE_NONE = (0),
10
11 // system profiles
12 ND_PROFILE_PARENT = (1 << 30),
13 ND_PROFILE_STANDALONE = (1 << 29),
14 ND_PROFILE_CHILD = (1 << 28),
15 ND_PROFILE_IOT = (1 << 27),
16
17 // optional attributed to profiles
18
19 } ND_PROFILE;
20
21 typedef enum __attribute__((packed)) {
22 ND_COMPRESSION_DEFAULT = 0,
23 ND_COMPRESSION_FASTEST,
24 } ND_COMPRESSION_PROFILE;
25
26 #define ND_CONF_PROFILES_SYSTEM (ND_PROFILE_STANDALONE | ND_PROFILE_PARENT | ND_PROFILE_CHILD | ND_PROFILE_IOT)
27
28 BITMAP_STR_DEFINE_FUNCTIONS_EXTERN(ND_PROFILE);
29
30 ND_PROFILE nd_profile_detect_and_configure(bool recheck);
31
32 void nd_profile_setup(void);
33
34 static inline bool netdata_conf_is_iot(void) {
35 return (nd_profile_detect_and_configure(false) & ND_CONF_PROFILES_SYSTEM) == ND_PROFILE_IOT;
36 }
37
38 static inline bool netdata_conf_is_standalone(void) {
39 return (nd_profile_detect_and_configure(false) & ND_CONF_PROFILES_SYSTEM) == ND_PROFILE_STANDALONE;
40 }
41
42 static inline bool netdata_conf_is_child(void) {
43 return (nd_profile_detect_and_configure(false) & ND_CONF_PROFILES_SYSTEM) == ND_PROFILE_CHILD;
44 }
45
46 static inline bool netdata_conf_is_parent(void) {
47 return (nd_profile_detect_and_configure(false) & ND_CONF_PROFILES_SYSTEM) == ND_PROFILE_PARENT;
48 }
49
50 struct nd_profile_t {
51 size_t storage_tiers;
52 time_t update_every;
53 size_t malloc_arenas;
54 size_t malloc_trim;
55 size_t max_page_size;
56 time_t dbengine_journal_v2_unmount_time;
57 ND_COMPRESSION_PROFILE stream_sender_compression;
58 int ml_enabled;
59 };
60
61 extern struct nd_profile_t nd_profile;
62
63 #endif //NETDATA_NETDATA_CONF_PROFILE_H