@@ -132,6 +132,7 @@ static double sample_get_cpu_mhz(void)
return b;
}
+#ifndef __s390x__
static double proc_get_cpu_mhz(int no_cpu_freq_fail)
{
FILE* f;
@@ -177,9 +178,13 @@ static double proc_get_cpu_mhz(int no_cp
return mhz;
}
+#endif
double get_cpu_mhz(int no_cpu_freq_fail)
{
+#ifdef __s390x__
+ return sample_get_cpu_mhz();
+#else
double sample, proc, delta;
sample = sample_get_cpu_mhz();
proc = proc_get_cpu_mhz(no_cpu_freq_fail);
@@ -195,4 +200,5 @@ double get_cpu_mhz(int no_cpu_freq_fail)
return sample;
}
return proc;
+#endif
}
@@ -70,7 +70,15 @@ static inline cycles_t get_cycles()
asm volatile ("mov %0=ar.itc" : "=r" (ret));
return ret;
}
+#elif defined(__s390x__)
+typedef unsigned long long cycles_t;
+static inline cycles_t get_cycles(void)
+{
+ cycles_t clk;
+ asm volatile("stck %0" : "=Q" (clk) : : "cc");
+ return clk >> 2;
+}
#else
#warning get_cycles not implemented for this architecture: attempt asm/timex.h
#include <asm/timex.h>