// Copyright 2014 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.// Implements methods to filter samples from profiles.package profile// TagMatch selects tags for filteringtypeTagMatchfunc(key, val string, nval int64) bool// FilterSamplesByTag removes all samples from the profile, except// those that match focus and do not match the ignore regular// expression.func ( *Profile) (, TagMatch) (, bool) { := make([]*Sample, 0, len(.Sample))for , := range .Sample { , := focusedSample(, , ) = || = || if && ! { = append(, ) } } .Sample = return}// focusedSample checks a sample against focus and ignore regexps.// Returns whether the focus/ignore regexps match any tags.func focusedSample( *Sample, , TagMatch) (, bool) { = == nilfor , := range .Label {for , := range {if != nil && (, , 0) { = true }if ! && (, , 0) { = true } } }for , := range .NumLabel {for , := range {if != nil && (, "", ) { = true }if ! && (, "", ) { = true } } }return , }
The pages are generated with Goldsv0.7.0-preview. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.