-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'perf-core-for-mingo-5.1-20190220' of git://git.kernel.org/…
…pub/scm/linux/kernel/git/acme/linux into perf/core Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: perf report: He Kuang: - Don't shadow inlined symbol with different addr range. perf script: Jiri Olsa: - Allow +- operator to ask for -F to add/remove fields to the default set, for instance to ask for the removal of the 'cpu' field in tracepoint events, adding 'period' to that kind of events, etc. perf test: Thomas Richter: - Fix scheduler tracepoint signedness of COMM fields failure of 'evsel-tp-sched' test on s390 and other arches. Tommi Rantala: - Skip trace+probe_vfs_getname.sh when 'perf trace' is not built. perf trace: Arnaldo Carvalho de Melo: - Add initial BPF map dumper, initially just for the current, minimal needs of the augmented_raw_syscalls BPF example used to collect pointer args payloads that uses BPF maps for pid and syscall filtering, but will in time have features similar to 'perf stat' --interval-print, --interval-clear, ways to signal from a BPF event that a specific map (or range of that map) should be printed, optionally as a histogram, etc. General: Jiri Olsa: - Add CPU and NUMA topologies classes for further reuse, fixing some issues in the process. - Fixup some warnings and debug levels. - Make rm_rf() remove single file, not just directories. Documentation: Jonas Rabenstein: - Fix HEADER_CMDLINE description in perf.data documentation. - Fix documentation of the Flags section in perf.data. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
- Loading branch information
Showing
21 changed files
with
530 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) | ||
|
||
#include "util/bpf_map.h" | ||
#include <bpf/bpf.h> | ||
#include <bpf/libbpf.h> | ||
#include <linux/err.h> | ||
#include <linux/kernel.h> | ||
#include <stdbool.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
|
||
static bool bpf_map_def__is_per_cpu(const struct bpf_map_def *def) | ||
{ | ||
return def->type == BPF_MAP_TYPE_PERCPU_HASH || | ||
def->type == BPF_MAP_TYPE_PERCPU_ARRAY || | ||
def->type == BPF_MAP_TYPE_LRU_PERCPU_HASH || | ||
def->type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE; | ||
} | ||
|
||
static void *bpf_map_def__alloc_value(const struct bpf_map_def *def) | ||
{ | ||
if (bpf_map_def__is_per_cpu(def)) | ||
return malloc(round_up(def->value_size, 8) * sysconf(_SC_NPROCESSORS_CONF)); | ||
|
||
return malloc(def->value_size); | ||
} | ||
|
||
int bpf_map__fprintf(struct bpf_map *map, FILE *fp) | ||
{ | ||
const struct bpf_map_def *def = bpf_map__def(map); | ||
void *prev_key = NULL, *key, *value; | ||
int fd = bpf_map__fd(map), err; | ||
int printed = 0; | ||
|
||
if (fd < 0) | ||
return fd; | ||
|
||
if (IS_ERR(def)) | ||
return PTR_ERR(def); | ||
|
||
err = -ENOMEM; | ||
key = malloc(def->key_size); | ||
if (key == NULL) | ||
goto out; | ||
|
||
value = bpf_map_def__alloc_value(def); | ||
if (value == NULL) | ||
goto out_free_key; | ||
|
||
while ((err = bpf_map_get_next_key(fd, prev_key, key) == 0)) { | ||
int intkey = *(int *)key; | ||
|
||
if (!bpf_map_lookup_elem(fd, key, value)) { | ||
bool boolval = *(bool *)value; | ||
if (boolval) | ||
printed += fprintf(fp, "[%d] = %d,\n", intkey, boolval); | ||
} else { | ||
printed += fprintf(fp, "[%d] = ERROR,\n", intkey); | ||
} | ||
|
||
prev_key = key; | ||
} | ||
|
||
if (err == ENOENT) | ||
err = printed; | ||
|
||
free(value); | ||
out_free_key: | ||
free(key); | ||
out: | ||
return err; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) | ||
#ifndef __PERF_BPF_MAP_H | ||
#define __PERF_BPF_MAP_H 1 | ||
|
||
#include <stdio.h> | ||
#include <linux/compiler.h> | ||
struct bpf_map; | ||
|
||
#ifdef HAVE_LIBBPF_SUPPORT | ||
|
||
int bpf_map__fprintf(struct bpf_map *map, FILE *fp); | ||
|
||
#else | ||
|
||
static inline int bpf_map__fprintf(struct bpf_map *map __maybe_unused, FILE *fp __maybe_unused) | ||
{ | ||
return 0; | ||
} | ||
|
||
#endif // HAVE_LIBBPF_SUPPORT | ||
|
||
#endif // __PERF_BPF_MAP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.