Package: xhprof
Version: 0.9.4-2
Severity: important
Tags: patch

xhprof does not compile on ppc64el architecture because it contains a timing
x86 assembly instruction.

This bugs contains a  backported patch from a submitted upstream solution that
adds support for this new architecture. The original submission could be seen
at:

https://github.com/clbr/xhprof/commit/6fe6c8ad11627f480deead2d99ab0fa6b0adf8a0


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: ppc64el (ppc64le)

Kernel: Linux 3.16.0-4-powerpc64le (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Index: xhprof-0.9.4/extension/xhprof.c
===================================================================
--- xhprof-0.9.4.orig/extension/xhprof.c
+++ xhprof-0.9.4/extension/xhprof.c
@@ -1219,10 +1219,22 @@ void hp_sample_check(hp_entry_t **entrie
  * @author cjiang
  */
 inline uint64 cycle_timer() {
-  uint32 __a,__d;
   uint64 val;
+
+#if defined(__i386__) || defined(__x86_64__)
+  uint32 __a,__d;
   asm volatile("rdtsc" : "=a" (__a), "=d" (__d));
   (val) = ((uint64)__a) | (((uint64)__d)<<32);
+
+/* The builtin is available starting with GCC 4.8 */
+#elif defined(__powerpc__) && \
+      ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
+  val = __builtin_ppc_get_timebase();
+
+#else
+#error Unsupported platform
+#endif
+
   return val;
 }
 

Reply via email to