Commit 0bee1067 authored by Song Liu's avatar Song Liu Committed by Alexei Starovoitov

libbpf: Add support for command BPF_ENABLE_STATS

bpf_enable_stats() is added to enable given stats.
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200430071506.1408910-3-songliubraving@fb.com
parent d46edd67
...@@ -841,3 +841,13 @@ int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf, __u32 *buf_len, ...@@ -841,3 +841,13 @@ int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf, __u32 *buf_len,
return err; return err;
} }
int bpf_enable_stats(enum bpf_stats_type type)
{
union bpf_attr attr;
memset(&attr, 0, sizeof(attr));
attr.enable_stats.type = type;
return sys_bpf(BPF_ENABLE_STATS, &attr, sizeof(attr));
}
...@@ -231,6 +231,7 @@ LIBBPF_API int bpf_load_btf(void *btf, __u32 btf_size, char *log_buf, ...@@ -231,6 +231,7 @@ LIBBPF_API int bpf_load_btf(void *btf, __u32 btf_size, char *log_buf,
LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf, LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf,
__u32 *buf_len, __u32 *prog_id, __u32 *fd_type, __u32 *buf_len, __u32 *prog_id, __u32 *fd_type,
__u64 *probe_offset, __u64 *probe_addr); __u64 *probe_offset, __u64 *probe_addr);
LIBBPF_API int bpf_enable_stats(enum bpf_stats_type type);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
......
...@@ -257,6 +257,7 @@ LIBBPF_0.0.8 { ...@@ -257,6 +257,7 @@ LIBBPF_0.0.8 {
LIBBPF_0.0.9 { LIBBPF_0.0.9 {
global: global:
bpf_enable_stats;
bpf_link_get_fd_by_id; bpf_link_get_fd_by_id;
bpf_link_get_next_id; bpf_link_get_next_id;
} LIBBPF_0.0.8; } LIBBPF_0.0.8;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment