Просмотр исходного кода

Rename functions to make code more readable

Raul Silvera 8 лет назад
Родитель
Сommit
5ff215ca66
2 измененных файлов: 5 добавлений и 5 удалений
  1. 1
    1
      internal/symbolizer/symbolizer.go
  2. 4
    4
      profile/filter.go

+ 1
- 1
internal/symbolizer/symbolizer.go Просмотреть файл

@@ -292,7 +292,7 @@ func newMapping(prof *profile.Profile, obj plugin.ObjTool, ui plugin.UI, force b
292 292
 			missingBinaries = true
293 293
 			continue
294 294
 		}
295
-		
295
+
296 296
 		// Skip well-known system mappings
297 297
 		name := filepath.Base(m.File)
298 298
 		if name == "[vdso]" || strings.HasPrefix(name, "linux-vdso") {

+ 4
- 4
profile/filter.go Просмотреть файл

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