linux-mips
[Top] [All Lists]

Re: [PATCH v4 7/9] MIPS/perf-events: allow modules to get pmu number

To: Sergei Shtylyov <sshtylyov@mvista.com>
Subject: Re: [PATCH v4 7/9] MIPS/perf-events: allow modules to get pmu number of counters
From: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Date: Mon, 17 May 2010 11:58:28 +0800
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org, a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu, acme@redhat.com, jamie.iles@picochip.com, will.deacon@arm.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=GAB3JkXhaWRxYxze8wRT1FVPui3TBMBk1Si5BaWWWHw=; b=PtpFMdkPcBeAf9aFtYWd/IEhmSPAeE5MSBP1dAs1GMtnnDFXUA1v0cDoGL3bbkWEh1 bJ8qDj1ChpZFvlLsH/zDBaMotUvZLwMC815ESeUme2MvR02ltXgvHADNRMSMaEgL4Iqg fB4zDujwb8F+VRn6MqwCRgRHki3Ds5Vi+Y6dU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=w/GBx66ZZEzw/yR6JgKIlldkdk6wlf3yuOMzInHwGT9QjF+sg7Fykop9jEkEXT54cm xhxpkaQJz3Ls63Oc3s+Xw3KBaGdgxZpEmYrbnKD3wbQMjwaJI2zR922axTHcyWBveTuI 5ISE4UbggT4NdH+Ee/6S+WwmyIukSwoj1/mb4=
In-reply-to: <4BEEC902.2080006@mvista.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1273937815-4781-1-git-send-email-dengcheng.zhu@gmail.com> <1273937815-4781-8-git-send-email-dengcheng.zhu@gmail.com> <4BEEC902.2080006@mvista.com>
Sender: linux-mips-bounce@linux-mips.org
Thanks!

Will do that next version.


Deng-Cheng


2010/5/16 Sergei Shtylyov <sshtylyov@mvista.com>
Hello.


Deng-Cheng Zhu wrote:

Oprofile module needs a function to get the number of pmu counters in its
high level interfaces.

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
---
 arch/mips/include/asm/pmu.h   |    1 +
 arch/mips/kernel/perf_event.c |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/pmu.h b/arch/mips/include/asm/pmu.h
index 16d4fcd..023a915 100644
--- a/arch/mips/include/asm/pmu.h
+++ b/arch/mips/include/asm/pmu.h
@@ -114,5 +114,6 @@ enum mips_pmu_id {
 extern const char *mips_pmu_names[];
 extern enum mips_pmu_id mipspmu_get_pmu_id(void);
+extern int mipspmu_get_max_events(void);
 #endif /* __MIPS_PMU_H__ */
diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
index 67d301d..6f95220 100644
--- a/arch/mips/kernel/perf_event.c
+++ b/arch/mips/kernel/perf_event.c
@@ -145,6 +145,17 @@ enum mips_pmu_id mipspmu_get_pmu_id(void)
 }
 EXPORT_SYMBOL_GPL(mipspmu_get_pmu_id);
 +int mipspmu_get_max_events(void)
+{
+       int max_events = 0;
+
+       if (mipspmu)
+               max_events = mipspmu->num_counters;
+
+       return max_events;
 

 Why not simply:

  return mispmu ? mipspmu->num_counters : 0;

WBR, Sergei


<Prev in Thread] Current Thread [Next in Thread>