From 6b02fc083ecac1dacd3672eb3d4a7f5eaf5025c0 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 19 Jun 2018 15:52:57 -0400 Subject: [PATCH] cmake PMP fetch FlameGraph to build directory --- platforms/nuttx/CMakeLists.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index 0333597703..15e23c498c 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -281,9 +281,21 @@ add_custom_target(debug DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit USES_TERMINAL ) - + +# Poor man's profiler +include(ExternalProject) +ExternalProject_Add(FlameGraph + GIT_REPOSITORY "https://github.com/brendangregg/FlameGraph.git" + UPDATE_COMMAND "" + PATCH_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + EXCLUDE_FROM_ALL 1 + ) + add_custom_target(profile - COMMAND ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/poor-mans-profiler.sh --elf=$ --nsamples=10000 - DEPENDS ${FW_NAME} ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/poor-mans-profiler.sh + COMMAND ${CMAKE_COMMAND} -E env PATH="${PX4_BINARY_DIR}/external/Source/FlameGraph:$ENV{PATH}" ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/poor-mans-profiler.sh --elf=$ --nsamples=10000 + DEPENDS ${FW_NAME} ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/poor-mans-profiler.sh FlameGraph USES_TERMINAL )