summaryrefslogtreecommitdiffstats
path: root/libnetdata/ebpf/ebpf.h
diff options
context:
space:
mode:
Diffstat (limited to 'libnetdata/ebpf/ebpf.h')
-rw-r--r--libnetdata/ebpf/ebpf.h44
1 files changed, 38 insertions, 6 deletions
diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h
index e82aaedd4..88dbca379 100644
--- a/libnetdata/ebpf/ebpf.h
+++ b/libnetdata/ebpf/ebpf.h
@@ -43,6 +43,7 @@
#define EBPF_CFG_MAPS_PER_CORE "maps per core"
#define EBPF_CFG_UPDATE_EVERY "update every"
+#define EBPF_CFG_LIFETIME "lifetime"
#define EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT 10
#define EBPF_CFG_PID_SIZE "pid table size"
#define EBPF_CFG_APPLICATION "apps"
@@ -270,15 +271,17 @@ typedef enum netdata_apps_integration_flags {
#define NETDATA_EBPF_STAT_DIMENSION_ARAL "aral"
enum ebpf_threads_status {
- NETDATA_THREAD_EBPF_RUNNING,
- NETDATA_THREAD_EBPF_STOPPING,
- NETDATA_THREAD_EBPF_STOPPED,
- NETDATA_THREAD_EBPF_NOT_RUNNING
+ NETDATA_THREAD_EBPF_RUNNING, // started by plugin
+ NETDATA_THREAD_EBPF_FUNCTION_RUNNING, // started by function
+ NETDATA_THREAD_EBPF_STOPPING, // stopping thread
+ NETDATA_THREAD_EBPF_STOPPED, // thread stopped
+ NETDATA_THREAD_EBPF_NOT_RUNNING // thread was never started
};
typedef struct ebpf_module {
const char *thread_name;
const char *config_name;
+ const char *thread_description;
enum ebpf_threads_status enabled;
void *(*start_routine)(void *);
int update_every;
@@ -306,8 +309,16 @@ typedef struct ebpf_module {
char memory_usage[NETDATA_EBPF_CHART_MEM_LENGTH];
char memory_allocations[NETDATA_EBPF_CHART_MEM_LENGTH];
int maps_per_core;
+
+ // period to run
+ uint32_t running_time; // internal usage, this is used to reset a value when a new request happens.
+ uint32_t lifetime;
} ebpf_module_t;
+#define EBPF_DEFAULT_LIFETIME 300
+// This will be present until all functions are merged
+#define EBPF_NON_FUNCTION_LIFE_TIME 86400
+
int ebpf_get_kernel_version();
int get_redhat_release();
int has_condition_to_run(int version);
@@ -336,10 +347,21 @@ void ebpf_update_map_size(struct bpf_map *map, ebpf_local_maps_t *lmap, ebpf_mod
typedef struct netdata_ebpf_histogram {
char *name;
char *title;
+ char *ctx;
int order;
uint64_t histogram[NETDATA_EBPF_HIST_MAX_BINS];
} netdata_ebpf_histogram_t;
+enum fs_btf_counters {
+ NETDATA_KEY_BTF_READ,
+ NETDATA_KEY_BTF_WRITE,
+ NETDATA_KEY_BTF_OPEN,
+ NETDATA_KEY_BTF_SYNC_ATTR,
+ NETDATA_KEY_BTF_OPEN2,
+
+ NETDATA_FS_BTF_END
+};
+
typedef struct ebpf_filesystem_partitions {
char *filesystem;
char *optional_filesystem;
@@ -359,6 +381,14 @@ typedef struct ebpf_filesystem_partitions {
ebpf_addresses_t addresses;
uint64_t kernels;
ebpf_local_maps_t *fs_maps;
+
+ // BPF structure
+#ifdef LIBBPF_MAJOR_VERSION
+ struct filesystem_bpf *fs_obj;
+#else
+ void *fs_obj;
+#endif
+ const char *functions[NETDATA_FS_BTF_END];
} ebpf_filesystem_partitions_t;
typedef struct ebpf_sync_syscalls {
@@ -407,9 +437,11 @@ void ebpf_update_map_type(struct bpf_map *map, ebpf_local_maps_t *w);
void ebpf_define_map_type(ebpf_local_maps_t *maps, int maps_per_core, int kver);
#endif
-void ebpf_update_kernel_memory_with_vector(ebpf_plugin_stats_t *report, ebpf_local_maps_t *maps);
+void ebpf_update_kernel_memory_with_vector(ebpf_plugin_stats_t *report, ebpf_local_maps_t *maps,
+ ebpf_stats_action_t action);
void ebpf_update_kernel_memory(ebpf_plugin_stats_t *report, ebpf_local_maps_t *map, ebpf_stats_action_t action);
-void ebpf_statistic_create_aral_chart(char *name, ebpf_module_t *em);
+int ebpf_statistic_create_aral_chart(char *name, ebpf_module_t *em);
+void ebpf_statistic_obsolete_aral_chart(ebpf_module_t *em, int prio);
void ebpf_send_data_aral_chart(ARAL *memory, ebpf_module_t *em);
#endif /* NETDATA_EBPF_H */