[ofa-general] [PATCH RESEND] perftest - Fix proc_get_cpu_mhz() on IA64
sebastien dugue
sebastien.dugue at bull.net
Mon Jul 27 02:11:13 PDT 2009
On IA64, proc_get_cpu_mhz() must use the ITC frequency rather than
the CPU frequency.
Signed-off-by: Sebastien Dugue <sebastien.dugue at bull.net>
---
get_clock.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/get_clock.c b/get_clock.c
index 0acb074..cc86452 100755
--- a/get_clock.c
+++ b/get_clock.c
@@ -144,12 +144,20 @@ static double proc_get_cpu_mhz(int no_cpu_freq_fail)
while(fgets(buf, sizeof(buf), f)) {
double m;
int rc;
+
+#if defined (__ia64__)
+ /* Use the ITC frequency on IA64 */
+ rc = sscanf(buf, "itc MHz : %lf", &m);
+#elif defined (__PPC__) || defined (__PPC64__)
+ /* PPC has a different format as well */
+ rc = sscanf(buf, "clock : %lf", &m);
+#else
rc = sscanf(buf, "cpu MHz : %lf", &m);
- if (rc != 1) { /* PPC has a different format */
- rc = sscanf(buf, "clock : %lf", &m);
- if (rc != 1)
- continue;
- }
+#endif
+
+ if (rc != 1)
+ continue;
+
if (mhz == 0.0) {
mhz = m;
continue;
--
1.6.3.1
More information about the general
mailing list