* [PATCH] powerpc/perf: Implement get_cpu_str()
@ 2014-08-06 0:17 Sukadev Bhattiprolu
2014-08-07 8:44 ` Tobias Klauser
0 siblings, 1 reply; 3+ messages in thread
From: Sukadev Bhattiprolu @ 2014-08-06 0:17 UTC (permalink / raw)
To: jolsa; +Cc: andi, Michael Ellerman, linux-kernel
powerpc/perf: Implement get_cpu_str()
With a file like ~/.cache/pmu-events/004d0100-core.json describing
Power8 PMU events, we would need to run:
perf stat \
--events-file ~/.cache/pmu-events/004d0100-core.json \
-e PM_CYC sleep 1
With this get_cpu_str(), on Powerpc, we can skip the --events-file option
and run:
perf stat -e PM_CYC sleep 1
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
Note: This patch is based on Andi Kleen's recent patchset
https://lkml.org/lkml/2014/7/30/693
Changelog[v2]:
[Michael Ellerman]: Use PVR instead of AUXV variables
| 12 ++++++++++++
1 file changed, 12 insertions(+)
--git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
index 6c1b8a7..1bb400e8 100644
--- a/tools/perf/arch/powerpc/util/header.c
+++ b/tools/perf/arch/powerpc/util/header.c
@@ -6,6 +6,7 @@
#include "../../util/header.h"
#include "../../util/util.h"
+#include "../../util/jevents.h"
#define mfspr(rn) ({unsigned long rval; \
asm volatile("mfspr %0," __stringify(rn) \
@@ -32,3 +33,14 @@ get_cpuid(char *buffer, size_t sz)
}
return -1;
}
+
+char *
+get_cpu_str(void)
+{
Changelog[v2]:
[Michael Ellerman]: Use PVR instead of AUXV variables
+ char *bufp;
+
+ if (asprintf(&bufp, "%.8lx-core", mfspr(SPRN_PVR)) < 0)
+ bufp = NULL;
+
+ return bufp;
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/perf: Implement get_cpu_str()
2014-08-06 0:17 [PATCH] powerpc/perf: Implement get_cpu_str() Sukadev Bhattiprolu
@ 2014-08-07 8:44 ` Tobias Klauser
2014-08-18 23:29 ` Sukadev Bhattiprolu
0 siblings, 1 reply; 3+ messages in thread
From: Tobias Klauser @ 2014-08-07 8:44 UTC (permalink / raw)
To: Sukadev Bhattiprolu; +Cc: jolsa, andi, Michael Ellerman, linux-kernel
On 2014-08-06 at 02:17:55 +0200, Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> wrote:
> powerpc/perf: Implement get_cpu_str()
>
> With a file like ~/.cache/pmu-events/004d0100-core.json describing
> Power8 PMU events, we would need to run:
>
> perf stat \
> --events-file ~/.cache/pmu-events/004d0100-core.json \
> -e PM_CYC sleep 1
>
> With this get_cpu_str(), on Powerpc, we can skip the --events-file option
> and run:
>
> perf stat -e PM_CYC sleep 1
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
> Note: This patch is based on Andi Kleen's recent patchset
>
> https://lkml.org/lkml/2014/7/30/693
>
> Changelog[v2]:
> [Michael Ellerman]: Use PVR instead of AUXV variables
>
> tools/perf/arch/powerpc/util/header.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
> index 6c1b8a7..1bb400e8 100644
> --- a/tools/perf/arch/powerpc/util/header.c
> +++ b/tools/perf/arch/powerpc/util/header.c
> @@ -6,6 +6,7 @@
>
> #include "../../util/header.h"
> #include "../../util/util.h"
> +#include "../../util/jevents.h"
>
> #define mfspr(rn) ({unsigned long rval; \
> asm volatile("mfspr %0," __stringify(rn) \
> @@ -32,3 +33,14 @@ get_cpuid(char *buffer, size_t sz)
> }
> return -1;
> }
> +
> +char *
> +get_cpu_str(void)
> +{
> Changelog[v2]:
> [Michael Ellerman]: Use PVR instead of AUXV variables
This was probably not intended to be here and the patch does not apply
due to these lines.
>
> + char *bufp;
> +
> + if (asprintf(&bufp, "%.8lx-core", mfspr(SPRN_PVR)) < 0)
> + bufp = NULL;
> +
> + return bufp;
> +}
> --
> 1.8.3.1
>
> --
> 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/
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/perf: Implement get_cpu_str()
2014-08-07 8:44 ` Tobias Klauser
@ 2014-08-18 23:29 ` Sukadev Bhattiprolu
0 siblings, 0 replies; 3+ messages in thread
From: Sukadev Bhattiprolu @ 2014-08-18 23:29 UTC (permalink / raw)
To: Tobias Klauser; +Cc: jolsa, andi, Michael Ellerman, linux-kernel
Tobias Klauser [tklauser@distanz.ch] wrote:
| > diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
| > index 6c1b8a7..1bb400e8 100644
| > --- a/tools/perf/arch/powerpc/util/header.c
| > +++ b/tools/perf/arch/powerpc/util/header.c
| > @@ -6,6 +6,7 @@
| >
| > #include "../../util/header.h"
| > #include "../../util/util.h"
| > +#include "../../util/jevents.h"
| >
| > #define mfspr(rn) ({unsigned long rval; \
| > asm volatile("mfspr %0," __stringify(rn) \
| > @@ -32,3 +33,14 @@ get_cpuid(char *buffer, size_t sz)
| > }
| > return -1;
| > }
| > +
| > +char *
| > +get_cpu_str(void)
| > +{
| > Changelog[v2]:
| > [Michael Ellerman]: Use PVR instead of AUXV variables
|
| This was probably not intended to be here and the patch does not apply
| due to these lines.
Sorry about that. Will resend.
Sukadev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-18 23:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 0:17 [PATCH] powerpc/perf: Implement get_cpu_str() Sukadev Bhattiprolu
2014-08-07 8:44 ` Tobias Klauser
2014-08-18 23:29 ` Sukadev Bhattiprolu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.