github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/profile/merge.go (about) 1 // Copyright 2019 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package profile 6 7 // Merge merges all the profiles in profs into a single Profile. 8 // Returns a new profile independent of the input profiles. The merged 9 // profile is compacted to eliminate unused samples, locations, 10 // functions and mappings. Profiles must have identical profile sample 11 // and period types or the merge will fail. profile.Period of the 12 // resulting profile will be the maximum of all profiles, and 13 // profile.TimeNanos will be the earliest nonzero one. 14 func Merge(srcs []*Profile) (*Profile, error) 15 16 // Normalize normalizes the source profile by multiplying each value in profile by the 17 // ratio of the sum of the base profile's values of that sample type to the sum of the 18 // source profile's value of that sample type. 19 func (p *Profile) Normalize(pb *Profile) error