summaryrefslogtreecommitdiffstats
path: root/runtime/time.c
diff options
context:
space:
mode:
authorWenji Huang <wenji.huang@oracle.com>2010-01-13 11:27:48 +0800
committerWenji Huang <wenji.huang@oracle.com>2010-01-13 11:27:48 +0800
commite25ab03ca60a5c6ca687b698502730ba2ad244dc (patch)
treeee28f46ed87fc06318ee4137fa62a7200ddf523e /runtime/time.c
parent0effa39a119a901ad1304b1dc6ef9ba0c4735afe (diff)
downloadsystemtap-steved-e25ab03ca60a5c6ca687b698502730ba2ad244dc.tar.gz
systemtap-steved-e25ab03ca60a5c6ca687b698502730ba2ad244dc.tar.xz
systemtap-steved-e25ab03ca60a5c6ca687b698502730ba2ad244dc.zip
PR10493: autoconf for cpu_khz
* buildrun.cxx (output_cpu_khz): New function to check cpu_khz. (compile_pass): Invoke function output_cpu_khz. * runtime/time.c : Use STAPCONF_CPU_KHZ.
Diffstat (limited to 'runtime/time.c')
-rw-r--r--runtime/time.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/runtime/time.c b/runtime/time.c
index d588370f..5caa73cc 100644
--- a/runtime/time.c
+++ b/runtime/time.c
@@ -71,18 +71,16 @@ static unsigned int
__stp_get_freq(void)
{
// If we can get the actual frequency of HW counter, we use it.
-#if defined (__i386__) || defined (__x86_64__)
-#ifdef STAPCONF_TSC_KHZ
- return tsc_khz;
-#else /*STAPCONF_TSC_KHZ*/
- return cpu_khz;
-#endif /*STAPCONF_TSC_KHZ*/
-#elif defined (__ia64__)
+#if defined (__ia64__)
return local_cpu_data->itc_freq / 1000;
#elif defined (__s390__) || defined (__s390x__) || defined (__arm__)
// We don't need to find the cpu freq on s390 as the
// TOD clock is always a fix freq. (see: POO pg 4-36.)
return 0;
+#elif (defined (__i386__) || defined (__x86_64__)) && defined(STAPCONF_TSC_KHZ)
+ return tsc_khz;
+#elif (defined (__i386__) || defined (__x86_64__)) && defined(STAPCONF_CPU_KHZ)
+ return cpu_khz;
#else /* __i386__ || __x86_64__ || __ia64__ || __s390__ || __s390x__ || __arm__*/
// If we don't know the actual frequency, we estimate it.
cycles_t beg, mid, end;