From d58e43edbfe1f0a1f21dc029edcfa7d9a44b779e Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 18 Nov 2016 22:40:52 +0100 Subject: [PATCH] gsdx linux: plug vtune as Windows --- build.sh | 1 + cmake/BuildParameters.cmake | 2 ++ plugins/GSdx/CMakeLists.txt | 15 +++++++++------ plugins/GSdx/stdafx.h | 6 +++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 43280d586f..23a758223b 100755 --- a/build.sh +++ b/build.sh @@ -80,6 +80,7 @@ for ARG in "$@"; do --cross-multilib ) flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile"; useCross=1; ;; --no-cross-multilib ) useCross=0; ;; --coverity ) CoverityBuild=1; cleanBuild=1; ;; + --vtune ) flags="$flags -DUSE_VTUNE=TRUE" ;; -D* ) flags="$flags $ARG" ;; *) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 8f03540bb6..05895c5129 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -28,6 +28,8 @@ if(DISABLE_BUILD_DATE OR openSUSE) add_definitions(-DDISABLE_BUILD_DATE) endif() +option(USE_VTUNE "Plug VTUNE to profile GSdx JIT.") + #------------------------------------------------------------------------------- # Graphical option #------------------------------------------------------------------------------- diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index 15c93e0794..09c39f5344 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -195,15 +195,18 @@ set(GSdxFinalLibs ) if(EGL_API AND EGL_FOUND) - set(GSdxFinalLibs ${GSdxFinalLibs} - ${EGL_LIBRARIES} - ) + set(GSdxFinalLibs ${GSdxFinalLibs} ${EGL_LIBRARIES}) endif() if(LIBLZMA_FOUND) - set(GSdxFinalLibs ${GSdxFinalLibs} - ${LIBLZMA_LIBRARIES} - ) + set(GSdxFinalLibs ${GSdxFinalLibs} ${LIBLZMA_LIBRARIES}) +endif() + +if(USE_VTUNE) + set(GSdxFinalFlags ${GSdxFinalFlags} -DENABLE_VTUNE) + include_directories("$ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/include") + set(GSdxFinalLibs ${GSdxFinalLibs} $ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/lib64/libjitprofiling.a) + set(GSdxFinalLibs ${GSdxFinalLibs} $ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/lib32/libjitprofiling.a) endif() # Generate Glsl header file. Protect with REBUILD_SHADER to avoid build-dependency on PERL diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index b6f466afc7..9aebd6f332 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -444,11 +444,11 @@ extern void vmfree(void* ptr, size_t size); extern void* fifo_alloc(size_t size, size_t repeat); extern void fifo_free(void* ptr, size_t size, size_t repeat); -#ifdef _WIN32 +#ifdef ENABLE_VTUNE - #ifdef ENABLE_VTUNE + #include "jitprofiling.h" - #include + #ifdef _WIN32 #pragma comment(lib, "jitprofiling.lib")