Re: perf support user-space hw_breakpoint?

From: David Ahern
Date: Thu Jun 28 2012 - 00:10:48 EST


On 6/27/12 8:20 PM, Namhyung Kim wrote:
NAK. This uses_mmap field is needed to setup per-task-per-cpu events for
perf record (mostly). Without it, perf suffered from severe scalability
issues. Maybe we can change it not to create per-task-per-cpu events iff
for hwbp events only, but I'm not sure it's the right thing.

Thanks,
Namhyung

Add -a to the record command. And if you want to dump the samples try the attached.

David

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 8e395a5..e3093a1 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -109,6 +109,17 @@ static struct {

.invalid_fields = PERF_OUTPUT_TRACE,
},
+
+ [PERF_TYPE_BREAKPOINT] = {
+ .user_set = false,
+
+ .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
+ PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
+ PERF_OUTPUT_IP | PERF_OUTPUT_ADDR |
+ PERF_OUTPUT_SYM | PERF_OUTPUT_DSO,
+
+ .invalid_fields = PERF_OUTPUT_TRACE,
+ },
};

static bool output_set_by_user(void)
@@ -727,6 +738,8 @@ static int parse_output_fields(const struct option *opt __used,
type = PERF_TYPE_TRACEPOINT;
else if (!strcmp(str, "raw"))
type = PERF_TYPE_RAW;
+ else if (!strcmp(str, "bp"))
+ type = PERF_TYPE_BREAKPOINT;
else {
fprintf(stderr, "Invalid event type in field string.\n");
rc = -EINVAL;
@@ -1144,7 +1157,7 @@ static const struct option options[] = {
"Look for files with symbols relative to this directory"),
OPT_CALLBACK('f', "fields", NULL, "str",
"comma separated output fields prepend with 'type:'. "
- "Valid types: hw,sw,trace,raw. "
+ "Valid types: hw,sw,trace,raw,bp. "
"Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,"
"addr,symoff",
parse_output_fields),