diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-08-24 11:08:10 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-08-24 11:08:10 +0200 |
commit | 36e674a05164cdbb9d4a5b1b0b279fabae6c13bd (patch) | |
tree | b00a7ae974277eaed48eebd8287ca32fcaae26fe /tools/perf/util/probe-file.c | |
parent | b6a32f023fcc9cbd1602f78a467fd8d41bbc9457 (diff) | |
parent | 5e30d55c71de058e4156080fe32d426c22d094cb (diff) | |
download | linux-36e674a05164cdbb9d4a5b1b0b279fabae6c13bd.tar.gz linux-36e674a05164cdbb9d4a5b1b0b279fabae6c13bd.tar.bz2 linux-36e674a05164cdbb9d4a5b1b0b279fabae6c13bd.zip |
Merge tag 'perf-core-for-mingo-20160823' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
. Allow configuring the default 'perf report -s' sort order in ~/.perfconfig,
for instance, "sym,dso" may be more fitting for kernel developers. (Arnaldo Carvalho de Melo)
- Support x8/x16/x32/x64 hexadecimal "types" in ftrace and 'perf probe' (Masami Hiramatsu)
Infrastructure changes:
- Skip running the feature tests for 'make install-doc' (Rui Teng)
- Introduce tools/include/linux/time64.h with *SEC_PER_*SEC macros
to use in all of tools/ (Arnaldo Carvalho de Melo)
- Break down symbol__disassemble() into multiple functions, to ease
future work on better reporting the errors that may take place in
the various steps it performs (possibly decompressing kernel module
files, getting build-id keyed files, calling objdump, parsing its
output, etc) (Arnaldo Carvalho de Melo)
- Typo fixes in various places (Colin Ian King)
- Remove superfluous NULL check in the TUI code (Colin Ian King)
- Allow displaying multiple header lines in the TUI browser, prep
work for the 'perf c2c' browser (Jiri Olsa)
- Copy coresight-pmu.h header file needed by perf tools (Mathieu Poirier)
- Use __weak definition from linux/compiler.h (Rui Teng)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/probe-file.c')
-rw-r--r-- | tools/perf/util/probe-file.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index 9c3b9ed5b3c3..697ef66bff91 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c @@ -877,3 +877,60 @@ int probe_cache__show_all_caches(struct strfilter *filter) return 0; } + +static struct { + const char *pattern; + bool avail; + bool checked; +} probe_type_table[] = { +#define DEFINE_TYPE(idx, pat, def_avail) \ + [idx] = {.pattern = pat, .avail = (def_avail)} + DEFINE_TYPE(PROBE_TYPE_U, "* u8/16/32/64,*", true), + DEFINE_TYPE(PROBE_TYPE_S, "* s8/16/32/64,*", true), + DEFINE_TYPE(PROBE_TYPE_X, "* x8/16/32/64,*", false), + DEFINE_TYPE(PROBE_TYPE_STRING, "* string,*", true), + DEFINE_TYPE(PROBE_TYPE_BITFIELD, + "* b<bit-width>@<bit-offset>/<container-size>", true), +}; + +bool probe_type_is_available(enum probe_type type) +{ + FILE *fp; + char *buf = NULL; + size_t len = 0; + bool target_line = false; + bool ret = probe_type_table[type].avail; + + if (type >= PROBE_TYPE_END) + return false; + /* We don't have to check the type which supported by default */ + if (ret || probe_type_table[type].checked) + return ret; + + if (asprintf(&buf, "%s/README", tracing_path) < 0) + return ret; + + fp = fopen(buf, "r"); + if (!fp) + goto end; + + zfree(&buf); + while (getline(&buf, &len, fp) > 0 && !ret) { + if (!target_line) { + target_line = !!strstr(buf, " type: "); + if (!target_line) + continue; + } else if (strstr(buf, "\t ") != buf) + break; + ret = strglobmatch(buf, probe_type_table[type].pattern); + } + /* Cache the result */ + probe_type_table[type].checked = true; + probe_type_table[type].avail = ret; + + fclose(fp); +end: + free(buf); + + return ret; +} |