Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1239816 > unrolled thread

[PATCH 0/9] perf tools: Various fixes

Started byJiri Olsa <jolsa@kernel.org>
First post2015-10-05 20:10 +0200
Last post2015-10-06 09:20 +0200
Articles 18 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/9] perf tools: Various fixes Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
    [PATCH 6/9] perf tests: Add parsing test for 'P' modifier Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
      [tip:perf/core] perf tests: Add parsing test for 'P' modifier tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-10-06 09:20 +0200
    [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1 Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
      [tip:perf/core] tools lib api fs: No need to use PATH_MAX + 1 tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-10-06 09:20 +0200
    [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
      Re: [PATCH 5/9] perf tools: Introduce 'P' modifier David Ahern <dsahern@gmail.com> - 2015-10-05 20:20 +0200
        Re: [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa <jolsa@redhat.com> - 2015-10-05 20:40 +0200
          Re: [PATCH 5/9] perf tools: Introduce 'P' modifier Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 21:10 +0200
      Re: [PATCH 5/9] perf tools: Introduce 'P' modifier Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 21:30 +0200
        Re: [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa <jolsa@redhat.com> - 2015-10-06 09:10 +0200
      [tip:perf/core] perf tools: Introduce 'P'   modifier to request max precision tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-10-06 09:20 +0200
    [PATCH 7/9] perf tools: Add support for sorting on the iaddr Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
      [tip:perf/core] perf tools: Add support for sorting on the iaddr tip-bot for Don Zickus <tipbot@zytor.com> - 2015-10-06 09:20 +0200
    [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
      [tip:perf/core] perf tools:   Setup proper width for symbol_iaddr field tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-10-06 09:20 +0200
    [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit Jiri Olsa <jolsa@kernel.org> - 2015-10-05 20:10 +0200
      [tip:perf/core] perf evlist: Display DATA_SRC sample type bit tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-10-06 09:20 +0200

#1239816 — [PATCH 0/9] perf tools: Various fixes

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 0/9] perf tools: Various fixes
Message-ID<qgimZ-6vn-11@gated-at.bofh.it>
hi,
sending various fixes that piled up plus some
I'll need in future patchsets.

thanks,
jirka


---
Don Zickus (1):
      perf tools: Add support for sorting on the iaddr

Jiri Olsa (8):
      tools lib api fs: Do not use PATH_MAX + 1
      perf evlist: Display DATA_SRC sample type bit
      perf annotate: Fix sizeof_sym_hist overflow issue
      perf tools: Make perf_event_attr__set_max_precise_ip global
      perf tools: Introduce 'P' modifier
      perf tests: Add parsing test for 'P' modifier
      perf tools: Setup proper width for symbol_iaddr field
      perf tools: Handle -h and -v options

 tools/lib/api/fs/fs.c                  |  2 +-
 tools/lib/api/fs/tracing_path.c        |  6 +++---
 tools/perf/Documentation/perf-list.txt |  1 +
 tools/perf/Documentation/perf.txt      |  8 ++++++++
 tools/perf/perf.c                      | 14 ++++++++++++++
 tools/perf/tests/parse-events.c        | 16 ++++++++++++++++
 tools/perf/util/annotate.h             |  2 +-
 tools/perf/util/evlist.c               |  2 +-
 tools/perf/util/evlist.h               |  2 ++
 tools/perf/util/evsel.c                |  5 ++++-
 tools/perf/util/evsel.h                |  1 +
 tools/perf/util/hist.c                 | 13 +++++++++++++
 tools/perf/util/hist.h                 |  1 +
 tools/perf/util/parse-events.c         |  8 +++++++-
 tools/perf/util/parse-events.l         |  2 +-
 tools/perf/util/sort.c                 | 37 +++++++++++++++++++++++++++++++++++++
 tools/perf/util/sort.h                 |  1 +
 17 files changed, 112 insertions(+), 9 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1239817 — [PATCH 6/9] perf tests: Add parsing test for 'P' modifier

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 6/9] perf tests: Add parsing test for 'P' modifier
Message-ID<qgin0-6vn-25@gated-at.bofh.it>
In reply to#1239816
We cant test 'P' modifier gets properly parsed, the functionality
test itself is beyond this suite.

Link: http://lkml.kernel.org/n/tip-pa4pmc6mnakmyss5ca2c9yo5@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/parse-events.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3a2ebe666192..0648b84a9171 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1259,6 +1259,17 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
 	return test__checkevent_breakpoint_rw(evlist);
 }
 
+static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
+	TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
+	TEST_ASSERT_VAL("wrong config",
+			PERF_COUNT_SW_TASK_CLOCK == evsel->attr.config);
+	return 0;
+}
+
 static int count_tracepoints(void)
 {
 	struct dirent *events_ent;
@@ -1562,6 +1573,11 @@ static struct evlist_test test__events[] = {
 		.check = test__checkevent_exclude_idle_modifier_1,
 		.id    = 46,
 	},
+	{
+		.name  = "task-clock:P,cycles",
+		.check = test__checkevent_precise_max_modifier,
+		.id    = 47,
+	},
 };
 
 static struct evlist_test test__events_pmu[] = {
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240191 — [tip:perf/core] perf tests: Add parsing test for 'P' modifier

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2015-10-06 09:20 +0200
Subject[tip:perf/core] perf tests: Add parsing test for 'P' modifier
Message-ID<qguHx-7x1-37@gated-at.bofh.it>
In reply to#1239817
Commit-ID:  ddd83c9717ef8204f17cc63d6dcb5053d472caee
Gitweb:     http://git.kernel.org/tip/ddd83c9717ef8204f17cc63d6dcb5053d472caee
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:06 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:22:15 -0300

perf tests: Add parsing test for 'P' modifier

We cant test 'P' modifier gets properly parsed, the functionality test
itself is beyond this suite.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/parse-events.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3a2ebe6..0648b84 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1259,6 +1259,17 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
 	return test__checkevent_breakpoint_rw(evlist);
 }
 
+static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
+	TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
+	TEST_ASSERT_VAL("wrong config",
+			PERF_COUNT_SW_TASK_CLOCK == evsel->attr.config);
+	return 0;
+}
+
 static int count_tracepoints(void)
 {
 	struct dirent *events_ent;
@@ -1562,6 +1573,11 @@ static struct evlist_test test__events[] = {
 		.check = test__checkevent_exclude_idle_modifier_1,
 		.id    = 46,
 	},
+	{
+		.name  = "task-clock:P,cycles",
+		.check = test__checkevent_precise_max_modifier,
+		.id    = 47,
+	},
 };
 
 static struct evlist_test test__events_pmu[] = {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239821 — [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1
Message-ID<qgin0-6vn-29@gated-at.bofh.it>
In reply to#1239816
Because there's no point, PATH_MAX is big enough.

Link: http://lkml.kernel.org/n/tip-buqiaesupmk2rusc6y2prtp9@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/api/fs/fs.c           | 2 +-
 tools/lib/api/fs/tracing_path.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 732dbef588b0..459599d1b6c4 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -69,7 +69,7 @@ static const char * const tracefs__known_mountpoints[] = {
 struct fs {
 	const char		*name;
 	const char * const	*mounts;
-	char			 path[PATH_MAX + 1];
+	char			 path[PATH_MAX];
 	bool			 found;
 	long			 magic;
 };
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 0406a7d5c891..a26bb5ea8283 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -12,9 +12,9 @@
 #include "tracing_path.h"
 
 
-char tracing_mnt[PATH_MAX + 1]         = "/sys/kernel/debug";
-char tracing_path[PATH_MAX + 1]        = "/sys/kernel/debug/tracing";
-char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+char tracing_mnt[PATH_MAX]         = "/sys/kernel/debug";
+char tracing_path[PATH_MAX]        = "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
 
 
 static void __tracing_path_set(const char *tracing, const char *mountpoint)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240184 — [tip:perf/core] tools lib api fs: No need to use PATH_MAX + 1

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2015-10-06 09:20 +0200
Subject[tip:perf/core] tools lib api fs: No need to use PATH_MAX + 1
Message-ID<qguHw-7x1-17@gated-at.bofh.it>
In reply to#1239821
Commit-ID:  ccb5597f9ba11b67b8aa8c6f4682675eceee0e21
Gitweb:     http://git.kernel.org/tip/ccb5597f9ba11b67b8aa8c6f4682675eceee0e21
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:01 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:12:09 -0300

tools lib api fs: No need to use PATH_MAX + 1

Because there's no point, PATH_MAX is big enough.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fs/fs.c           | 2 +-
 tools/lib/api/fs/tracing_path.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 732dbef5..459599d 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -69,7 +69,7 @@ static const char * const tracefs__known_mountpoints[] = {
 struct fs {
 	const char		*name;
 	const char * const	*mounts;
-	char			 path[PATH_MAX + 1];
+	char			 path[PATH_MAX];
 	bool			 found;
 	long			 magic;
 };
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 0406a7d..a26bb5e 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -12,9 +12,9 @@
 #include "tracing_path.h"
 
 
-char tracing_mnt[PATH_MAX + 1]         = "/sys/kernel/debug";
-char tracing_path[PATH_MAX + 1]        = "/sys/kernel/debug/tracing";
-char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+char tracing_mnt[PATH_MAX]         = "/sys/kernel/debug";
+char tracing_path[PATH_MAX]        = "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
 
 
 static void __tracing_path_set(const char *tracing, const char *mountpoint)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239822 — [PATCH 5/9] perf tools: Introduce 'P' modifier

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 5/9] perf tools: Introduce 'P' modifier
Message-ID<qgin0-6vn-39@gated-at.bofh.it>
In reply to#1239816
The 'P' will cause the event to get maximum possible
detected precise level.

Following record:
  $ perf record -e cycles:P ...

will detect maximum precise level for 'cycles' event
and use it.

Link: http://lkml.kernel.org/n/tip-e33mfvu5mhuowie0l11fwllz@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/Documentation/perf-list.txt | 1 +
 tools/perf/util/evsel.c                | 3 +++
 tools/perf/util/evsel.h                | 1 +
 tools/perf/util/parse-events.c         | 8 +++++++-
 tools/perf/util/parse-events.l         | 2 +-
 5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index ad60c6ea1997..79483f40e991 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -30,6 +30,7 @@ counted. The following modifiers exist:
  G - guest counting (in KVM guests)
  H - host counting (not in KVM guests)
  p - precise level
+ P - use maximum detected precise level
  S - read sample value (PERF_SAMPLE_READ)
  D - pin the event to the PMU
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 0b1c289da36d..8be867ccefe9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -882,6 +882,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
 		attr->clockid = opts->clockid;
 	}
 
+	if (evsel->precise_max)
+		perf_event_attr__set_max_precise_ip(attr);
+
 	/*
 	 * Apply event specific term settings,
 	 * it overloads any global configuration.
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 7906666580da..02a5fed8d924 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -111,6 +111,7 @@ struct perf_evsel {
 	bool			system_wide;
 	bool			tracking;
 	bool			per_pkg;
+	bool			precise_max;
 	/* parse modifier helper */
 	int			exclude_GH;
 	int			nr_members;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5d0cfce2599b..3ed8bf175163 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -923,6 +923,7 @@ struct event_modifier {
 	int eG;
 	int eI;
 	int precise;
+	int precise_max;
 	int exclude_GH;
 	int sample_read;
 	int pinned;
@@ -938,6 +939,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 	int eG = evsel ? evsel->attr.exclude_guest : 0;
 	int eI = evsel ? evsel->attr.exclude_idle : 0;
 	int precise = evsel ? evsel->attr.precise_ip : 0;
+	int precise_max = 0;
 	int sample_read = 0;
 	int pinned = evsel ? evsel->attr.pinned : 0;
 
@@ -974,6 +976,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 			/* use of precise requires exclude_guest */
 			if (!exclude_GH)
 				eG = 1;
+		} else if (*str == 'P') {
+			precise_max = 1;
 		} else if (*str == 'S') {
 			sample_read = 1;
 		} else if (*str == 'D') {
@@ -1004,6 +1008,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 	mod->eG = eG;
 	mod->eI = eI;
 	mod->precise = precise;
+	mod->precise_max = precise_max;
 	mod->exclude_GH = exclude_GH;
 	mod->sample_read = sample_read;
 	mod->pinned = pinned;
@@ -1020,7 +1025,7 @@ static int check_modifier(char *str)
 	char *p = str;
 
 	/* The sizeof includes 0 byte as well. */
-	if (strlen(str) > (sizeof("ukhGHpppSDI") - 1))
+	if (strlen(str) > (sizeof("ukhGHpppPSDI") - 1))
 		return -1;
 
 	while (*p) {
@@ -1059,6 +1064,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
 		evsel->attr.exclude_idle   = mod.eI;
 		evsel->exclude_GH          = mod.exclude_GH;
 		evsel->sample_read         = mod.sample_read;
+		evsel->precise_max         = mod.precise_max;
 
 		if (perf_evsel__is_group_leader(evsel))
 			evsel->attr.pinned = mod.pinned;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c29832bce496..be244573a02e 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -122,7 +122,7 @@ num_raw_hex	[a-fA-F0-9]+
 name		[a-zA-Z_*?][a-zA-Z0-9_*?.]*
 name_minus	[a-zA-Z_*?][a-zA-Z0-9\-_*?.]*
 /* If you add a modifier you need to update check_modifier() */
-modifier_event	[ukhpGHSDI]+
+modifier_event	[ukhpPGHSDI]+
 modifier_bp	[rwx]{1,3}
 
 %%
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239827 — Re: [PATCH 5/9] perf tools: Introduce 'P' modifier

FromDavid Ahern <dsahern@gmail.com>
Date2015-10-05 20:20 +0200
SubjectRe: [PATCH 5/9] perf tools: Introduce 'P' modifier
Message-ID<qgiwG-6GP-17@gated-at.bofh.it>
In reply to#1239822
On 10/5/15 12:06 PM, Jiri Olsa wrote:
> The 'P' will cause the event to get maximum possible
> detected precise level.
>
> Following record:
>    $ perf record -e cycles:P ...
>
> will detect maximum precise level for 'cycles' event
> and use it.
>

Does the end result (which precise level is used) get saved to the 
header and displayed to the user properly?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239836 — Re: [PATCH 5/9] perf tools: Introduce 'P' modifier

FromJiri Olsa <jolsa@redhat.com>
Date2015-10-05 20:40 +0200
SubjectRe: [PATCH 5/9] perf tools: Introduce 'P' modifier
Message-ID<qgiQ2-735-19@gated-at.bofh.it>
In reply to#1239827
On Mon, Oct 05, 2015 at 12:13:48PM -0600, David Ahern wrote:
> On 10/5/15 12:06 PM, Jiri Olsa wrote:
> >The 'P' will cause the event to get maximum possible
> >detected precise level.
> >
> >Following record:
> >   $ perf record -e cycles:P ...
> >
> >will detect maximum precise level for 'cycles' event
> >and use it.
> >
> 
> Does the end result (which precise level is used) get saved to the header
> and displayed to the user properly?

yep..

[jolsa@krava perf]$ ./perf record -e cycles:P ls

...

[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.014 MB perf.data (8 samples) ]
[jolsa@krava perf]$ ./perf evlist
cycles:P
[jolsa@krava perf]$ ./perf evlist -v
cycles:P: size: 112, ...  precise_ip: 2  ...

[jolsa@krava perf]$ ./perf report --stdio
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 8  of event 'cycles:P'
# Event count (approx.): 4270406
#
# Overhead  Command  Shared Object     Symbol                    
...


jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239851 — Re: [PATCH 5/9] perf tools: Introduce 'P' modifier

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-10-05 21:10 +0200
SubjectRe: [PATCH 5/9] perf tools: Introduce 'P' modifier
Message-ID<qgjj4-7QJ-19@gated-at.bofh.it>
In reply to#1239836
Em Mon, Oct 05, 2015 at 08:38:06PM +0200, Jiri Olsa escreveu:
> On Mon, Oct 05, 2015 at 12:13:48PM -0600, David Ahern wrote:
> > On 10/5/15 12:06 PM, Jiri Olsa wrote:
> > >The 'P' will cause the event to get maximum possible detected precise
> > >level.

> > >Following record:
> > >   $ perf record -e cycles:P ...

> > >will detect maximum precise level for 'cycles' event
> > >and use it.

> > Does the end result (which precise level is used) get saved to the header
> > and displayed to the user properly?

> yep..
 
> [jolsa@krava perf]$ ./perf record -e cycles:P ls
 
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.014 MB perf.data (8 samples) ]
> [jolsa@krava perf]$ ./perf evlist
> cycles:P
> [jolsa@krava perf]$ ./perf evlist -v
> cycles:P: size: 112, ...  precise_ip: 2  ...

[root@zoo ~]# perf record usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.016 MB perf.data (12 samples) ]
[root@zoo ~]# perf evlist
cycles:pp
[root@zoo ~]# perf evlist -v
cycles:pp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 2, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
[root@zoo ~]#

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239864 — Re: [PATCH 5/9] perf tools: Introduce 'P' modifier

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-10-05 21:30 +0200
SubjectRe: [PATCH 5/9] perf tools: Introduce 'P' modifier
Message-ID<qgjCq-8dv-21@gated-at.bofh.it>
In reply to#1239822
Em Mon, Oct 05, 2015 at 08:06:05PM +0200, Jiri Olsa escreveu:
> The 'P' will cause the event to get maximum possible
> detected precise level.
> 
> Following record:
>   $ perf record -e cycles:P ...
> 
> will detect maximum precise level for 'cycles' event
> and use it.

I had to do a 'make -C tools/perf clean' to get this to work, i.e. it is
not noticing that the parser files were changed and thus need to run
again, can you please take a look?

Thanks,

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240176 — Re: [PATCH 5/9] perf tools: Introduce 'P' modifier

FromJiri Olsa <jolsa@redhat.com>
Date2015-10-06 09:10 +0200
SubjectRe: [PATCH 5/9] perf tools: Introduce 'P' modifier
Message-ID<qguxQ-7kY-27@gated-at.bofh.it>
In reply to#1239864
On Mon, Oct 05, 2015 at 04:20:40PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Oct 05, 2015 at 08:06:05PM +0200, Jiri Olsa escreveu:
> > The 'P' will cause the event to get maximum possible
> > detected precise level.
> > 
> > Following record:
> >   $ perf record -e cycles:P ...
> > 
> > will detect maximum precise level for 'cycles' event
> > and use it.
> 
> I had to do a 'make -C tools/perf clean' to get this to work, i.e. it is
> not noticing that the parser files were changed and thus need to run
> again, can you please take a look?

can't see that:

[jolsa@krava perf]$ make
  BUILD:   Doing 'make -j4' parallel build
  CC       util/parse-events.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
  LINK     libperf-gtk.so
[jolsa@krava perf]$ touch util/parse-events.l 
[jolsa@krava perf]$ make
  BUILD:   Doing 'make -j4' parallel build
  FLEX     util/parse-events-flex.c
  CC       util/parse-events-flex.o
  CC       util/parse-events.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
  LINK     libperf-gtk.so
[jolsa@krava perf]$ touch util/parse-events.y 
[jolsa@krava perf]$ make
  BUILD:   Doing 'make -j4' parallel build
  BISON    util/parse-events-bison.c
  FLEX     util/parse-events-flex.c
  CC       util/parse-events-bison.o
  CC       util/parse-events.o
  CC       util/parse-events-flex.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
  LINK     libperf-gtk.so
[jolsa@krava linux-perf]$ make -C tools/perf
make: Entering directory '/home/jolsa/kernel/linux-perf/tools/perf'
  BUILD:   Doing 'make -j4' parallel build
  CC       util/parse-events.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
  LINK     libperf-gtk.so
make: Leaving directory '/home/jolsa/kernel/linux-perf/tools/perf'
[jolsa@krava linux-perf]$ make -C tools/perf
make: Entering directory '/home/jolsa/kernel/linux-perf/tools/perf'
  BUILD:   Doing 'make -j4' parallel build
  BISON    util/parse-events-bison.c
  FLEX     util/parse-events-flex.c
  CC       util/parse-events-bison.o
  CC       util/parse-events.o
  CC       util/parse-events-flex.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
  LINK     libperf-gtk.so
make: Leaving directory '/home/jolsa/kernel/linux-perf/tools/perf'
[jolsa@krava linux-perf]$ make -C tools/perf
make: Entering directory '/home/jolsa/kernel/linux-perf/tools/perf'
  BUILD:   Doing 'make -j4' parallel build
  FLEX     util/parse-events-flex.c
  CC       util/parse-events-flex.o
  CC       util/parse-events.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
  LINK     libperf-gtk.so
make: Leaving directory '/home/jolsa/kernel/linux-perf/tools/perf'


jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240187 — [tip:perf/core] perf tools: Introduce 'P' modifier to request max precision

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2015-10-06 09:20 +0200
Subject[tip:perf/core] perf tools: Introduce 'P' modifier to request max precision
Message-ID<qguHx-7x1-29@gated-at.bofh.it>
In reply to#1239822
Commit-ID:  7f94af7a489fada17d28cc60e8f4409ce216bd6d
Gitweb:     http://git.kernel.org/tip/7f94af7a489fada17d28cc60e8f4409ce216bd6d
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:05 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:21:11 -0300

perf tools: Introduce 'P' modifier to request max precision

The 'P' will cause the event to get maximum possible detected precise
level.

Following record:
  $ perf record -e cycles:P ...

will detect maximum precise level for 'cycles' event and use it.

Commiter note:

Testing it:

  $ perf record -e cycles:P usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.013 MB perf.data (9 samples) ]
  $ perf evlist
  cycles:P
  $ perf evlist -v
  cycles:P: size: 112, { sample_period, sample_freq }: 4000, sample_type:
  IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1,
  enable_on_exec: 1, task: 1, precise_ip: 2, sample_id_all: 1, mmap2: 1,
  comm_exec: 1
  $

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-list.txt | 1 +
 tools/perf/util/evsel.c                | 3 +++
 tools/perf/util/evsel.h                | 1 +
 tools/perf/util/parse-events.c         | 8 +++++++-
 tools/perf/util/parse-events.l         | 2 +-
 5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index ad60c6e..79483f4 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -30,6 +30,7 @@ counted. The following modifiers exist:
  G - guest counting (in KVM guests)
  H - host counting (not in KVM guests)
  p - precise level
+ P - use maximum detected precise level
  S - read sample value (PERF_SAMPLE_READ)
  D - pin the event to the PMU
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 0b1c289..8be867c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -882,6 +882,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
 		attr->clockid = opts->clockid;
 	}
 
+	if (evsel->precise_max)
+		perf_event_attr__set_max_precise_ip(attr);
+
 	/*
 	 * Apply event specific term settings,
 	 * it overloads any global configuration.
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 7906666..02a5fed 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -111,6 +111,7 @@ struct perf_evsel {
 	bool			system_wide;
 	bool			tracking;
 	bool			per_pkg;
+	bool			precise_max;
 	/* parse modifier helper */
 	int			exclude_GH;
 	int			nr_members;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5d0cfce..3ed8bf1 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -923,6 +923,7 @@ struct event_modifier {
 	int eG;
 	int eI;
 	int precise;
+	int precise_max;
 	int exclude_GH;
 	int sample_read;
 	int pinned;
@@ -938,6 +939,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 	int eG = evsel ? evsel->attr.exclude_guest : 0;
 	int eI = evsel ? evsel->attr.exclude_idle : 0;
 	int precise = evsel ? evsel->attr.precise_ip : 0;
+	int precise_max = 0;
 	int sample_read = 0;
 	int pinned = evsel ? evsel->attr.pinned : 0;
 
@@ -974,6 +976,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 			/* use of precise requires exclude_guest */
 			if (!exclude_GH)
 				eG = 1;
+		} else if (*str == 'P') {
+			precise_max = 1;
 		} else if (*str == 'S') {
 			sample_read = 1;
 		} else if (*str == 'D') {
@@ -1004,6 +1008,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 	mod->eG = eG;
 	mod->eI = eI;
 	mod->precise = precise;
+	mod->precise_max = precise_max;
 	mod->exclude_GH = exclude_GH;
 	mod->sample_read = sample_read;
 	mod->pinned = pinned;
@@ -1020,7 +1025,7 @@ static int check_modifier(char *str)
 	char *p = str;
 
 	/* The sizeof includes 0 byte as well. */
-	if (strlen(str) > (sizeof("ukhGHpppSDI") - 1))
+	if (strlen(str) > (sizeof("ukhGHpppPSDI") - 1))
 		return -1;
 
 	while (*p) {
@@ -1059,6 +1064,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
 		evsel->attr.exclude_idle   = mod.eI;
 		evsel->exclude_GH          = mod.exclude_GH;
 		evsel->sample_read         = mod.sample_read;
+		evsel->precise_max         = mod.precise_max;
 
 		if (perf_evsel__is_group_leader(evsel))
 			evsel->attr.pinned = mod.pinned;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c29832b..be24457 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -122,7 +122,7 @@ num_raw_hex	[a-fA-F0-9]+
 name		[a-zA-Z_*?][a-zA-Z0-9_*?.]*
 name_minus	[a-zA-Z_*?][a-zA-Z0-9\-_*?.]*
 /* If you add a modifier you need to update check_modifier() */
-modifier_event	[ukhpGHSDI]+
+modifier_event	[ukhpPGHSDI]+
 modifier_bp	[rwx]{1,3}
 
 %%
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239823 — [PATCH 7/9] perf tools: Add support for sorting on the iaddr

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 7/9] perf tools: Add support for sorting on the iaddr
Message-ID<qgin0-6vn-41@gated-at.bofh.it>
In reply to#1239816
From: Don Zickus <dzickus@redhat.com>

Sorting on 'symbol' gives to broad a resolution as it can cover a
range of IP address.  Use the iaddr instead to get proper sorting on
IP addresses.  Need to use the 'mem_sort' feature of perf record.

New sort option is: symbol_iaddr, header label is 'Code Symbol'.

  $ perf mem report --stdio -F +symbol_iaddr
  # Overhead       Samples  Code Symbol              Local Weight
  # ........  ............  ........................ ............
  #
      54.08%             1  [k] nmi_handle           192
       4.51%             1  [k] finish_task_switch   16
       3.66%             1  [.] malloc               13
       3.10%             1  [.] __strcoll_l          11

Signed-off-by: Don Zickus <dzickus@redhat.com>
Link: http://lkml.kernel.org/n/tip-94rmgtp0lvpkc7xmb9bmrjxm@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/hist.h |  1 +
 tools/perf/util/sort.c | 37 +++++++++++++++++++++++++++++++++++++
 tools/perf/util/sort.h |  1 +
 3 files changed, 39 insertions(+)

diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8c20a8f6b214..a48a2078d288 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -49,6 +49,7 @@ enum hist_column {
 	HISTC_MEM_LVL,
 	HISTC_MEM_SNOOP,
 	HISTC_MEM_DCACHELINE,
+	HISTC_MEM_IADDR_SYMBOL,
 	HISTC_TRANSACTION,
 	HISTC_CYCLES,
 	HISTC_NR_COLS, /* Last entry */
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 6b9556d298c9..ee94b728fca4 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -655,6 +655,35 @@ static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf,
 }
 
 static int64_t
+sort__iaddr_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	uint64_t l = 0, r = 0;
+
+	if (left->mem_info)
+		l = left->mem_info->iaddr.addr;
+	if (right->mem_info)
+		r = right->mem_info->iaddr.addr;
+
+	return (int64_t)(r - l);
+}
+
+static int hist_entry__iaddr_snprintf(struct hist_entry *he, char *bf,
+				    size_t size, unsigned int width)
+{
+	uint64_t addr = 0;
+	struct map *map = NULL;
+	struct symbol *sym = NULL;
+
+	if (he->mem_info) {
+		addr = he->mem_info->iaddr.addr;
+		map  = he->mem_info->iaddr.map;
+		sym  = he->mem_info->iaddr.sym;
+	}
+	return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
+					 width);
+}
+
+static int64_t
 sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
 {
 	struct map *map_l = NULL;
@@ -1077,6 +1106,13 @@ struct sort_entry sort_mem_daddr_sym = {
 	.se_width_idx	= HISTC_MEM_DADDR_SYMBOL,
 };
 
+struct sort_entry sort_mem_iaddr_sym = {
+	.se_header	= "Code Symbol",
+	.se_cmp		= sort__iaddr_cmp,
+	.se_snprintf	= hist_entry__iaddr_snprintf,
+	.se_width_idx	= HISTC_MEM_IADDR_SYMBOL,
+};
+
 struct sort_entry sort_mem_daddr_dso = {
 	.se_header	= "Data Object",
 	.se_cmp		= sort__dso_daddr_cmp,
@@ -1299,6 +1335,7 @@ static struct sort_dimension bstack_sort_dimensions[] = {
 
 static struct sort_dimension memory_sort_dimensions[] = {
 	DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
+	DIM(SORT_MEM_IADDR_SYMBOL, "symbol_iaddr", sort_mem_iaddr_sym),
 	DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
 	DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
 	DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb),
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c06b75746613..33b3d30e18d3 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -201,6 +201,7 @@ enum sort_type {
 	SORT_MEM_LVL,
 	SORT_MEM_SNOOP,
 	SORT_MEM_DCACHELINE,
+	SORT_MEM_IADDR_SYMBOL,
 };
 
 /*
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240181 — [tip:perf/core] perf tools: Add support for sorting on the iaddr

Fromtip-bot for Don Zickus <tipbot@zytor.com>
Date2015-10-06 09:20 +0200
Subject[tip:perf/core] perf tools: Add support for sorting on the iaddr
Message-ID<qguHw-7x1-11@gated-at.bofh.it>
In reply to#1239823
Commit-ID:  28e6db205b3ed3f1d86a00c69b3304190377da5f
Gitweb:     http://git.kernel.org/tip/28e6db205b3ed3f1d86a00c69b3304190377da5f
Author:     Don Zickus <dzickus@redhat.com>
AuthorDate: Mon, 5 Oct 2015 20:06:07 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:32:00 -0300

perf tools: Add support for sorting on the iaddr

Sorting on 'symbol' gives to broad a resolution as it can cover a range
of IP address.  Use the iaddr instead to get proper sorting on IP
addresses.  Need to use the 'mem_sort' feature of perf record.

New sort option is: symbol_iaddr, header label is 'Code Symbol'.

  $ perf mem report --stdio -F +symbol_iaddr
  # Overhead       Samples  Code Symbol              Local Weight
  # ........  ............  ........................ ............
  #
      54.08%             1  [k] nmi_handle           192
       4.51%             1  [k] finish_task_switch   16
       3.66%             1  [.] malloc               13
       3.10%             1  [.] __strcoll_l          11

Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-8-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.h |  1 +
 tools/perf/util/sort.c | 37 +++++++++++++++++++++++++++++++++++++
 tools/perf/util/sort.h |  1 +
 3 files changed, 39 insertions(+)

diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8c20a8f..a48a207 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -49,6 +49,7 @@ enum hist_column {
 	HISTC_MEM_LVL,
 	HISTC_MEM_SNOOP,
 	HISTC_MEM_DCACHELINE,
+	HISTC_MEM_IADDR_SYMBOL,
 	HISTC_TRANSACTION,
 	HISTC_CYCLES,
 	HISTC_NR_COLS, /* Last entry */
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 6b9556d..ee94b72 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -655,6 +655,35 @@ static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf,
 }
 
 static int64_t
+sort__iaddr_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	uint64_t l = 0, r = 0;
+
+	if (left->mem_info)
+		l = left->mem_info->iaddr.addr;
+	if (right->mem_info)
+		r = right->mem_info->iaddr.addr;
+
+	return (int64_t)(r - l);
+}
+
+static int hist_entry__iaddr_snprintf(struct hist_entry *he, char *bf,
+				    size_t size, unsigned int width)
+{
+	uint64_t addr = 0;
+	struct map *map = NULL;
+	struct symbol *sym = NULL;
+
+	if (he->mem_info) {
+		addr = he->mem_info->iaddr.addr;
+		map  = he->mem_info->iaddr.map;
+		sym  = he->mem_info->iaddr.sym;
+	}
+	return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
+					 width);
+}
+
+static int64_t
 sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
 {
 	struct map *map_l = NULL;
@@ -1077,6 +1106,13 @@ struct sort_entry sort_mem_daddr_sym = {
 	.se_width_idx	= HISTC_MEM_DADDR_SYMBOL,
 };
 
+struct sort_entry sort_mem_iaddr_sym = {
+	.se_header	= "Code Symbol",
+	.se_cmp		= sort__iaddr_cmp,
+	.se_snprintf	= hist_entry__iaddr_snprintf,
+	.se_width_idx	= HISTC_MEM_IADDR_SYMBOL,
+};
+
 struct sort_entry sort_mem_daddr_dso = {
 	.se_header	= "Data Object",
 	.se_cmp		= sort__dso_daddr_cmp,
@@ -1299,6 +1335,7 @@ static struct sort_dimension bstack_sort_dimensions[] = {
 
 static struct sort_dimension memory_sort_dimensions[] = {
 	DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
+	DIM(SORT_MEM_IADDR_SYMBOL, "symbol_iaddr", sort_mem_iaddr_sym),
 	DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
 	DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
 	DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb),
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c06b757..33b3d30 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -201,6 +201,7 @@ enum sort_type {
 	SORT_MEM_LVL,
 	SORT_MEM_SNOOP,
 	SORT_MEM_DCACHELINE,
+	SORT_MEM_IADDR_SYMBOL,
 };
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239825 — [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field
Message-ID<qgin1-6vn-47@gated-at.bofh.it>
In reply to#1239816
We need to properly initialize column width for symbol_iaddr
field, so all symbols could fit in the column.

Link: http://lkml.kernel.org/n/tip-hxo2kaxr49stt5ebukntrs3v@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/hist.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index c346b331b892..4fd37d6708cb 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -132,6 +132,18 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 			hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
 					   symlen);
 		}
+
+		if (h->mem_info->iaddr.sym) {
+			symlen = (int)h->mem_info->iaddr.sym->namelen + 4
+			       + unresolved_col_width + 2;
+			hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+					   symlen);
+		} else {
+			symlen = unresolved_col_width + 4 + 2;
+			hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+					   symlen);
+		}
+
 		if (h->mem_info->daddr.map) {
 			symlen = dso__name_len(h->mem_info->daddr.map->dso);
 			hists__new_col_len(hists, HISTC_MEM_DADDR_DSO,
@@ -143,6 +155,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 	} else {
 		symlen = unresolved_col_width + 4 + 2;
 		hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen);
+		hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, symlen);
 		hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
 	}
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240190 — [tip:perf/core] perf tools: Setup proper width for symbol_iaddr field

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2015-10-06 09:20 +0200
Subject[tip:perf/core] perf tools: Setup proper width for symbol_iaddr field
Message-ID<qguHx-7x1-35@gated-at.bofh.it>
In reply to#1239825
Commit-ID:  b34b3bf0798633cc248b682f5b4f6509739ce234
Gitweb:     http://git.kernel.org/tip/b34b3bf0798633cc248b682f5b4f6509739ce234
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:08 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:33:41 -0300

perf tools: Setup proper width for symbol_iaddr field

We need to properly initialize column width for symbol_iaddr field, so
all symbols could fit in the column.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-9-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index c346b33..4fd37d6 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -132,6 +132,18 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 			hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
 					   symlen);
 		}
+
+		if (h->mem_info->iaddr.sym) {
+			symlen = (int)h->mem_info->iaddr.sym->namelen + 4
+			       + unresolved_col_width + 2;
+			hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+					   symlen);
+		} else {
+			symlen = unresolved_col_width + 4 + 2;
+			hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+					   symlen);
+		}
+
 		if (h->mem_info->daddr.map) {
 			symlen = dso__name_len(h->mem_info->daddr.map->dso);
 			hists__new_col_len(hists, HISTC_MEM_DADDR_DSO,
@@ -143,6 +155,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 	} else {
 		symlen = unresolved_col_width + 4 + 2;
 		hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen);
+		hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, symlen);
 		hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239826 — [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit

FromJiri Olsa <jolsa@kernel.org>
Date2015-10-05 20:10 +0200
Subject[PATCH 2/9] perf evlist: Display DATA_SRC sample type bit
Message-ID<qgin2-6vn-51@gated-at.bofh.it>
In reply to#1239816
Adding DATA_SRC bit_name call to display sample_type properly.

   $ perf evlist -v
   cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|DATA_SRC, ...

Link: http://lkml.kernel.org/n/tip-2ylb25ew433nju1nyb21hwnc@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/evsel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 58890044d835..0b1c289da36d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1178,7 +1178,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
 		bit_name(READ), bit_name(CALLCHAIN), bit_name(ID), bit_name(CPU),
 		bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
 		bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
-		bit_name(IDENTIFIER), bit_name(REGS_INTR),
+		bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
 		{ .name = NULL, }
 	};
 #undef bit_name
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240195 — [tip:perf/core] perf evlist: Display DATA_SRC sample type bit

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2015-10-06 09:20 +0200
Subject[tip:perf/core] perf evlist: Display DATA_SRC sample type bit
Message-ID<qguHx-7x1-43@gated-at.bofh.it>
In reply to#1239826
Commit-ID:  84422592e58f6f1ea03688fcf92143bbc095fa88
Gitweb:     http://git.kernel.org/tip/84422592e58f6f1ea03688fcf92143bbc095fa88
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:02 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:15:10 -0300

perf evlist: Display DATA_SRC sample type bit

Adding DATA_SRC bit_name call to display sample_type properly.

   $ perf evlist -v
   cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|DATA_SRC, ...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 5889004..0b1c289 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1178,7 +1178,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
 		bit_name(READ), bit_name(CALLCHAIN), bit_name(ID), bit_name(CPU),
 		bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
 		bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
-		bit_name(IDENTIFIER), bit_name(REGS_INTR),
+		bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
 		{ .name = NULL, }
 	};
 #undef bit_name
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web