commonSampleTypes returns sample types that appear in all profiles in the order how they ordered in the first profile.
(ps []*Profile)
| 599 | // commonSampleTypes returns sample types that appear in all profiles in the |
| 600 | // order how they ordered in the first profile. |
| 601 | func 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…