summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-02-17 11:39:47 +0100
committerIngo Molnar <mingo@kernel.org>2018-02-17 11:39:47 +0100
commit11737ca9e3b9d84448fa405a80980aa9957bcee8 (patch)
tree33b79a0c5a5c96344fe6f72e3a37104385a90ea7 /tools/lib
parent7057bb975dab827997e0ca9dd92cafef0856b0cc (diff)
parent21316ac6803d4a1aadd74b896db8d60a92cd1140 (diff)
Merge tag 'perf-core-for-mingo-4.17-20180216' 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: - Fix wrong jump arrow in systems with branch records with cycles, i.e. Intel's >= Skylake (Jin Yao) - Fix 'perf record --per-thread' problem introduced when implementing 'perf stat --per-thread (Jin Yao) - Use arch__compare_symbol_names() to fix 'perf test vmlinux', that was using strcmp(symbol names) while the dso routines doing symbol lookups used the arch overridable one, making this test fail in architectures that overrided that function with something other than strcmp() (Jiri Olsa) - Add 'perf script --show-round-event' to display PERF_RECORD_FINISHED_ROUND entries (Jiri Olsa) - Fix dwarf unwind for stripped binaries in 'perf test' (Jiri Olsa) - Use ordered_events for 'perf report --tasks', otherwise we may get artifacts when PERF_RECORD_FORK gets processed before PERF_RECORD_COMM (when they got recorded in different CPUs) (Jiri Olsa) - Add support to display group output for non group events, i.e. now when one uses 'perf report --group' on a perf.data file recorded without explicitly grouping events with {} (e.g. "perf record -e '{cycles,instructions}'" get the same output that would produce, i.e. see all those non-grouped events in multiple columns, at the same time (Jiri Olsa) - Skip non-address kallsyms entries, e.g. '(null)' for !root (Jiri Olsa) - Kernel maps fixes wrt perf.data(report) versus live system (top) (Jiri Olsa) - Fix memory corruption when using 'perf record -j call -g -a <application>' followed by 'perf report --branch-history' (Jiri Olsa) - ARM CoreSight fixes (Mathieu Poirier) - Add inject capability for CoreSight Traces (Robert Waker) - Update documentation for use of 'perf' + ARM CoreSight (Robert Walker) - Man pages fixes (Sangwon Hong, Jaecheol Shin) - Fix some 'perf test' cases on s/390 and x86_64 (some backtraces changed with a glibc update) (Thomas Richter) - Add detailed CPUID info in the 'perf.data' headers for s/390 to then use it in 'perf annotate' (Thomas Richter) - Add '--interval-count N' to 'perf stat', to use with -I, i.e. 'perf stat -I 1000 --interval-count 2' will show stats every 1000ms, two times (yuzhoujian) - Add 'perf stat --timeout Nms', that will run for that many milliseconds and then stop, printing the counters (yuzhoujian) - Fix description for 'perf report --mem-modex (Andi Kleen) - Use a wildcard to remove the vfs_getname probe in the 'perf test' shell based test cases (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/api/fs/fs.c44
-rw-r--r--tools/lib/api/fs/fs.h2
-rw-r--r--tools/lib/symbol/kallsyms.c4
3 files changed, 41 insertions, 9 deletions
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index b24afc0e6e81..6a12bbf39f7b 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -315,12 +315,8 @@ int filename__read_int(const char *filename, int *value)
return err;
}
-/*
- * Parses @value out of @filename with strtoull.
- * By using 0 for base, the strtoull detects the
- * base automatically (see man strtoull).
- */
-int filename__read_ull(const char *filename, unsigned long long *value)
+static int filename__read_ull_base(const char *filename,
+ unsigned long long *value, int base)
{
char line[64];
int fd = open(filename, O_RDONLY), err = -1;
@@ -329,7 +325,7 @@ int filename__read_ull(const char *filename, unsigned long long *value)
return -1;
if (read(fd, line, sizeof(line)) > 0) {
- *value = strtoull(line, NULL, 0);
+ *value = strtoull(line, NULL, base);
if (*value != ULLONG_MAX)
err = 0;
}
@@ -338,6 +334,25 @@ int filename__read_ull(const char *filename, unsigned long long *value)
return err;
}
+/*
+ * Parses @value out of @filename with strtoull.
+ * By using 16 for base to treat the number as hex.
+ */
+int filename__read_xll(const char *filename, unsigned long long *value)
+{
+ return filename__read_ull_base(filename, value, 16);
+}
+
+/*
+ * Parses @value out of @filename with strtoull.
+ * By using 0 for base, the strtoull detects the
+ * base automatically (see man strtoull).
+ */
+int filename__read_ull(const char *filename, unsigned long long *value)
+{
+ return filename__read_ull_base(filename, value, 0);
+}
+
#define STRERR_BUFSIZE 128 /* For the buffer size of strerror_r */
int filename__read_str(const char *filename, char **buf, size_t *sizep)
@@ -417,7 +432,8 @@ int procfs__read_str(const char *entry, char **buf, size_t *sizep)
return filename__read_str(path, buf, sizep);
}
-int sysfs__read_ull(const char *entry, unsigned long long *value)
+static int sysfs__read_ull_base(const char *entry,
+ unsigned long long *value, int base)
{
char path[PATH_MAX];
const char *sysfs = sysfs__mountpoint();
@@ -427,7 +443,17 @@ int sysfs__read_ull(const char *entry, unsigned long long *value)
snprintf(path, sizeof(path), "%s/%s", sysfs, entry);
- return filename__read_ull(path, value);
+ return filename__read_ull_base(path, value, base);
+}
+
+int sysfs__read_xll(const char *entry, unsigned long long *value)
+{
+ return sysfs__read_ull_base(entry, value, 16);
+}
+
+int sysfs__read_ull(const char *entry, unsigned long long *value)
+{
+ return sysfs__read_ull_base(entry, value, 0);
}
int sysfs__read_int(const char *entry, int *value)
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index dda49deefb52..92d03b8396b1 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -30,6 +30,7 @@ FS(bpf_fs)
int filename__read_int(const char *filename, int *value);
int filename__read_ull(const char *filename, unsigned long long *value);
+int filename__read_xll(const char *filename, unsigned long long *value);
int filename__read_str(const char *filename, char **buf, size_t *sizep);
int filename__write_int(const char *filename, int value);
@@ -39,6 +40,7 @@ int procfs__read_str(const char *entry, char **buf, size_t *sizep);
int sysctl__read_int(const char *sysctl, int *value);
int sysfs__read_int(const char *entry, int *value);
int sysfs__read_ull(const char *entry, unsigned long long *value);
+int sysfs__read_xll(const char *entry, unsigned long long *value);
int sysfs__read_str(const char *entry, char **buf, size_t *sizep);
int sysfs__read_bool(const char *entry, bool *value);
diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c
index 914cb8e3d40b..689b6a130dd7 100644
--- a/tools/lib/symbol/kallsyms.c
+++ b/tools/lib/symbol/kallsyms.c
@@ -38,6 +38,10 @@ int kallsyms__parse(const char *filename, void *arg,
len = hex2u64(line, &start);
+ /* Skip the line if we failed to parse the address. */
+ if (!len)
+ continue;
+
len++;
if (len + 2 >= line_len)
continue;