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

Return-value matching #116

Open
gomoripeti opened this issue Nov 16, 2017 · 0 comments
Open

Return-value matching #116

gomoripeti opened this issue Nov 16, 2017 · 0 comments
Assignees
Milestone

Comments

@gomoripeti
Copy link
Collaborator

Allow to filter functions based on their return value (instead of arguments).

Apart from the XProf-flavoured match-spec takes an additional parameter
RetMatchFun which matches the value returned by the function. The call latency
is only measured if there is a match.

RetMatchFun receives the value returned by the traced function as a single
argument and can return:

  • false: no match, don't measure
  • true: match, measure and capture the original return value.
  • {true, NewValue}: match, measure and capture NewValue instead of the original return value.

If RetMatchFun is arity-2 it could match on an exception (class and reason). Should an arity-1 RetMatchFun match on exceptions of form {Class, Reason} too?
We can think of some shortcuts eg. as a convenience function_clause could mean no match (don't have to handle all return values, only the positive case, as in the second example below)

Query example (suggestion):

#retmatch matchfun: fun(List) -> lists:member(12, List) end, mfa: ...
#retmatch matchfun: fun(error, badarg) -> true end, mfa: ...

It would be useful if the graph would show both a total count (number of
return_trace messages) and matched count (only when matchfun matches) to see a
rate how oftern thr return value matches.

@natif natif self-assigned this Nov 23, 2017
@gomoripeti gomoripeti added this to the 2.0 milestone Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants