-
Notifications
You must be signed in to change notification settings - Fork 16
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
ON-16111: use monitor thread in zfsink to allow testing higher rates #50
Conversation
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.
The only data used by the monitor thread is n_rx_pkts and n_rx_bytes but you've created a data structure with a lot more in it.
I think this update would be possible with more minimal changes to the app if just n_rx_pkts and n_rx_bytes were shared.
Could you also add some examples of the output from testing?
I refactored the code to just pass the resource structure between functions because this felt cleaner to me and was also the approach used for Result from testing different options:
|
Thanks for the output, looks fine.
efsink needs to manage packet buffers so there is more need to share state. I'd rather have a minimal code change here - e.g. suggest just adding a couple of global stats counters and then most of the changes to existing code won't be needed. Code can always be refactored later if more data needs to be shared but doesn't seem necessary here. |
2039470
to
78c2e57
Compare
src/tests/zf_apps/zfsink.c
Outdated
@@ -290,6 +347,8 @@ int main(int argc, char* argv[]) | |||
if( cfg_rx_timestamping ) | |||
ZF_TRY(zf_attr_set_int(attr, "rx_timestamping", 1)); | |||
|
|||
ZF_TRY((res = calloc(1, sizeof(*res))) != NULL); |
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.
Given this is just a small test app, I think we could just have a single global instance of struct resources rather than dynamically allocating and passing around the functions.
f616b52
to
48c4f03
Compare
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.
Looks good to me
|
||
|
||
static bool cfg_quiet = false; | ||
static bool cfg_rx_timestamping = false; | ||
static struct resources res; |
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.
minor comment - I would use
static struct resources res = {0};
here and save the lines initialising later in main()
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.
Objects with static
storage duration will implicitly be empty-initialised, so the current declaration is sufficient to set the values to 0.
48c4f03
to
c76db0e
Compare
c76db0e
to
ed9ea55
Compare
Modified zfsink to use a monitoring thread to output traffic rate every second, as with efsink in Onload.
Tested with high packet rate (>5Mpps) and high throughput (>9Gbps) to confirm output is correctly formatted.
Timestamps work as before and are output every packet.
Monitoring thread can be disabled using '-q'.