Re: [PATCH 1/3] perf, tools: Add override support for event list CPUID

2015-06-01 Thread Jiri Olsa
On Sun, May 31, 2015 at 09:11:34AM -0700, Andi Kleen wrote:
> From: Andi Kleen 
> 
> Add a PERF_CPUID variable to override the CPUID of the current CPU.
> This is useful for testing, so that all event lists 

.. within a current architecture (x86, powerpc) ..

> can be tested on a single
> system.
> 
> v2: Fix double free in earlier version.
> Signed-off-by: Andi Kleen 
> ---
>  tools/perf/util/pmu.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 578a537..5c30f89 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -474,7 +474,11 @@ static int pmu_add_cpu_aliases(void *data)
>   struct pmu_event *pe;
>   char *cpuid;
>  
> - cpuid = get_cpuid_str();
> + cpuid = getenv("PERF_CPUID");
> + if (cpuid)
> + cpuid = strdup(cpuid);
> + if (!cpuid)
> + cpuid = get_cpuid_str();
>   if (!cpuid)
>   return 0;

I tried and it's hard to actually say you're looking on another
CPU events. Could we advertise the CPUID in perf list? Or at least
some pr_debug print.

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


Re: [PATCH 1/3] perf, tools: Add override support for event list CPUID

2015-06-01 Thread Jiri Olsa
On Sun, May 31, 2015 at 09:11:34AM -0700, Andi Kleen wrote:
 From: Andi Kleen a...@linux.intel.com
 
 Add a PERF_CPUID variable to override the CPUID of the current CPU.
 This is useful for testing, so that all event lists 

.. within a current architecture (x86, powerpc) ..

 can be tested on a single
 system.
 
 v2: Fix double free in earlier version.
 Signed-off-by: Andi Kleen a...@linux.intel.com
 ---
  tools/perf/util/pmu.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
 index 578a537..5c30f89 100644
 --- a/tools/perf/util/pmu.c
 +++ b/tools/perf/util/pmu.c
 @@ -474,7 +474,11 @@ static int pmu_add_cpu_aliases(void *data)
   struct pmu_event *pe;
   char *cpuid;
  
 - cpuid = get_cpuid_str();
 + cpuid = getenv(PERF_CPUID);
 + if (cpuid)
 + cpuid = strdup(cpuid);
 + if (!cpuid)
 + cpuid = get_cpuid_str();
   if (!cpuid)
   return 0;

I tried and it's hard to actually say you're looking on another
CPU events. Could we advertise the CPUID in perf list? Or at least
some pr_debug print.

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


[PATCH 1/3] perf, tools: Add override support for event list CPUID

2015-05-31 Thread Andi Kleen
From: Andi Kleen 

Add a PERF_CPUID variable to override the CPUID of the current CPU.
This is useful for testing, so that all event lists can be tested on a single
system.

v2: Fix double free in earlier version.
Signed-off-by: Andi Kleen 
---
 tools/perf/util/pmu.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 578a537..5c30f89 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -474,7 +474,11 @@ static int pmu_add_cpu_aliases(void *data)
struct pmu_event *pe;
char *cpuid;
 
-   cpuid = get_cpuid_str();
+   cpuid = getenv("PERF_CPUID");
+   if (cpuid)
+   cpuid = strdup(cpuid);
+   if (!cpuid)
+   cpuid = get_cpuid_str();
if (!cpuid)
return 0;
 
-- 
2.4.1

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


[PATCH 1/3] perf, tools: Add override support for event list CPUID

2015-05-31 Thread Andi Kleen
From: Andi Kleen a...@linux.intel.com

Add a PERF_CPUID variable to override the CPUID of the current CPU.
This is useful for testing, so that all event lists can be tested on a single
system.

v2: Fix double free in earlier version.
Signed-off-by: Andi Kleen a...@linux.intel.com
---
 tools/perf/util/pmu.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 578a537..5c30f89 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -474,7 +474,11 @@ static int pmu_add_cpu_aliases(void *data)
struct pmu_event *pe;
char *cpuid;
 
-   cpuid = get_cpuid_str();
+   cpuid = getenv(PERF_CPUID);
+   if (cpuid)
+   cpuid = strdup(cpuid);
+   if (!cpuid)
+   cpuid = get_cpuid_str();
if (!cpuid)
return 0;
 
-- 
2.4.1

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


[PATCH 1/3] perf, tools: Add override support for event list CPUID

2015-05-28 Thread Andi Kleen
From: Andi Kleen 

Add a PERF_CPUID variable to override the CPUID of the current CPU.
This is useful for testing, so that all event lists can be tested on a single
system.

v2: Fix double free in earlier version.
Signed-off-by: Andi Kleen 
---
 tools/perf/util/pmu.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index ba50300..59e0f4e 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -474,7 +474,11 @@ static int pmu_add_cpu_aliases(void *data)
struct pmu_event *pe;
char *cpuid;
 
-   cpuid = get_cpuid_str();
+   cpuid = getenv("PERF_CPUID");
+   if (cpuid)
+   cpuid = strdup(cpuid);
+   if (!cpuid)
+   cpuid = get_cpuid_str();
if (!cpuid)
return 0;
 
-- 
2.1.0

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


[PATCH 1/3] perf, tools: Add override support for event list CPUID

2015-05-28 Thread Andi Kleen
From: Andi Kleen a...@linux.intel.com

Add a PERF_CPUID variable to override the CPUID of the current CPU.
This is useful for testing, so that all event lists can be tested on a single
system.

v2: Fix double free in earlier version.
Signed-off-by: Andi Kleen a...@linux.intel.com
---
 tools/perf/util/pmu.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index ba50300..59e0f4e 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -474,7 +474,11 @@ static int pmu_add_cpu_aliases(void *data)
struct pmu_event *pe;
char *cpuid;
 
-   cpuid = get_cpuid_str();
+   cpuid = getenv(PERF_CPUID);
+   if (cpuid)
+   cpuid = strdup(cpuid);
+   if (!cpuid)
+   cpuid = get_cpuid_str();
if (!cpuid)
return 0;
 
-- 
2.1.0

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