本文整理汇总了Golang中cmd/internal/pprof/profile.Profile.FilterSamplesByName方法的典型用法代码示例。如果您正苦于以下问题:Golang Profile.FilterSamplesByName方法的具体用法?Golang Profile.FilterSamplesByName怎么用?Golang Profile.FilterSamplesByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmd/internal/pprof/profile.Profile
的用法示例。
在下文中一共展示了Profile.FilterSamplesByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: preprocess
// preprocess does filtering and aggregation of a profile based on the
// requested options.
func preprocess(prof *profile.Profile, ui plugin.UI, f *flags) error {
if *f.flagFocus != "" || *f.flagIgnore != "" || *f.flagHide != "" {
focus, ignore, hide, err := compileFocusIgnore(*f.flagFocus, *f.flagIgnore, *f.flagHide)
if err != nil {
return err
}
fm, im, hm := prof.FilterSamplesByName(focus, ignore, hide)
warnNoMatches(fm, *f.flagFocus, "Focus", ui)
warnNoMatches(im, *f.flagIgnore, "Ignore", ui)
warnNoMatches(hm, *f.flagHide, "Hide", ui)
}
if *f.flagTagFocus != "" || *f.flagTagIgnore != "" {
focus, err := compileTagFilter(*f.flagTagFocus, ui)
if err != nil {
return err
}
ignore, err := compileTagFilter(*f.flagTagIgnore, ui)
if err != nil {
return err
}
fm, im := prof.FilterSamplesByTag(focus, ignore)
warnNoMatches(fm, *f.flagTagFocus, "TagFocus", ui)
warnNoMatches(im, *f.flagTagIgnore, "TagIgnore", ui)
}
return aggregate(prof, f)
}