Skip to content

Commit 8edc08d

Browse files
committed
External feedback profiler: add minimal Hello→hash→World pipeline and multiple signal handling approaches
- New profiling/externalfeedback-profiler with: * C++ version (kp_externalfeedback_profiler.cpp) with optional daemon and signal trigger hook * Pure C version (externalfeedback_c.c/h) and signal-driven demo * Sigwait-based version (externalfeedback_sigwait.c/h) for robust POSIX signal handling * Demo runners: minimal C, POSIX C++, POSIX C signal, sigwait demo * Build scripts: build_and_run_c_signal.sh, build_and_run_sigwait.sh - Preserved previous implementation under profiling/monitoringfeedback-profiler-old - Added simplified monitoringfeedback-profiler variant for reference - Updated top-level CMakeLists.txt to wire new demos (non-invasive defaults) This commit unblocks environments without C++ std headers by providing pure C paths and a sigwait pattern, and includes scripts to run signal-driven demos.
1 parent 6493964 commit 8edc08d

280 files changed

Lines changed: 14847 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,50 @@ endif()
131131

132132
if(APPLE)
133133
message(STATUS "Apple OSX target detected.")
134+
# Diagnostics for SDK and toolchain
135+
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
136+
message(STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}")
137+
if(DEFINED CMAKE_OSX_SYSROOT)
138+
message(STATUS "CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT}")
139+
else()
140+
# Proactively set CMAKE_OSX_SYSROOT from xcrun if available
141+
find_program(XCRUN_EXECUTABLE xcrun)
142+
if(XCRUN_EXECUTABLE)
143+
execute_process(
144+
COMMAND ${XCRUN_EXECUTABLE} --show-sdk-path
145+
OUTPUT_VARIABLE XCRUN_SDK_PATH
146+
OUTPUT_STRIP_TRAILING_WHITESPACE
147+
ERROR_QUIET)
148+
if(XCRUN_SDK_PATH AND EXISTS ${XCRUN_SDK_PATH})
149+
set(CMAKE_OSX_SYSROOT ${XCRUN_SDK_PATH} CACHE PATH "macOS SDK root" FORCE)
150+
message(STATUS "CMAKE_OSX_SYSROOT was unset; set to: ${CMAKE_OSX_SYSROOT}")
151+
else()
152+
message(WARNING "CMAKE_OSX_SYSROOT is not set and xcrun did not return a valid SDK path. If you see missing system headers (e.g., <chrono>, <atomic>), ensure Xcode Command Line Tools are installed and selected. You can configure with: -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path)")
153+
endif()
154+
else()
155+
message(WARNING "xcrun not found. Install Xcode Command Line Tools: xcode-select --install")
156+
endif()
157+
endif()
158+
# Optional: probe SDK path via xcrun for user guidance
159+
find_program(XCRUN_EXECUTABLE xcrun)
160+
if(XCRUN_EXECUTABLE)
161+
execute_process(COMMAND ${XCRUN_EXECUTABLE} --show-sdk-path
162+
OUTPUT_VARIABLE XCRUN_SDK_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
163+
ERROR_QUIET)
164+
if(XCRUN_SDK_PATH)
165+
message(STATUS "xcrun --show-sdk-path: ${XCRUN_SDK_PATH}")
166+
endif()
167+
else()
168+
message(WARNING "xcrun not found. Install Xcode Command Line Tools: xcode-select --install")
169+
endif()
170+
endif()
171+
172+
# Proactive standard library header check to catch missing libc++/SDK
173+
include(CheckCXXSourceCompiles)
174+
set(_std_headers_test "#include <vector>\nint main(){ std::vector<int> v; v.push_back(1); return 0; }\n")
175+
check_cxx_source_compiles("${_std_headers_test}" HAVE_STD_HEADERS)
176+
if(NOT HAVE_STD_HEADERS)
177+
message(WARNING "C++ standard headers may be incomplete or not visible (libc++).\nDetected compiler: ${CMAKE_CXX_COMPILER}.\nThe build may fail if headers like <chrono> are needed.\nOn macOS, ensure CLT/Xcode SDK is installed and selected. Try: -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) or xcode-select --install.")
134178
endif()
135179

136180
# Utilities
@@ -154,6 +198,8 @@ if(NOT WIN32)
154198
add_subdirectory(profiling/chrome-tracing)
155199
add_subdirectory(profiling/space-time-stack)
156200
add_subdirectory(profiling/perfetto-connector)
201+
# Minimal external feedback demo (Hello->hash->World)
202+
add_subdirectory(profiling/externalfeedback-profiler)
157203
endif()
158204

159205
# External lib connectors

0 commit comments

Comments
 (0)