Skip to content

Commit

Permalink
Prepare to functions (eBPF) (netdata#16788)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoftsm authored Mar 1, 2024
1 parent ccb10a5 commit 0dbf4bb
Show file tree
Hide file tree
Showing 21 changed files with 1,111 additions and 1,305 deletions.
11 changes: 5 additions & 6 deletions src/collectors/ebpf.plugin/ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4032,6 +4032,7 @@ int main(int argc, char **argv)
heartbeat_t hb;
heartbeat_init(&hb);
int update_apps_every = (int) EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT;
int max_period = update_apps_every * EBPF_CLEANUP_FACTOR;
int update_apps_list = update_apps_every - 1;
int process_maps_per_core = ebpf_modules[EBPF_MODULE_PROCESS_IDX].maps_per_core;
//Plugin will be killed when it receives a signal
Expand All @@ -4047,19 +4048,17 @@ int main(int argc, char **argv)
fflush(stdout);
}

pthread_mutex_lock(&ebpf_exit_cleanup);
pthread_mutex_lock(&collect_data_mutex);
if (++update_apps_list == update_apps_every) {
update_apps_list = 0;
cleanup_exited_pids();
pthread_mutex_lock(&lock);
pthread_mutex_lock(&collect_data_mutex);
ebpf_cleanup_exited_pids(max_period);
collect_data_for_all_processes(process_pid_fd, process_maps_per_core);

pthread_mutex_lock(&lock);
ebpf_create_apps_charts(apps_groups_root_target);
pthread_mutex_unlock(&collect_data_mutex);
pthread_mutex_unlock(&lock);
}
pthread_mutex_unlock(&collect_data_mutex);
pthread_mutex_unlock(&ebpf_exit_cleanup);
}

ebpf_stop_threads(0);
Expand Down
10 changes: 5 additions & 5 deletions src/collectors/ebpf.plugin/ebpf.d.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@
# When plugin detects that system has support to BTF, it enables integration with apps.plugin.
#
[ebpf programs]
cachestat = yes
cachestat = no
dcstat = no
disk = no
fd = yes
fd = no
filesystem = no
hardirq = no
mdflush = no
mount = yes
oomkill = yes
process = yes
shm = yes
process = no
shm = no
socket = no
softirq = yes
sync = no
swap = yes
swap = no
vfs = no
network connections = no
2 changes: 1 addition & 1 deletion src/collectors/ebpf.plugin/ebpf.d/cachestat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
# pid table size = 32768
ebpf type format = auto
ebpf co-re tracing = trampoline
collect pid = real parent
collect pid = all
# maps per core = yes
lifetime = 300
2 changes: 1 addition & 1 deletion src/collectors/ebpf.plugin/ebpf.d/dcstat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
# pid table size = 32768
ebpf type format = auto
ebpf co-re tracing = trampoline
collect pid = real parent
collect pid = all
# maps per core = yes
lifetime = 300
2 changes: 1 addition & 1 deletion src/collectors/ebpf.plugin/ebpf.d/process.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
# cgroups = no
# update every = 10
# pid table size = 32768
collect pid = real parent
collect pid = all
# maps per core = yes
lifetime = 300
1 change: 1 addition & 0 deletions src/collectors/ebpf.plugin/ebpf.d/shm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# pid table size = 32768
ebpf type format = auto
ebpf co-re tracing = trampoline
collect pid = all
# maps per core = yes
lifetime = 300

Expand Down
1 change: 1 addition & 0 deletions src/collectors/ebpf.plugin/ebpf.d/swap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
# pid table size = 32768
ebpf type format = auto
ebpf co-re tracing = trampoline
collect pid = all
# maps per core = yes
lifetime = 300
Loading

0 comments on commit 0dbf4bb

Please sign in to comment.