Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gprof profiling support. #7547

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ option(WANT_DEBUG_ASAN "Enable AddressSanitizer" OFF)
option(WANT_DEBUG_TSAN "Enable ThreadSanitizer" OFF)
option(WANT_DEBUG_MSAN "Enable MemorySanitizer" OFF)
option(WANT_DEBUG_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
option(WANT_DEBUG_GPROF "Enable gprof profiler" OFF)
OPTION(BUNDLE_QT_TRANSLATIONS "Install Qt translation files for LMMS" OFF)


Expand Down Expand Up @@ -664,6 +665,20 @@ elseif(MSVC)
add_compile_options("/utf-8")
ENDIF()

# gcc builds support gprof for profiling
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU")
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
set(STATUS_GPROF ", NOT SUPPORTED ON THIS PLATFORM")
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
set(WANT_DEBUG_GPROF OFF)
endif()

if(WANT_DEBUG_GPROF)
add_compile_options(-pg)
add_link_options(-pg)
set(STATUS_GPROF "OK")
else()
set(STATUS_GPROF "DISABLED ${STATUS_GPROF}")
endif()

# add enabled sanitizers
function(add_sanitizer sanitizer supported_compilers want_flag status_flag)
if(${want_flag})
Expand Down Expand Up @@ -831,6 +846,7 @@ MESSAGE(
"* Debug using ThreadSanitizer : ${STATUS_DEBUG_TSAN}\n"
"* Debug using MemorySanitizer : ${STATUS_DEBUG_MSAN}\n"
"* Debug using UBSanitizer : ${STATUS_DEBUG_UBSAN}\n"
"* Profiling using GNU profiler : ${STATUS_GPROF}\n"
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
)

MESSAGE(
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/swh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ENDIF()
# Additional compile flags
if(NOT MSVC)
set(COMPILE_FLAGS ${COMPILE_FLAGS} -O3 -c
-fomit-frame-pointer -funroll-loops -ffast-math -fno-strict-aliasing
-funroll-loops -ffast-math -fno-strict-aliasing
${PIC_FLAGS}
)
endif()
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/tap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LIST(SORT PLUGIN_SOURCES)
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fomit-frame-pointer -fno-strict-aliasing -funroll-loops -ffast-math")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fno-strict-aliasing -funroll-loops -ffast-math")
endif()
FOREACH(_item ${PLUGIN_SOURCES})
GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE)
Expand Down
Loading