From b3d14bfdda4eadb12128a03b5d027b46c910b19e Mon Sep 17 00:00:00 2001 From: Owen Yamauchi Date: Thu, 11 Apr 2013 18:09:09 -0700 Subject: [PATCH] ifdef out rdtsc in hotprofiler I'm punting on this for now. I'm afraid of violating assumptions about how the clock behind this interface works (and we do very specific stuff like calculating CPU clock speed), so I don't want to try to replace it. We'll revisit when we need to do serious profiling on ARM; we'll definitely notice that this functionality is missing when we try to use it. --- hphp/runtime/ext/ext_hotprofiler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hphp/runtime/ext/ext_hotprofiler.cpp b/hphp/runtime/ext/ext_hotprofiler.cpp index 3d5eb7b00..d21869785 100644 --- a/hphp/runtime/ext/ext_hotprofiler.cpp +++ b/hphp/runtime/ext/ext_hotprofiler.cpp @@ -144,11 +144,18 @@ static void hp_trunc_time(struct timeval *tv, uint64_t intr) { * @author cjiang */ inline uint64_t tsc() { +#ifdef __x86_64__ uint32_t __a,__d; uint64_t val; asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); (val) = ((uint64_t)__a) | (((uint64_t)__d)<<32); return val; +#else + // TODO(2200461): rdtsc isn't portable. Ideally we'd use some higher-level + // portable API (clock_gettime maybe?), but that may break assumptions that + // clients of this API make about how the underlying clock works. + return 0; +#endif } /**