diff options
author | Song Liu <songliubraving@fb.com> | 2020-04-30 00:15:05 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-05-01 10:36:32 -0700 |
commit | 0bee106716cfb2c6da81916b968395db22bd7755 (patch) | |
tree | 6a438ee3a2376d99a6cccee19c280f2e4e791db8 /tools/lib/bpf/bpf.c | |
parent | d46edd671a147032e22cfeb271a5734703093649 (diff) |
libbpf: Add support for command BPF_ENABLE_STATS
bpf_enable_stats() is added to enable given stats.
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200430071506.1408910-3-songliubraving@fb.com
Diffstat (limited to 'tools/lib/bpf/bpf.c')
-rw-r--r-- | tools/lib/bpf/bpf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 8f2f0958d446..43322f0d6c7f 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -841,3 +841,13 @@ int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf, __u32 *buf_len, 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)); +} |