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

Add ability to clear statistics #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZachG-gnu
Copy link

See #117

Implements the functionality for clearing all statistics in the sample buffer
and the results struct by adding a API method that the user can call
while rttest is running.

Signed-off-by: Zach <zachmgoldstein@gmail.com>
@clalancette clalancette self-requested a review July 14, 2022 15:10
@clalancette clalancette self-assigned this Jul 14, 2022
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the questions inline, it would also be great to have tests for this new functionality.


output->minor_pagefaults = std::accumulate(
this->sample_buffer.minor_pagefaults.begin(),
this->sample_buffer.minor_pagefaults.begin() + this->cleared_iteration + 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding 1 here? Won't that always skip a sample somewhere along the way?

Comment on lines +806 to +811
// Reset the properties of the current results
this->results.max_latency = this->sample_buffer.latency_samples[i];
this->results.min_latency = this->results.max_latency;
this->results.mean_latency = this->results.max_latency;
this->results.minor_pagefaults = this->sample_buffer.minor_pagefaults[i];
this->results.major_pagefaults = this->sample_buffer.major_pagefaults[i];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be wrong in my understanding here, but this isn't really "clearing" the results. What it is doing is setting a marker at the current set of samples, and then we'll only consider samples from this point forward.

If my understanding is correct, then I think we should rename this function to reflect that usage more. Maybe "mark_statistics" or something like that?

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.

2 participants