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

Enable top and div args for printing Type::avg maps #1416

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

suyuee
Copy link
Contributor

@suyuee suyuee commented Jul 10, 2020

The top and div arguments of print() currently does not work for avg maps
because it wasn't implemented. I think it makes sense to have them supported.

Resolves #1385.

Checklist
  • Language changes are updated in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md

@suyuee suyuee changed the title Enable top&div args for printing avg() maps Enable top and div args for printing Type::avg maps Jul 10, 2020
@suyuee suyuee marked this pull request as ready for review July 10, 2020 20:46
Copy link
Member

@danobi danobi left a comment

Choose a reason for hiding this comment

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

Two other things:

  • can you add a description of the change in the commit message?
  • can you add some tests? runtime tests seems like the right place to put it. It'll help prevent future regressions

src/output.cpp Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@suyuee suyuee force-pushed the print_map_avg branch 2 times, most recently from 2c9c4a2 to 8d3f9d1 Compare July 20, 2020 23:27
@suyuee
Copy link
Contributor Author

suyuee commented Jul 20, 2020

Add runtime tests.

@danobi
Copy link
Member

danobi commented Jul 21, 2020

Seems like the test has an off-by-one issue

@suyuee suyuee force-pushed the print_map_avg branch 7 times, most recently from 7b3d89c to 3d693b7 Compare July 21, 2020 17:38
@suyuee
Copy link
Contributor Author

suyuee commented Jul 21, 2020

Fixed the issue and add a runtime test for json format output. Seems like some tests are queued and won't run. Guess I'll push it later to rerun the tests.

The top and div arguments of `print()` currently does not work for avg maps
because it wasn't implemented. It makes sense to have them supported.

Resolves bpftrace#1385.
@suyuee
Copy link
Contributor Author

suyuee commented Jul 22, 2020

Push again to rerun the tests.

Copy link
Member

@danobi danobi left a comment

Choose a reason for hiding this comment

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

Thanks!

Can you follow this up with a semantic analyser change to disallow using print and div args with stats()?

@danobi danobi merged commit 00747bd into bpftrace:master Jul 22, 2020
@suyuee
Copy link
Contributor Author

suyuee commented Jul 22, 2020

Sure, already done:) #1433.

suyuee added a commit to suyuee/bpftrace that referenced this pull request Jul 23, 2020
The merged PR which enables `top` and `div` args of `print` for `avg` maps has
two issues that need addressing:

1. It came with subtractions of unsigned integers which can easily cause
negative overflows.
2. The runtime tests it came with are somehow unstable and fails randomly. This
patch brings more straightforward tests.
suyuee added a commit to suyuee/bpftrace that referenced this pull request Jul 23, 2020
The merged PR which enables `top` and `div` args of `print` for `avg` maps has
two issues that need addressing:

1. It came with subtractions of unsigned integers which can easily cause
negative overflows.
2. The runtime tests it came with are somehow unstable and fails randomly. This
patch brings more straightforward tests.
suyuee added a commit to suyuee/bpftrace that referenced this pull request Jul 24, 2020
The merged PR which enables `top` and `div` args of `print` for `avg` maps has
two issues that need addressing:

1. It came with subtractions of unsigned integers which can easily cause
negative overflows.
2. The runtime tests it came with are somehow unstable and fails randomly. This
patch brings more straightforward tests.
suyuee added a commit to suyuee/bpftrace that referenced this pull request Jul 28, 2020
The merged PR which enables `top` and `div` args of `print` for `avg` maps has
two issues that need addressing:

1. It came with subtractions of unsigned integers which can easily cause
negative overflows.
2. The runtime tests it came with are somehow unstable and fails randomly. This
patch brings more straightforward tests.
danobi pushed a commit that referenced this pull request Jul 28, 2020
The merged PR which enables `top` and `div` args of `print` for `avg` maps has
two issues that need addressing:

1. It came with subtractions of unsigned integers which can easily cause
negative overflows.
2. The runtime tests it came with are somehow unstable and fails randomly. This
patch brings more straightforward tests.
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.

top and divisor arguments don't work when printing an avg() map
3 participants