MCPcopy Create free account
hub / github.com/google/pprof / commonSampleTypes

Function commonSampleTypes

profile/merge.go:601–618  ·  view source on GitHub ↗

commonSampleTypes returns sample types that appear in all profiles in the order how they ordered in the first profile.

(ps []*Profile)

Source from the content-addressed store, hash-verified

599// commonSampleTypes returns sample types that appear in all profiles in the
600// order how they ordered in the first profile.
601func commonSampleTypes(ps []*Profile) []string {
602 if len(ps) == 0 {
603 return nil
604 }
605 sTypes := map[string]int{}
606 for _, p := range ps {
607 for _, st := range p.SampleType {
608 sTypes[st.Type]++
609 }
610 }
611 var res []string
612 for _, st := range ps[0].SampleType {
613 if sTypes[st.Type] == len(ps) {
614 res = append(res, st.Type)
615 }
616 }
617 return res
618}
619
620// compatibilizeSampleTypes drops sample types that are not present in sTypes
621// list and reorder them if needed.

Callers 1

CompatibilizeSampleTypesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…