-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add callback function to get JSON Output strings #1798
Add callback function to get JSON Output strings #1798
Conversation
Thanks for the pull request! This looks useful! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything seems to work correctly. I have one question about the intended callback function...all of the other callbacks take a test
argument. For those callbacks (such as on_new_stream
, on_test_start
, etc.), the test
pointer gives all the information needed by the callback. The json_callback
is different, in that it looks like it only takes a string containing a JSON rendered object. Do you think that having the test
structure as well might be needed to give some context for working with the JSON? So then callback would take both a (iperf_test *)
and a (char *)
?
EDIT: I didn't need this change for the testing I had, but I'm just wondering if having a pointer to the test structure might be useful, say to refer to test parameters, etc.
Also, the code changes in #1805 that deal with existing callback hooks look relevant here as well. |
…anced per PR esnet#1805 (with rebase)
5a5957f
to
76c60ee
Compare
Completely agree. Added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, merging!
Version of iperf3 (or development branch, such as
master
or3.1-STABLE
) to which this pull request applies:master
Issues fixed (if any): How to use the iperf library to obtain bandwidth information in real-time at intervals? #1711
Brief description of code changes (suitable for use as a commit message):
Add
iperf_set_test_json_callback()
that allows a user app to set a callback function to get the JSON output strings, instead of printing them to the output file.