diff --git a/hphp/CMakeLists.txt b/hphp/CMakeLists.txt index d761bba1b..788de0fad 100644 --- a/hphp/CMakeLists.txt +++ b/hphp/CMakeLists.txt @@ -38,7 +38,6 @@ endforeach(dir ${RECURSIVE_SOURCE_SUBDIRS}) # Disable hardware counters off of Linux if(NOT LINUX) add_definitions(-DNO_HARDWARE_COUNTERS) - list(REMOVE_ITEM CXX_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/runtime/base/hardware_counter.cpp) endif() # remove ext_hhvm, and anything in a test folder diff --git a/hphp/runtime/base/hardware_counter.cpp b/hphp/runtime/base/hardware_counter.cpp index 6b0d758e8..ced24199d 100644 --- a/hphp/runtime/base/hardware_counter.cpp +++ b/hphp/runtime/base/hardware_counter.cpp @@ -14,10 +14,13 @@ +----------------------------------------------------------------------+ */ -#define _GNU_SOURCE 1 #include "hphp/runtime/base/hardware_counter.h" + +#ifndef NO_HARDWARE_COUNTERS + #include "hphp/util/logger.h" +#define _GNU_SOURCE 1 #include #include #include @@ -414,3 +417,16 @@ void HardwareCounter::GetPerfEvents(Array& ret) { /////////////////////////////////////////////////////////////////////////////// } + + +#else // NO_HARDWARE_COUNTERS + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +HardwareCounter HardwareCounter::s_counter; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // NO_HARDWARE_COUNTERS