aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/namespaces.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-09-20 12:14:00 -0400
committerIngo Molnar <mingo@kernel.org>2019-09-20 12:16:42 -0400
commit351a1f5c8afa13ea5cfcdae543f6596ef8ebdbd9 (patch)
tree6d039ac0d47666bd6de701911a283c51bea7105e /tools/perf/util/namespaces.c
parent7f2444d38f6bbfa12bc15e2533d8f9daa85ca02b (diff)
parent2bff2b828502b5e5d5ea5a52643d3542053df03f (diff)
Merge tag 'perf-core-for-mingo-5.4-20190920-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: perf stat: Srikar Dronamraju: - Fix a segmentation fault when using repeat forever. - Reset previous counts on repeat with interval. aarch64: James Clark: - Add PMU event JSON files for Cortex-A76 and Neoverse N1. PowerPC: Anju T Sudhakar: - Make 'trace_cycles' the default event for 'perf kvm record' in PowerPC. S/390: - Link libjvmti to tools/lib/string.o to have a weak strlcpy() implementation, providing previously unresolved symbol on s/390. perf test: Jiri Olsa: - Add libperf automated tests to 'make -C tools/perf build-test'. Colin Ian King: - Fix spelling mistake. Tree wide: Arnaldo Carvalho de Melo: - Some more header file sanitization. libperf: Jiri Olsa: - Add dependency on libperf for python.so binding. libtraceevent: Sakari Ailus: - Convert remaining %p[fF] users to %p[sS]. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/namespaces.c')
-rw-r--r--tools/perf/util/namespaces.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c
index 99be15dd2b6b..285d6f30d912 100644
--- a/tools/perf/util/namespaces.c
+++ b/tools/perf/util/namespaces.c
@@ -17,8 +17,26 @@
17#include <string.h> 17#include <string.h>
18#include <unistd.h> 18#include <unistd.h>
19#include <asm/bug.h> 19#include <asm/bug.h>
20#include <linux/kernel.h>
20#include <linux/zalloc.h> 21#include <linux/zalloc.h>
21 22
23static const char *perf_ns__names[] = {
24 [NET_NS_INDEX] = "net",
25 [UTS_NS_INDEX] = "uts",
26 [IPC_NS_INDEX] = "ipc",
27 [PID_NS_INDEX] = "pid",
28 [USER_NS_INDEX] = "user",
29 [MNT_NS_INDEX] = "mnt",
30 [CGROUP_NS_INDEX] = "cgroup",
31};
32
33const char *perf_ns__name(unsigned int id)
34{
35 if (id >= ARRAY_SIZE(perf_ns__names))
36 return "UNKNOWN";
37 return perf_ns__names[id];
38}
39
22struct namespaces *namespaces__new(struct perf_record_namespaces *event) 40struct namespaces *namespaces__new(struct perf_record_namespaces *event)
23{ 41{
24 struct namespaces *namespaces; 42 struct namespaces *namespaces;