hpcrun: Integrate libmonitor
libmonitor
is a library hpcrun
uses to intercept important moments such as program start, thread creation, signal handling, etc. Unfortunately having libmonitor
as a separate library will not be compatible with various low-level improvements to hpcrun
, in particular #706 and #791. The rational solution is to integrate libmonitor
into the hpcrun
codebase first.
Current Issues / Rationale
libmonitor
is a library that, when LD_PRELOAD
'd, allows a client library (e.g. hpcrun
) to capture and intercept important moments of the application execution, such as program start and thread creation. It also handles tracking threads that are hung and shooting them down with signals at program termination if needed, among other features. However, hpcrun
requires far more than libmonitor
itself provides, leading to duplicated symbol wrapping tech in the hpcrun
codebase as well as extensions to the libmonitor
API to (hackily) ignore some threads (at various points) or add wrappers for certain signals. In addition, hpcrun
's own signal code is semi-incompatible with that in libmonitor
, meaning HPCToolkit is only compatible with a customized build of libmonitor
instead of a stock build. In practice, this leads to pointlessly tangled and underdesigned APIs between the shared libraries in question.
Doing this also prevents a number of semi-internal symbols from being exposed to the application, lowering the potential for application breakage and improving our overall cleanliness.
Proposed Solution
The libmonitor
source should be copied into the src/tool/hpcrun
directory and its source files linked into libhpcrun*
as appropriate. Any customizations required should be applied directly to the copied source code, the hpcrun
and hpclink
wrapper scripts should no longer do anything with libmonitor
, and the top-level --with-libmonitor
dependency should be dropped.
Affected Code Paths
- Build system
configure.ac
src/tool/hpcrun/Makefile.am