linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Masami Hiramatsu" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf probe: Generate event name with line number
Date: Tue, 19 Nov 2019 16:56:48 -0000	[thread overview]
Message-ID: <157418260835.12247.14416833763414909723.tip-bot2@tip-bot2> (raw)
In-Reply-To: <157406474026.24476.2828897745502059569.stgit@devnote2>

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     15354d54698648e20454fc8f298a5b18b6debea7
Gitweb:        https://git.kernel.org/tip/15354d54698648e20454fc8f298a5b18b6debea7
Author:        Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate:    Mon, 18 Nov 2019 17:12:20 +09:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Mon, 18 Nov 2019 19:02:00 -03:00

perf probe: Generate event name with line number

Generate event name from function name with line number as
<function>_L<line_number>. Note that this is only for the new event
which is defined by the line number of function (except for line 0).

If there is another event on same line, you have to use
"-f" option. In that case, the new event has "_1" suffix.

 e.g.
  # perf probe -a kernel_read:2
  Added new event:
    probe:kernel_read_L2 (on kernel_read:2)

  You can now use it in all perf tools, such as:

  	perf record -e probe:kernel_read_L2 -aR sleep 1

But if we omit the line number or 0th line, it will
have no suffix.

  # perf probe -a kernel_read:0
  Added new event:
    probe:kernel_read (on kernel_read)

  You can now use it in all perf tools, such as:

  	perf record -e probe:kernel_read -aR sleep 1

  probe:kernel_read    (on kernel_read@linux-5.0.0/fs/read_write.c)
  probe:kernel_read_L2 (on kernel_read:2@linux-5.0.0/fs/read_write.c)

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lore.kernel.org/lkml/157406474026.24476.2828897745502059569.stgit@devnote2
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e29948b..5c86d2c 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1679,6 +1679,14 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev)
 	if (ret < 0)
 		goto out;
 
+	/* Generate event name if needed */
+	if (!pev->event && pev->point.function && pev->point.line
+			&& !pev->point.lazy_line && !pev->point.offset) {
+		if (asprintf(&pev->event, "%s_L%d", pev->point.function,
+			pev->point.line) < 0)
+			return -ENOMEM;
+	}
+
 	/* Copy arguments and ensure return probe has no C argument */
 	pev->nargs = argc - 1;
 	pev->args = zalloc(sizeof(struct perf_probe_arg) * pev->nargs);

  parent reply	other threads:[~2019-11-19 16:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  8:11 [PATCH v3 0/7] perf/probe: Support multiprobe and immediates with fixes Masami Hiramatsu
2019-11-18  8:11 ` [PATCH v3 1/7] perf probe: Show correct statement line number by perf probe -l Masami Hiramatsu
2019-11-18 21:57   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 2/7] perf probe: Verify given line is a representive line Masami Hiramatsu
2019-11-18 21:59   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 3/7] perf probe: Do not show non representive lines by perf-probe -L Masami Hiramatsu
2019-11-18 22:01   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 4/7] perf probe: Generate event name with line number Masami Hiramatsu
2019-11-18 22:03   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` tip-bot2 for Masami Hiramatsu [this message]
2019-11-18  8:12 ` [PATCH v3 5/7] perf probe: Support multiprobe event Masami Hiramatsu
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 6/7] perf probe: Support DW_AT_const_value constant value Masami Hiramatsu
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 7/7] perf probe: Trace a magic number if variable is not found Masami Hiramatsu
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18 22:11 ` [PATCH v3 0/7] perf/probe: Support multiprobe and immediates with fixes Arnaldo Carvalho de Melo
2019-11-19 13:46   ` Masami Hiramatsu
2019-11-19 14:33     ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157418260835.12247.14416833763414909723.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=acme@redhat.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).