perf tools: Add perf_exe() helper to find perf binary
Also convert one existing user. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20190224153722.27020-9-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
4b6ac811bc
commit
94816add00
@@ -568,3 +568,13 @@ out:
|
||||
|
||||
return tip;
|
||||
}
|
||||
|
||||
char *perf_exe(char *buf, int len)
|
||||
{
|
||||
int n = readlink("/proc/self/exe", buf, len);
|
||||
if (n > 0) {
|
||||
buf[n] = 0;
|
||||
return buf;
|
||||
}
|
||||
return strcpy(buf, "perf");
|
||||
}
|
||||
|
Reference in New Issue
Block a user