Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USDT is missing documentation #122

Open
krzysiek4321 opened this issue Feb 22, 2025 · 1 comment
Open

USDT is missing documentation #122

krzysiek4321 opened this issue Feb 22, 2025 · 1 comment

Comments

@krzysiek4321
Copy link

As of now the only mention of usdt outside of libbpf function definitions is in program types, which comes from libbpf.

We could start by including this comment from libbpf source code.

Linux kernel selftests is a comprehensive example that I think should be at least linked in documentation.

I'd love to see a section about setting up and using semaphores with USDT as I'm having problems with that.
I couldn't yet figure out how when checking with readelf -n executable to make semaphore non zero.

My understanding is that for usdt with provider "customProvider" and name "probe_name" one should create a global variable like this
unsigned short customProvider_probe_name_semaphore SEC(".probes");
But this doesn't work for me.

I hope you find this issue worth pursuing.
Best regards,
Krzysztof

@krzysiek4321
Copy link
Author

Never mind about semaphore issue.

I've checked in sys/sdt.h and learned that you need to define _SDT_HAS_SEMAPHORES
to have them working.
Here is the snipped of code from sys/sdt.h

#if defined _SDT_HAS_SEMAPHORES
#define _SDT_SEMAPHORE(p,n) \
        _SDT_ASM_1(             _SDT_ASM_ADDR p##_##n##_semaphore)
#else
#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1(         _SDT_ASM_ADDR 0)
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant