Skip to content

Commit

Permalink
Add build options to control Profiler code (#2763)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored Sep 14, 2023
1 parent 522f157 commit bc704dc
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 42 deletions.
21 changes: 12 additions & 9 deletions CMake/AzureRTOS_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@

#define TARGETINFOSTRING "@CMAKE_BUILD_TYPE@ build with Azure RTOS v" STR(THREADX_MAJOR_VERSION) "." STR(THREADX_MINOR_VERSION) "." STR(THREADX_PATCH_VERSION)

#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER @TARGET_HAS_NANOBOOTER@
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine TARGET_SERIAL_BAUDRATE @TARGET_SERIAL_BAUDRATE@
#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER @TARGET_HAS_NANOBOOTER@
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine TARGET_SERIAL_BAUDRATE @TARGET_SERIAL_BAUDRATE@
#cmakedefine NANOCLR_PROFILE_NEW_CALLS @NANOCLR_PROFILE_NEW_CALLS@
#cmakedefine NANOCLR_PROFILE_NEW_ALLOCATIONS @NANOCLR_PROFILE_NEW_ALLOCATIONS@
#cmakedefine NANOCLR_TRACE_MEMORY_STATS @NANOCLR_TRACE_MEMORY_STATS@

#endif // TARGET_OS_H
19 changes: 11 additions & 8 deletions CMake/ChibiOS_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@

#define TARGETINFOSTRING "@CMAKE_BUILD_TYPE@ build with ChibiOS v" CH_VERSION "." STR(CH_VERSION_MONTH)

#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER @TARGET_HAS_NANOBOOTER@
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER @TARGET_HAS_NANOBOOTER@
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine NANOCLR_PROFILE_NEW_CALLS @NANOCLR_PROFILE_NEW_CALLS@
#cmakedefine NANOCLR_PROFILE_NEW_ALLOCATIONS @NANOCLR_PROFILE_NEW_ALLOCATIONS@
#cmakedefine NANOCLR_TRACE_MEMORY_STATS @NANOCLR_TRACE_MEMORY_STATS@

#endif // TARGET_OS_H
21 changes: 12 additions & 9 deletions CMake/ESP32_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@

#define IDF_VER_FIXED "@IDF_VER_FIXED@"

#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER FALSE
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine TARGET_SERIAL_BAUDRATE @TARGET_SERIAL_BAUDRATE@
#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER FALSE
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine TARGET_SERIAL_BAUDRATE @TARGET_SERIAL_BAUDRATE@
#cmakedefine NANOCLR_PROFILE_NEW_CALLS @NANOCLR_PROFILE_NEW_CALLS@
#cmakedefine NANOCLR_PROFILE_NEW_ALLOCATIONS @NANOCLR_PROFILE_NEW_ALLOCATIONS@
#cmakedefine NANOCLR_TRACE_MEMORY_STATS @NANOCLR_TRACE_MEMORY_STATS@

#endif // TARGET_OS_H
19 changes: 11 additions & 8 deletions CMake/FreeRTOS_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@

#define TARGETINFOSTRING "@CMAKE_BUILD_TYPE@ build with FREERTOS @RTOS_VERSION@"

#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER @TARGET_HAS_NANOBOOTER@
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER @TARGET_HAS_NANOBOOTER@
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine NANOCLR_PROFILE_NEW_CALLS @NANOCLR_PROFILE_NEW_CALLS@
#cmakedefine NANOCLR_PROFILE_NEW_ALLOCATIONS @NANOCLR_PROFILE_NEW_ALLOCATIONS@
#cmakedefine NANOCLR_TRACE_MEMORY_STATS @NANOCLR_TRACE_MEMORY_STATS@

#endif // TARGET_OS_H
18 changes: 18 additions & 0 deletions CMake/Modules/ClrProfilerOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#

option(NF_PROFILE_NEW_CALLS "option to support profilling new function calls" OFF)
option(NF_PROFILE_NEW_ALLOCATIONS "option to support profilling new object allocations" OFF)
option(NF_TRACE_MEMORY_STATS "option to enable trace of memory stats" OFF)

if(NF_PROFILE_NEW_CALLS)
set(NANOCLR_PROFILE_NEW_CALLS TRUE CACHE INTERNAL "option to support profilling new function calls")
endif()
if(NF_PROFILE_NEW_ALLOCATIONS)
set(NANOCLR_PROFILE_NEW_ALLOCATIONS TRUE CACHE INTERNAL "option to support profilling new object allocations")
endif()
if(NF_TRACE_MEMORY_STATS)
set(NANOCLR_TRACE_MEMORY_STATS TRUE CACHE INTERNAL "option to enable trace of memory stats")
endif()
19 changes: 11 additions & 8 deletions CMake/TI_SimpleLink_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
#define VERSION_BUILD @nanoFramework_VERSION_PATCH@U
#define VERSION_REVISION @nanoFramework_VERSION_TWEAK@U

#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER FALSE
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#define NANOCLR_LIGHT_MATH @TARGET_LIGHT_MATH@
#define DP_FLOATINGPOINT @TARGET_DP_FLOATINGPOINT@
#define SUPPORT_ANY_BASE_CONVERSION @TARGET_SUPPORT_ANY_BASE_CONVERSION@
#define HAS_CONFIG_BLOCK @TARGET_HAS_CONFIG_BLOCK@
#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@
#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@
#define TARGET_HAS_NANOBOOTER FALSE
#define TRACE_TO_STDIO @TARGET_TRACE_TO_STDIO@
#cmakedefine NANOCLR_PROFILE_NEW_CALLS @NANOCLR_PROFILE_NEW_CALLS@
#cmakedefine NANOCLR_PROFILE_NEW_ALLOCATIONS @NANOCLR_PROFILE_NEW_ALLOCATIONS@
#cmakedefine NANOCLR_TRACE_MEMORY_STATS @NANOCLR_TRACE_MEMORY_STATS@

#endif // TARGET_OS_H
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ message(STATUS "Build directory is '${CMAKE_BINARY_DIR}'.")
message(STATUS "")
#######################

#####################################
# include CLR Profiler build options
include(ClrProfilerOptions)
#####################################

#################################################################
# ouput RTM build option
Expand Down

0 comments on commit bc704dc

Please sign in to comment.