| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT. |
| 5 |
// To regenerate this file run "make genpdata". |
| 6 |
|
| 7 |
package pprofile |
| 8 |
|
| 9 |
import ( |
| 10 |
"go.opentelemetry.io/collector/pdata/internal" |
| 11 |
"go.opentelemetry.io/collector/pdata/pcommon" |
| 12 |
) |
| 13 |
|
| 14 |
// Sample represents each record value encountered within a profiled program. |
| 15 |
// |
| 16 |
// This is a reference type, if passed by value and callee modifies it the |
| 17 |
// caller will see the modification. |
| 18 |
// |
| 19 |
// Must use NewSample function to create new instances. |
| 20 |
// Important: zero-initialized instance is not valid for use. |
| 21 |
type Sample struct { |
| 22 |
orig *internal.Sample |
| 23 |
state *internal.State |
| 24 |
} |
| 25 |
|
| 26 |
func newSample(orig *internal.Sample, state *internal.State) Sample { |
| 27 |
return Sample{orig: orig, state: state} |
| 28 |
} |
| 29 |
|
| 30 |
// NewSample creates a new empty Sample. |
| 31 |
// |
| 32 |
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice, |
| 33 |
// OR directly access the member if this is embedded in another struct. |
| 34 |
func NewSample() Sample { |
| 35 |
return newSample(internal.NewSample(), internal.NewState()) |
| 36 |
} |
| 37 |
|
| 38 |
// MoveTo moves all properties from the current struct overriding the destination and |
| 39 |
// resetting the current instance to its zero value |
| 40 |
func (ms Sample) MoveTo(dest Sample) { |
| 41 |
ms.state.AssertMutable() |
| 42 |
dest.state.AssertMutable() |
| 43 |
// If they point to the same data, they are the same, nothing to do. |
| 44 |
if ms.orig == dest.orig { |
| 45 |
return |
| 46 |
} |
| 47 |
internal.DeleteSample(dest.orig, false) |
| 48 |
*dest.orig, *ms.orig = *ms.orig, *dest.orig |
| 49 |
} |
| 50 |
|
| 51 |
// StackIndex returns the stackindex associated with this Sample. |
| 52 |
func (ms Sample) StackIndex() int32 { |
| 53 |
return ms.orig.StackIndex |
| 54 |
} |
| 55 |
|
| 56 |
// SetStackIndex replaces the stackindex associated with this Sample. |
| 57 |
func (ms Sample) SetStackIndex(v int32) { |
| 58 |
ms.state.AssertMutable() |
| 59 |
ms.orig.StackIndex = v |
| 60 |
} |
| 61 |
|
| 62 |
// Values returns the Values associated with this Sample. |
| 63 |
func (ms Sample) Values() pcommon.Int64Slice { |
| 64 |
return pcommon.Int64Slice(internal.NewInt64SliceWrapper(&ms.orig.Values, ms.state)) |
| 65 |
} |
| 66 |
|
| 67 |
// AttributeIndices returns the AttributeIndices associated with this Sample. |
| 68 |
func (ms Sample) AttributeIndices() pcommon.Int32Slice { |
| 69 |
return pcommon.Int32Slice(internal.NewInt32SliceWrapper(&ms.orig.AttributeIndices, ms.state)) |
| 70 |
} |
| 71 |
|
| 72 |
// LinkIndex returns the linkindex associated with this Sample. |
| 73 |
func (ms Sample) LinkIndex() int32 { |
| 74 |
return ms.orig.LinkIndex |
| 75 |
} |
| 76 |
|
| 77 |
// SetLinkIndex replaces the linkindex associated with this Sample. |
| 78 |
func (ms Sample) SetLinkIndex(v int32) { |
| 79 |
ms.state.AssertMutable() |
| 80 |
ms.orig.LinkIndex = v |
| 81 |
} |
| 82 |
|
| 83 |
// TimestampsUnixNano returns the TimestampsUnixNano associated with this Sample. |
| 84 |
func (ms Sample) TimestampsUnixNano() pcommon.UInt64Slice { |
| 85 |
return pcommon.UInt64Slice(internal.NewUInt64SliceWrapper(&ms.orig.TimestampsUnixNano, ms.state)) |
| 86 |
} |
| 87 |
|
| 88 |
// CopyTo copies all properties from the current struct overriding the destination. |
| 89 |
func (ms Sample) CopyTo(dest Sample) { |
| 90 |
dest.state.AssertMutable() |
| 91 |
internal.CopySample(dest.orig, ms.orig) |
| 92 |
} |