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 ShowFrom and HideFrom filters to profile filter lib #361

Closed
wants to merge 1 commit into from

Conversation

lvng
Copy link
Contributor

@lvng lvng commented Apr 16, 2018

  • Added HideFrom and ShowFrom filters.
  • They are not yet exposed as command line flags. This change is pretty big so I thought it would be helpful to keep it minimal but I could add that here if desired. I plan to add that in another change.
  • Added lots of test cases for interactions between filters, as well as handling of locations with empty lines.

@codecov-io
Copy link

codecov-io commented Apr 16, 2018

Codecov Report

Merging #361 into master will increase coverage by 0.32%.
The diff coverage is 98.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #361      +/-   ##
==========================================
+ Coverage   66.64%   66.97%   +0.32%     
==========================================
  Files          36       36              
  Lines        7448     7528      +80     
==========================================
+ Hits         4964     5042      +78     
- Misses       2082     2083       +1     
- Partials      402      403       +1
Impacted Files Coverage Δ
internal/driver/driver_focus.go 84.87% <100%> (ø) ⬆️
profile/filter.go 89.61% <98.07%> (+6.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6167805...9d9157a. Read the comment docs.

@@ -21,9 +21,19 @@ import "regexp"
// FilterSamplesByName filters the samples in a profile and only keeps
// samples where at least one frame matches focus but none match ignore.
// Returns true is the corresponding regexp matched at least one sample.
func (p *Profile) FilterSamplesByName(focus, ignore, hide, show *regexp.Regexp) (fm, im, hm, hnm bool) {
func (p *Profile) FilterSamplesByName(focus, ignore, showFrom, hideFrom, show, hide *regexp.Regexp) (fm, im, sfm, hfm, sm, hm bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function has become too complicated now. I would make it a separate function, something like ShowHideFrom and put it to prune.go, next to PruneFrom, since the functionality is rather related to pruning. Having the function separate would make the code and the tests more focused and easier to read.

@aalexand
Copy link
Collaborator

aalexand commented May 3, 2018

This PR is superseded by #372, closing.

@aalexand aalexand closed this May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants