aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-event.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2016-06-08 05:29:50 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-14 08:29:54 -0400
commitc4ff49209bcdc1ef709773f4833a341ac49a26cc (patch)
tree38c4d853fed974056ee401885c72f2e102ff6057 /tools/perf/util/probe-event.c
parent0542bb9c8da51faa8d8703c394c32e334ac4e9d6 (diff)
perf probe: Uncomment and export synthesize_perf_probe_point()
Uncomment and export synthesize_perf_probe_point() which had once introduced but has been disabled for a long time. This renews the code and re-enable it. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Hemant Kumar <hemant@linux.vnet.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20160608092949.3116.21958.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r--tools/perf/util/probe-event.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 84f4b2b32ab7..cbc8a8bf0f36 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -67,7 +67,6 @@ int e_snprintf(char *str, size_t size, const char *format, ...)
67 return ret; 67 return ret;
68} 68}
69 69
70static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
71static struct machine *host_machine; 70static struct machine *host_machine;
72 71
73/* Initialize symbol maps and path of vmlinux/modules */ 72/* Initialize symbol maps and path of vmlinux/modules */
@@ -1716,7 +1715,7 @@ out:
1716} 1715}
1717 1716
1718/* Compose only probe point (not argument) */ 1717/* Compose only probe point (not argument) */
1719static char *synthesize_perf_probe_point(struct perf_probe_point *pp) 1718char *synthesize_perf_probe_point(struct perf_probe_point *pp)
1720{ 1719{
1721 struct strbuf buf; 1720 struct strbuf buf;
1722 char *tmp, *ret = NULL; 1721 char *tmp, *ret = NULL;
@@ -1755,30 +1754,36 @@ out:
1755 return ret; 1754 return ret;
1756} 1755}
1757 1756
1758#if 0
1759char *synthesize_perf_probe_command(struct perf_probe_event *pev) 1757char *synthesize_perf_probe_command(struct perf_probe_event *pev)
1760{ 1758{
1761 char *buf; 1759 struct strbuf buf;
1762 int i, len, ret; 1760 char *tmp, *ret = NULL;
1761 int i;
1763 1762
1764 buf = synthesize_perf_probe_point(&pev->point); 1763 if (strbuf_init(&buf, 64))
1765 if (!buf)
1766 return NULL; 1764 return NULL;
1765 if (pev->event)
1766 if (strbuf_addf(&buf, "%s:%s=", pev->group ?: PERFPROBE_GROUP,
1767 pev->event) < 0)
1768 goto out;
1769
1770 tmp = synthesize_perf_probe_point(&pev->point);
1771 if (!tmp || strbuf_addstr(&buf, tmp) < 0)
1772 goto out;
1773 free(tmp);
1767 1774
1768 len = strlen(buf);
1769 for (i = 0; i < pev->nargs; i++) { 1775 for (i = 0; i < pev->nargs; i++) {
1770 ret = e_snprintf(&buf[len], MAX_CMDLEN - len, " %s", 1776 tmp = synthesize_perf_probe_arg(pev->args + i);
1771 pev->args[i].name); 1777 if (!tmp || strbuf_addf(&buf, " %s", tmp) < 0)
1772 if (ret <= 0) { 1778 goto out;
1773 free(buf); 1779 free(tmp);
1774 return NULL;
1775 }
1776 len += ret;
1777 } 1780 }
1778 1781
1779 return buf; 1782 ret = strbuf_detach(&buf, NULL);
1783out:
1784 strbuf_release(&buf);
1785 return ret;
1780} 1786}
1781#endif
1782 1787
1783static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref, 1788static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref,
1784 struct strbuf *buf, int depth) 1789 struct strbuf *buf, int depth)