Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1344865 > unrolled thread
| Started by | Andi Kleen <andi@firstfloor.org> |
|---|---|
| First post | 2016-02-27 01:30 +0100 |
| Last post | 2016-02-29 15:50 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/6] perf, tools, stat: Check existence of frontend/backed stalled cycles Andi Kleen <andi@firstfloor.org> - 2016-02-27 01:30 +0100
Re: [PATCH 1/6] perf, tools, stat: Check existence of frontend/backed stalled cycles Jiri Olsa <jolsa@redhat.com> - 2016-02-29 11:20 +0100
Re: [PATCH 1/6] perf, tools, stat: Check existence of frontend/backed stalled cycles Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 15:50 +0100
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Date | 2016-02-27 01:30 +0100 |
| Subject | [PATCH 1/6] perf, tools, stat: Check existence of frontend/backed stalled cycles |
| Message-ID | <r6AVI-2Yh-15@gated-at.bofh.it> |
From: Andi Kleen <ak@linux.intel.com>
Only put the frontend/backend stalled cycles into the default
perf stat events when the CPU actually supports them.
This avoids empty columns with --metric-only on newer Intel CPUs.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/builtin-stat.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8c0bc0f..24f222d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1441,7 +1441,7 @@ static int perf_stat_init_aggr_mode_file(struct perf_stat *st)
*/
static int add_default_attributes(void)
{
- struct perf_event_attr default_attrs[] = {
+ struct perf_event_attr default_attrs0[] = {
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK },
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES },
@@ -1449,8 +1449,14 @@ static int add_default_attributes(void)
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
+};
+ struct perf_event_attr frontend_attrs[] = {
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },
+};
+ struct perf_event_attr backend_attrs[] = {
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND },
+};
+ struct perf_event_attr default_attrs1[] = {
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES },
@@ -1567,7 +1573,19 @@ static int add_default_attributes(void)
}
if (!evsel_list->nr_entries) {
- if (perf_evlist__add_default_attrs(evsel_list, default_attrs) < 0)
+ if (perf_evlist__add_default_attrs(evsel_list, default_attrs0) < 0)
+ return -1;
+ if (pmu_have_event("cpu", "stalled-cycles-frontend")) {
+ if (perf_evlist__add_default_attrs(evsel_list,
+ frontend_attrs) < 0)
+ return -1;
+ }
+ if (pmu_have_event("cpu", "stalled-cycles-backend")) {
+ if (perf_evlist__add_default_attrs(evsel_list,
+ backend_attrs) < 0)
+ return -1;
+ }
+ if (perf_evlist__add_default_attrs(evsel_list, default_attrs1) < 0)
return -1;
}
--
2.5.0
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-02-29 11:20 +0100 |
| Subject | Re: [PATCH 1/6] perf, tools, stat: Check existence of frontend/backed stalled cycles |
| Message-ID | <r7t5M-1ES-17@gated-at.bofh.it> |
| In reply to | #1344865 |
On Fri, Feb 26, 2016 at 04:27:56PM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Only put the frontend/backend stalled cycles into the default
> perf stat events when the CPU actually supports them.
>
> This avoids empty columns with --metric-only on newer Intel CPUs.
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> tools/perf/builtin-stat.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 8c0bc0f..24f222d 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -1441,7 +1441,7 @@ static int perf_stat_init_aggr_mode_file(struct perf_stat *st)
> */
> static int add_default_attributes(void)
> {
> - struct perf_event_attr default_attrs[] = {
> + struct perf_event_attr default_attrs0[] = {
>
> { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK },
> { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES },
> @@ -1449,8 +1449,14 @@ static int add_default_attributes(void)
> { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
>
> { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
> +};
> + struct perf_event_attr frontend_attrs[] = {
> { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },
> +};
> + struct perf_event_attr backend_attrs[] = {
> { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND },
> +};
> + struct perf_event_attr default_attrs1[] = {
> { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
> { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
> { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES },
> @@ -1567,7 +1573,19 @@ static int add_default_attributes(void)
> }
>
> if (!evsel_list->nr_entries) {
> - if (perf_evlist__add_default_attrs(evsel_list, default_attrs) < 0)
> + if (perf_evlist__add_default_attrs(evsel_list, default_attrs0) < 0)
> + return -1;
> + if (pmu_have_event("cpu", "stalled-cycles-frontend")) {
> + if (perf_evlist__add_default_attrs(evsel_list,
> + frontend_attrs) < 0)
> + return -1;
> + }
> + if (pmu_have_event("cpu", "stalled-cycles-backend")) {
> + if (perf_evlist__add_default_attrs(evsel_list,
> + backend_attrs) < 0)
> + return -1;
> + }
> + if (perf_evlist__add_default_attrs(evsel_list, default_attrs1) < 0)
> return -1;
> }
>
> --
> 2.5.0
>
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-29 15:50 +0100 |
| Subject | Re: [PATCH 1/6] perf, tools, stat: Check existence of frontend/backed stalled cycles |
| Message-ID | <r7xj4-4ik-11@gated-at.bofh.it> |
| In reply to | #1345623 |
Em Mon, Feb 29, 2016 at 11:10:35AM +0100, Jiri Olsa escreveu: > On Fri, Feb 26, 2016 at 04:27:56PM -0800, Andi Kleen wrote: > > From: Andi Kleen <ak@linux.intel.com> > > > > Only put the frontend/backend stalled cycles into the default > > perf stat events when the CPU actually supports them. > > > > This avoids empty columns with --metric-only on newer Intel CPUs. > > > > Signed-off-by: Andi Kleen <ak@linux.intel.com> > > Acked-by: Jiri Olsa <jolsa@kernel.org> Applied and tested, thanks! - Arnaldo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web