Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Viewer program (bandwidth) #151

Merged
merged 9 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions includes/bpf_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ extern int prog_cnt;

/* There is a one-to-one mapping between map_fd[] and map_data[].
* The map_data[] just contains more rich info on the given map.
*/
extern int map_fd[MAX_MAPS];
*/
extern struct bpf_map_data map_data[MAX_MAPS];
extern int map_data_count;

Expand All @@ -50,8 +50,8 @@ extern int map_data_count;
*
* returns zero on success
*/
int load_bpf_file(char *path, int pid);
int load_bpf_file_fixup_map(const char *path, fixup_map_cb fixup_map);
int load_bpf_file(int *map_fd,char *path, int pid);
int load_bpf_file_fixup_map(int *map_fd,const char *path, fixup_map_cb fixup_map);

void read_trace_pipe(void);
int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags);
Expand Down
3 changes: 2 additions & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ CURRENT_KERNEL=$(shell echo $(VER_MAJOR)\*65536 + $(VER_MINOR)\*256 + $(VER_PATC

latency_process_kern.o: latency_process_kern.c
process_kern.o: process_kern.c
network_viewer_kern.o: network_viewer_kern.c

all: process_kern.o latency_process_kern.o
all: process_kern.o latency_process_kern.o network_viewer_kern.o

%.o: %.c
if [ -w /usr/src/linux/include/generated/autoconf.h ]; then if [ "$(CURRENT_KERNEL)" -ge 328448 ]; then sed -i -e 's/\(#define CONFIG_CC_HAS_ASM_INLINE 1\)/\/\/\1/' /usr/src/linux/include/generated/autoconf.h; fi ; fi
Expand Down
25 changes: 24 additions & 1 deletion kernel/netdata_ebpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct netdata_error_report_t {
int err;
};

# define NETDATA_GLOBAL_COUNTER 24

//fork() creates process
//
Expand Down Expand Up @@ -49,6 +48,9 @@ struct netdata_pid_stat_t {
__u32 close_err;
};

//ebpf_process.c
# define NETDATA_GLOBAL_COUNTER 24

# define NETDATA_KEY_CALLS_DO_SYS_OPEN 0
# define NETDATA_KEY_ERROR_DO_SYS_OPEN 1

Expand Down Expand Up @@ -84,4 +86,25 @@ struct netdata_pid_stat_t {
# define NETDATA_KEY_ERROR_VFS_READV 22
# define NETDATA_KEY_BYTES_VFS_READV 23

//network_viewer.c
# define NETDATA_SOCKET_COUNTER 13

# define NETDATA_KEY_CALLS_TCP_SENDMSG 0
# define NETDATA_KEY_ERROR_TCP_SENDMSG 1
# define NETDATA_KEY_BYTES_TCP_SENDMSG 2

# define NETDATA_KEY_CALLS_TCP_CLEANUP_RBUF 3
# define NETDATA_KEY_ERROR_TCP_CLEANUP_RBUF 4
# define NETDATA_KEY_BYTES_TCP_CLEANUP_RBUF 5

# define NETDATA_KEY_CALLS_TCP_CLOSE 6

# define NETDATA_KEY_CALLS_UDP_RECVMSG 7
# define NETDATA_KEY_ERROR_UDP_RECVMSG 8
# define NETDATA_KEY_BYTES_UDP_RECVMSG 9

# define NETDATA_KEY_CALLS_UDP_SENDMSG 10
# define NETDATA_KEY_ERROR_UDP_SENDMSG 11
# define NETDATA_KEY_BYTES_UDP_SENDMSG 12

#endif
Loading