Add thapi_start() and thapi_stop() - #454
Open
thilinarmtb wants to merge 54 commits into
Open
Conversation
3 tasks
thilinarmtb
force-pushed
the
thapi_on_and_off_v2
branch
2 times, most recently
from
December 5, 2025 17:38
8120018 to
7a184b7
Compare
thilinarmtb
force-pushed
the
thapi_on_and_off_v2
branch
5 times, most recently
from
January 27, 2026 21:32
19954ee to
9817061
Compare
Contributor
Author
|
@TApplencourt : Two tests fail out of the three tests used to check the toggle API. Those two fail |
Collaborator
|
I can show you how to do it tomorrow : ) |
Contributor
Author
Works for me. |
thilinarmtb
force-pushed
the
thapi_on_and_off_v2
branch
9 times, most recently
from
February 5, 2026 22:49
889b0d5 to
7ae17f3
Compare
thilinarmtb
force-pushed
the
thapi_on_and_off_v2
branch
6 times, most recently
from
July 16, 2026 17:50
fa70166 to
c4ebb89
Compare
This is done by adding `__attribute((constructor))__` to `thapi_stop()`. Added an autotools check to see if the compiler supports `__attribute((constructor))__`.
and install `thapi_profiler.h` header files to provied declarations of `thapi_start()` and `thapi_stop()`.
* Fix a logic error in thapi_auto_stop callback * Print error messages to stderr
thilinarmtb
force-pushed
the
thapi_on_and_off_v2
branch
from
July 16, 2026 18:13
c4ebb89 to
547ce95
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I created
lttng_ust_toggleevent category and implementedthapi_start()andthapi_stop()user APIs (in a similar spirit to
cudaProfilerStart()etc.). The library which the user has to linkagainst is named
libThapi.so.Usage of the API is as follows:
If
libThapi.sois linked,thapi_auto_stop()(which is not part of the user API) is called automaticallyduring the library load time using
__attribute__((constructor)). I added a check inconfigure.actocheck if the compiler supports
__attribute__((constructor)).If the user runs
iprofwith--toggle-on, the traces generated bythapi_auto_stop(),thapi_start()and
thapi_stop()will be respected bybabeltrace(otherwise there is no change toiprof/babeltracebehavior). Since
thapi_auto_stop()is called automatically,babeltracewill filter out all of the tracestill it see a
thapi_start(). Trace filtering out will start again once the user callthapi_stop(). This APIonly affects the trace collection of the calling process/thread.
P.S: This feature requires
lttng-ust >= 2.12.8. Specifically, this fix.TODO
Respectlttng_ust_profiler_*lttng_ust_toggle_*events when calculating statisticsfilter.toggle.toggletobabeltracegraph