浏览代码

Rename functions to make code more readable

Raul Silvera 8 年前
父节点
当前提交
5ff215ca66
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 1
    1
      internal/symbolizer/symbolizer.go
  2. 4
    4
      profile/filter.go

+ 1
- 1
internal/symbolizer/symbolizer.go 查看文件

292
 			missingBinaries = true
292
 			missingBinaries = true
293
 			continue
293
 			continue
294
 		}
294
 		}
295
-		
295
+
296
 		// Skip well-known system mappings
296
 		// Skip well-known system mappings
297
 		name := filepath.Base(m.File)
297
 		name := filepath.Base(m.File)
298
 		if name == "[vdso]" || strings.HasPrefix(name, "linux-vdso") {
298
 		if name == "[vdso]" || strings.HasPrefix(name, "linux-vdso") {

+ 4
- 4
profile/filter.go 查看文件

76
 // FilterTagsByName filters the tags in a profile and only keeps
76
 // FilterTagsByName filters the tags in a profile and only keeps
77
 // tags that match show and not hide.
77
 // tags that match show and not hide.
78
 func (p *Profile) FilterTagsByName(show, hide *regexp.Regexp) (sm, hm bool) {
78
 func (p *Profile) FilterTagsByName(show, hide *regexp.Regexp) (sm, hm bool) {
79
-	matchShow := func(name string) bool {
79
+	matchRemove := func(name string) bool {
80
 		matchShow := show == nil || show.MatchString(name)
80
 		matchShow := show == nil || show.MatchString(name)
81
 		matchHide := hide != nil && hide.MatchString(name)
81
 		matchHide := hide != nil && hide.MatchString(name)
82
 
82
 
86
 		if matchHide {
86
 		if matchHide {
87
 			hm = true
87
 			hm = true
88
 		}
88
 		}
89
-		return matchShow && !matchHide
89
+		return !matchShow || matchHide
90
 	}
90
 	}
91
 	for _, s := range p.Sample {
91
 	for _, s := range p.Sample {
92
 		for lab := range s.Label {
92
 		for lab := range s.Label {
93
-			if !matchShow(lab) {
93
+			if matchRemove(lab) {
94
 				delete(s.Label, lab)
94
 				delete(s.Label, lab)
95
 			}
95
 			}
96
 		}
96
 		}
97
 		for lab := range s.NumLabel {
97
 		for lab := range s.NumLabel {
98
-			if !matchShow(lab) {
98
+			if matchRemove(lab) {
99
 				delete(s.NumLabel, lab)
99
 				delete(s.NumLabel, lab)
100
 			}
100
 			}
101
 		}
101
 		}