Last active
June 25, 2016 05:16
-
-
Save lhchavez/d4d8656d6b2aee52db379963af2f0ebc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set +x | |
sudo apt-get install -y autoconf automake binutils-dev build-essential cmake g++-4.9 gawk git \ | |
libbz2-dev libc-client-dev libldap2-dev \ | |
libc-client2007e-dev libcap-dev libcurl4-openssl-dev libdwarf-dev libelf-dev \ | |
libexpat-dev libgd2-xpm-dev libgoogle-perftools-dev libicu-dev \ | |
libjemalloc-dev libmcrypt-dev libmemcached-dev libmysqlclient-dev libncurses-dev \ | |
libonig-dev libpcre3-dev libreadline-dev libtbb-dev libtool libxml2-dev zlib1g-dev \ | |
libevent-dev libmagickwand-dev libinotifytools0-dev libiconv-hook-dev libedit-dev \ | |
libiberty-dev libxslt1-dev ocaml-native-compilers libsqlite3-dev libyaml-dev libgmp3-dev \ | |
gperf libkrb5-dev libnotify-dev | |
git clone https://github.com/gflags/gflags.git | |
cd gflags | |
cmake -DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9 \ | |
-DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=OFF . | |
make | |
cd .. | |
git clone https://github.com/google/glog.git | |
cd glog | |
cmake -DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9 \ | |
-DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=OFF \ | |
-DGFLAGS_INCLUDE_DIR=$PWD/../gflags/include/ \ | |
-DGFLAGS_LIBRARIES=$PWD/../gflags/lib/libgflags.a . | |
make | |
cd .. | |
ar -M <<EOS | |
CREATE glog/libglog_bundle.a | |
ADDLIB glog/libglog.a | |
ADDLIB gflags/lib/libgflags.a | |
SAVE | |
END | |
EOS | |
ranlib glog/libglog_bundle.a | |
git clone https://github.com/boostorg/boost.git --branch boost-1.58.0 | |
cd boost | |
git submodule update --init --recursive | |
cat > ~/site-config.jam <<EOS | |
using gcc : 4.9 ; | |
EOS | |
./bootstrap.sh --with-libraries=all --prefix=/usr | |
./b2 link=static headers | |
./b2 link=static | |
cd .. | |
git clone https://github.com/facebook/hhvm.git --branch HHVM-3.14 | |
cd hhvm | |
git submodule update --init --recursive | |
cmake -DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock \ | |
-DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9 \ | |
-DBOOST_ROOT=$PWD/../boost -DBoost_USE_STATIC_LIBS=ON \ | |
-DLIBGLOG_LIBRARY=$PWD/../glog/libglog_bundle.a \ | |
-DLIBGLOG_INCLUDE_DIR=$PWD/../glog/src \ | |
-DCMAKE_CXX_FLAGS=-I$PWD/../glog \ | |
-DCMAKE_INSTALL_PREFIX=/usr -Wno-dev . | |
make | |
sudo make install | |
cd .. | |
git clone https://github.com/chregu/hhvm-newrelic-ext.git | |
cd hhvm-newrelic-ext | |
wget https://download.newrelic.com/agent_sdk/nr_agent_sdk-v0.16.2.0-beta.x86_64.tar.gz | |
tar -xf nr_agent_sdk-v0.16.2.0-beta.x86_64.tar.gz | |
patch <<EOS | |
diff --git a/config.cmake b/config.cmake | |
index 64c0d4c..7c407a0 100644 | |
--- a/config.cmake | |
+++ b/config.cmake | |
@@ -1,9 +1,9 @@ | |
-find_library(NEWRELIC_TRANSACTION_LIBRARY NAMES newrelic-transaction PATHS /usr/lib /usr/local/lib) | |
-find_library(NEWRELIC_COLLECTOR_CLIENT_LIBRARY NAMES newrelic-collector-client PATHS /usr/lib /usr/local/lib) | |
-find_library(NEWRELIC_COMMON_LIBRARY NAMES newrelic-common PATHS /usr/lib /usr/local/lib) | |
+find_library(NEWRELIC_TRANSACTION_LIBRARY NAMES newrelic-transaction PATHS nr_agent_sdk-v0.16.2.0-beta.x86_64/lib/) | |
+find_library(NEWRELIC_COLLECTOR_CLIENT_LIBRARY NAMES newrelic-collector-client PATHS nr_agent_sdk-v0.16.2.0-beta.x86_64/lib/) | |
+find_library(NEWRELIC_COMMON_LIBRARY NAMES newrelic-common PATHS nr_agent_sdk-v0.16.2.0-beta.x86_64/lib/) | |
include_directories(/usr/include) | |
-include_directories(/usr/local/include) | |
+include_directories(nr_agent_sdk-v0.16.2.0-beta.x86_64/include/) | |
HHVM_EXTENSION(newrelic newrelic.cpp newrelic_profiler.cpp) | |
diff --git a/newrelic.cpp b/newrelic.cpp | |
index aebf60a..32c13cf 100644 | |
--- a/newrelic.cpp | |
+++ b/newrelic.cpp | |
@@ -164,34 +164,37 @@ static void HHVM_FUNCTION(newrelic_set_external_profiler, int64_t maxdepth ) { | |
} | |
static Variant HHVM_FUNCTION(newrelic_get_scoped_generic_segment, const String & name) { | |
- ScopedGenericSegment * segment = nullptr; | |
// NEWOBJ existsonly until HHVM 3.4 | |
#ifdef NEWOBJ | |
- segment = NEWOBJ(ScopedGenericSegment)(name.c_str()); | |
+ auto segment = NEWOBJ(ScopedGenericSegment)(name.c_str()); | |
+ #elif defined newres | |
+ auto segment = newres<ScopedGenericSegment>(name.c_str()); | |
#else | |
- segment = newres<ScopedGenericSegment>(name.c_str()); | |
+ auto segment = req::make<ScopedGenericSegment>(name.c_str()); | |
#endif | |
return Resource(segment); | |
} | |
static Variant HHVM_FUNCTION(newrelic_get_scoped_database_segment, const String & table, const String & operation, const String & sql, const String & sql_trace_rollup_name) { | |
- ScopedDatastoreSegment * segment = nullptr; | |
// NEWOBJ existsonly until HHVM 3.4 | |
#ifdef NEWOBJ | |
- segment = NEWOBJ(ScopedDatastoreSegment)(table.c_str(), operation.c_str(), sql.c_str(), sql_trace_rollup_name.c_str()); | |
+ auto segment = NEWOBJ(ScopedDatastoreSegment)(table.c_str(), operation.c_str(), sql.c_str(), sql_trace_rollup_name.c_str()); | |
+ #elif defined newres | |
+ auto segment = newres<ScopedDatastoreSegment>(table.c_str(), operation.c_str(), sql.c_str(), sql_trace_rollup_name.c_str()); | |
#else | |
- segment = newres<ScopedDatastoreSegment>(table.c_str(), operation.c_str(), sql.c_str(), sql_trace_rollup_name.c_str()); | |
+ auto segment = req::make<ScopedDatastoreSegment>(table.c_str(), operation.c_str(), sql.c_str(), sql_trace_rollup_name.c_str()); | |
#endif | |
return Resource(segment); | |
} | |
static Variant HHVM_FUNCTION(newrelic_get_scoped_external_segment, const String & host, const String & name) { | |
- ScopedExternalSegment * segment = nullptr; | |
// NEWOBJ existsonly until HHVM 3.4 | |
#ifdef NEWOBJ | |
- segment = NEWOBJ(ScopedExternalSegment)(host.c_str(), name.c_str()); | |
+ auto segment = NEWOBJ(ScopedExternalSegment)(host.c_str(), name.c_str()); | |
+ #elif defined newres | |
+ auto segment = newres<ScopedExternalSegment>(host.c_str(), name.c_str()); | |
#else | |
- segment = newres<ScopedExternalSegment>(host.c_str(), name.c_str()); | |
+ auto segment = req::make<ScopedExternalSegment>(host.c_str(), name.c_str()); | |
#endif | |
return Resource(segment); | |
} | |
diff --git a/newrelic_profiler.h b/newrelic_profiler.h | |
index 9290fc8..b0c2a78 100644 | |
--- a/newrelic_profiler.h | |
+++ b/newrelic_profiler.h | |
@@ -44,6 +44,9 @@ namespace HPHP { | |
//virtual Frame *allocateFrame() override; | |
private: | |
+ void vscan(IMarker&) const override { | |
+ } | |
+ | |
class NewRelicProfilerFrame : public Frame { | |
public: | |
virtual ~NewRelicProfilerFrame() { | |
EOS | |
hphpize | |
cmake . -DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9 -Wno-dev \ | |
-DCMAKE_CXX_FLAGS="-I$PWD/../gflags/include -I$PWD/../glog/src" | |
make | |
sudo make install | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment