lkml.org 
[lkml]   [2018]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/13] perf bpf: Add compile option
Date
Adding -c/--compile option to provide compilation
for ebpf objects, like:

$ perf bpf -c samples/syscall-counts.c
LLVM: dumping samples/syscall-counts.o

Link: http://lkml.kernel.org/n/tip-w48lyepbrde7no35sxi2vtxh@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-bpf.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/tools/perf/builtin-bpf.c b/tools/perf/builtin-bpf.c
index 6f02352caf79..1ae93fd01a97 100644
--- a/tools/perf/builtin-bpf.c
+++ b/tools/perf/builtin-bpf.c
@@ -145,6 +145,7 @@ int cmd_bpf(int argc, const char **argv)
"perf bpf [<options>] -- <command> [<options>]",
NULL
};
+ const char *compile_src = NULL;
const struct option bpf_options[] = {
OPT_CALLBACK('e', "event", &bpf.evlist, "event",
"event selector. use 'perf list' to list available events",
@@ -159,6 +160,8 @@ int cmd_bpf(int argc, const char **argv)
"record events on existing thread id"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose"),
+ OPT_STRING('c', "compile", &compile_src, "eBPF source",
+ "compile eBPF object"),
OPT_END()
};

@@ -170,6 +173,10 @@ int cmd_bpf(int argc, const char **argv)

argc = parse_options(argc, argv, bpf_options, bpf_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
+
+ if (compile_src)
+ return bpf__compile(compile_src);
+
if (!argc && target__none(&bpf.target))
usage_with_options(bpf_usage, bpf_options);

--
2.13.6
\
 
 \ /
  Last update: 2018-03-12 10:44    [W:0.139 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site