本文整理匯總了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)
}