From a000b06c876c3612523bb9aecbc7b73d2ba62243 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 19:18:01 -0700 Subject: [PATCH 01/12] =?UTF-8?q?doesn't=20compile.=20gives=20error=20/hom?= =?UTF-8?q?e/u0018756/xhprof/extension/xhprof.c:1245:3:=20error:=20unknown?= =?UTF-8?q?=20register=20name=20=E2=80=98=20=E2=80=99=20in=20=E2=80=98asm?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extension/xhprof.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extension/xhprof.c b/extension/xhprof.c index 66aa041e..9b521139 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1232,7 +1232,18 @@ void hp_sample_check(hp_entry_t **entries TSRMLS_DC) { static inline uint64 cycle_timer() { uint32 __a,__d; uint64 val; + #ifdef _ARCH_PPC64 + asm volatile( + "0: mftbu %0\n\t" + " mftb %1\n\t" + " mftbu %2\n\t" + " cmpw %0,%2\n\t" /* make sure high register same before and after */ + " bne 0b\n\t" /* should only take two tries max */ + : "=r" (__d), "=r" (__a) + :: "r"); + #else asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); + #endif (val) = ((uint64)__a) | (((uint64)__d)<<32); return val; } From 6197037b697dae3827bccea8629fd2ae616b1187 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 19:21:07 -0700 Subject: [PATCH 02/12] compiles but incorrect, errors if tb overflows --- extension/xhprof.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/extension/xhprof.c b/extension/xhprof.c index 9b521139..ad3a19a3 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1234,13 +1234,10 @@ static inline uint64 cycle_timer() { uint64 val; #ifdef _ARCH_PPC64 asm volatile( - "0: mftbu %0\n\t" + " mftbu %0\n\t" " mftb %1\n\t" - " mftbu %2\n\t" - " cmpw %0,%2\n\t" /* make sure high register same before and after */ - " bne 0b\n\t" /* should only take two tries max */ : "=r" (__d), "=r" (__a) - :: "r"); + : : "cc"); #else asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); #endif From 6b8d28c0e0e50f3087254515b45c7f5d1ae32ed8 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 19:31:42 -0700 Subject: [PATCH 03/12] updated README --- README | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README b/README index a8c15fa9..09c21dbe 100644 --- a/README +++ b/README @@ -1,4 +1,12 @@ -For installation and usage notes refer to: +NOTE: This version of xhprof will not compile under PHP7. It is known to work +on PHP5.6. On an Ubuntu system, follow the advice given at +https://askubuntu.com/a/756901/135108, i.e.: + +sudo add-apt-repository ppa:ondrej/php +sudo apt-get update +sudo apt-get install php5.6-dev + +For other installation and usage notes refer to: xhprof_html/docs/index.html To view the latest version of the doc, go to: From cdd69cbac82e3913d5f540489696f556afcbb310 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 19:37:03 -0700 Subject: [PATCH 04/12] added top-level Makefile --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f59af99d --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +all: + cd extension && phpize + cd extension && ./configure + cd extension && $(MAKE) + cd extension && sudo $(MAKE) install + cd extension && $(MAKE) test From 70eed640e30b9a8d1e2b121f1331a898885f2fa5 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 19:41:03 -0700 Subject: [PATCH 05/12] complete but known to fail compilation --- extension/xhprof.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extension/xhprof.c b/extension/xhprof.c index ad3a19a3..a948a39f 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1234,10 +1234,13 @@ static inline uint64 cycle_timer() { uint64 val; #ifdef _ARCH_PPC64 asm volatile( - " mftbu %0\n\t" + "0: mftbu %0\n\t" " mftb %1\n\t" + " mftbu %2\n\t" + " cmpw %0,%2\n\t" + " bne 0b\n\t" : "=r" (__d), "=r" (__a) - : : "cc"); + : : "r", "cc"); #else asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); #endif From 58081ca8df7ece9464797d3dac5f64cd9dddc7f0 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 19:54:30 -0700 Subject: [PATCH 06/12] trying "b" constraint --- extension/xhprof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/xhprof.c b/extension/xhprof.c index a948a39f..de5884c1 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1240,7 +1240,7 @@ static inline uint64 cycle_timer() { " cmpw %0,%2\n\t" " bne 0b\n\t" : "=r" (__d), "=r" (__a) - : : "r", "cc"); + : : "b", "cc"); #else asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); #endif From 41dd4f78a574f11a89b6c3a9181d95aec4607a2d Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 20:16:50 -0700 Subject: [PATCH 07/12] trying with specifed register r0 --- extension/xhprof.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extension/xhprof.c b/extension/xhprof.c index de5884c1..cb9a3064 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1236,11 +1236,11 @@ static inline uint64 cycle_timer() { asm volatile( "0: mftbu %0\n\t" " mftb %1\n\t" - " mftbu %2\n\t" - " cmpw %0,%2\n\t" + " mftbu r0\n\t" + " cmpw %0,r0\n\t" " bne 0b\n\t" : "=r" (__d), "=r" (__a) - : : "b", "cc"); + : : "r0", "cc"); #else asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); #endif From 08f1ca04aecb50efed1942d51212ce992d67b35b Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 20:19:26 -0700 Subject: [PATCH 08/12] Error: unsupported relocation against r0 --- extension/xhprof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/xhprof.c b/extension/xhprof.c index cb9a3064..2bcc2e41 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1236,8 +1236,8 @@ static inline uint64 cycle_timer() { asm volatile( "0: mftbu %0\n\t" " mftb %1\n\t" - " mftbu r0\n\t" - " cmpw %0,r0\n\t" + " mftbu 0\n\t" + " cmpw %0,0\n\t" " bne 0b\n\t" : "=r" (__d), "=r" (__a) : : "r0", "cc"); From 2e6a333f92f43da54bcccfdc4aff5b16090b9898 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 23:39:04 -0700 Subject: [PATCH 09/12] workaround for bug in php5-dev package phpize --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f59af99d..8029d631 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ all: + [ -f /usr/lib/php5/build/ltmain.sh ] || \ + (cd /usr/lib/php5/build && \ + sudo ln -sf ../../../share/libtool/build-aux/ltmain.sh .) cd extension && phpize cd extension && ./configure cd extension && $(MAKE) From 740ed7d83a6ad863038ce850bf71636e89b9b7d4 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Thu, 15 Jun 2017 23:51:51 -0700 Subject: [PATCH 10/12] fixed tests on my (x86) box --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 8029d631..71c1efe1 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,8 @@ all: sudo ln -sf ../../../share/libtool/build-aux/ltmain.sh .) cd extension && phpize cd extension && ./configure + # run tests with `php5`, not with `php` which may be version 7 + sed -i 's%^\(PHP_EXECUTABLE = /usr/bin/php\)$$%\15%' extension/Makefile cd extension && $(MAKE) cd extension && sudo $(MAKE) install cd extension && $(MAKE) test From 54335b22c498dd43288e6a6ff0cc084c34914c8c Mon Sep 17 00:00:00 2001 From: John Comeau Date: Mon, 26 Jun 2017 11:52:31 -0700 Subject: [PATCH 11/12] added diff rule to clean up my pull request --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 71c1efe1..08dfdcb9 100644 --- a/Makefile +++ b/Makefile @@ -9,3 +9,5 @@ all: cd extension && $(MAKE) cd extension && sudo $(MAKE) install cd extension && $(MAKE) test +diff: + git diff 0bbf2a2a From 022a1299bd872c80e99d59ecf08e3acfff2597b4 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Mon, 26 Jun 2017 11:56:20 -0700 Subject: [PATCH 12/12] removed changes unnecessary for the patch --- Makefile | 13 ------------- README | 10 +--------- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 08dfdcb9..00000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: - [ -f /usr/lib/php5/build/ltmain.sh ] || \ - (cd /usr/lib/php5/build && \ - sudo ln -sf ../../../share/libtool/build-aux/ltmain.sh .) - cd extension && phpize - cd extension && ./configure - # run tests with `php5`, not with `php` which may be version 7 - sed -i 's%^\(PHP_EXECUTABLE = /usr/bin/php\)$$%\15%' extension/Makefile - cd extension && $(MAKE) - cd extension && sudo $(MAKE) install - cd extension && $(MAKE) test -diff: - git diff 0bbf2a2a diff --git a/README b/README index 09c21dbe..a8c15fa9 100644 --- a/README +++ b/README @@ -1,12 +1,4 @@ -NOTE: This version of xhprof will not compile under PHP7. It is known to work -on PHP5.6. On an Ubuntu system, follow the advice given at -https://askubuntu.com/a/756901/135108, i.e.: - -sudo add-apt-repository ppa:ondrej/php -sudo apt-get update -sudo apt-get install php5.6-dev - -For other installation and usage notes refer to: +For installation and usage notes refer to: xhprof_html/docs/index.html To view the latest version of the doc, go to: