diff --git a/profiler/profile.go b/profiler/profile.go index 05f3d91f5a..783b58c6fd 100644 --- a/profiler/profile.go +++ b/profiler/profile.go @@ -389,22 +389,6 @@ func (fdp *fastDeltaProfiler) Delta(data []byte) (b []byte, err error) { return b, nil } -// PprofDiff computes the delta between all values b-a and returns them as a new -// profile. Samples that end up with a delta of 0 are dropped. WARNING: Profile -// a will be mutated by this function. You should pass a copy if that's -// undesirable. -// -// Deprecated: This function was introduced into our public API unintentionally. -// It will be removed in the next release. If you need this functionality, -// it can be implemented in two lines: -// -// a.Scale(-1) -// return pprofile.Merge([]*pprofile.Profile{a, b}) -func PprofDiff(a, b *pprofile.Profile) (*pprofile.Profile, error) { - a.Scale(-1) - return pprofile.Merge([]*pprofile.Profile{a, b}) -} - func goroutineDebug2ToPprof(r io.Reader, w io.Writer, t time.Time) (err error) { // gostackparse.Parse() has been extensively tested and should not crash // under any circumstances, but we really want to avoid crashing a customers diff --git a/profiler/profile_test.go b/profiler/profile_test.go index ac58c908f9..0cde6e5bec 100644 --- a/profiler/profile_test.go +++ b/profiler/profile_test.go @@ -418,7 +418,8 @@ func requirePprofEqual(t *testing.T, a, b []byte) { require.NoError(t, err) pprofB, err := pprofile.ParseData(b) require.NoError(t, err) - pprofDiff, err := PprofDiff(pprofA, pprofB) + pprofA.Scale(-1) + pprofDiff, err := pprofile.Merge([]*pprofile.Profile{pprofA, pprofB}) require.NoError(t, err) require.Len(t, pprofDiff.Sample, 0) }