Scale multiplies all sample values in a profile by a constant and keeps only samples that have at least one non-zero value.
(ratio float64)
| 776 | // Scale multiplies all sample values in a profile by a constant and keeps |
| 777 | // only samples that have at least one non-zero value. |
| 778 | func (p *Profile) Scale(ratio float64) { |
| 779 | if ratio == 1 { |
| 780 | return |
| 781 | } |
| 782 | ratios := make([]float64, len(p.SampleType)) |
| 783 | for i := range p.SampleType { |
| 784 | ratios[i] = ratio |
| 785 | } |
| 786 | p.ScaleN(ratios) |
| 787 | } |
| 788 | |
| 789 | // ScaleN multiplies each sample values in a sample by a different amount |
| 790 | // and keeps only samples that have at least one non-zero value. |