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

funclatency: user functions support #733

Merged
merged 3 commits into from
Oct 6, 2016

Conversation

goldshtn
Copy link
Collaborator

@goldshtn goldshtn commented Oct 6, 2016

This introduces user functions support in funclatency. It's quite useful as a mini-profiler or just another way to quickly probe the latency of a particular function in user space.

Usage examples:

funclatency pthread:*mutex* -p 6449 -F
funclatency c:read
funclatency dd:* -p $(pidof dd) -uF

When histogram keys are complex structures (`ct.Structure`
created from C struct), they can't be used as dictionary keys
for counting purposes without a custom hashing function.
Allow the user to provide such hashing function when calling
`print_log_hist` to print the histogram.
Similarly to `attach_uprobe`, `attach_uretprobe` now supports
taking a regular expression.
funclatency now supports user functions (including regular
expressions) in addition to kernel functions. When multiple
processes are traced, the output is always per-function, per-
process. When a single process is traced, the output can be
combined for all traced functions (as with kernel functions).

Usage examples:

```
funclatency pthread:*mutex* -p 6449 -F
funclatency c:read
funclatency dd:* -p $(pidof dd) -uF
```
@4ast
Copy link
Member

4ast commented Oct 6, 2016

LGTM cc @brendangregg

@brendangregg
Copy link
Member

LGTM, and tested, works, and is pretty amazing. Thanks @goldshtn !

@4ast please merge (I don't have that button)

@goldshtn funccount next? :) I actually use funccount more than funclatency -- funccount is good for checking the rate of function calls before doing anything more expensive. Plus, my old perf-tools funccount is kernel only (ftrace); this will be the first funccount that can do both.

@brendangregg
Copy link
Member

... we'll eventually need to update the reference-guide for the other bits that have been added...

@4ast 4ast merged commit a466c46 into iovisor:master Oct 6, 2016
@goldshtn
Copy link
Collaborator Author

goldshtn commented Oct 6, 2016

@brendangregg Thanks :) Yes, funccount is next. Planning to add uprobes, tracepoints, and USDT to that one. Probably going to copy-pasta most of stackcount and then remove pieces. It's actually kind of annoying that there's so much duplication in all the general-purpose tools, but I think most of the reusable pieces are already in libbcc.

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

Successfully merging this pull request may close these issues.

3 participants