SampleType returns the set of value types present in samples recorded by the memory profiler.
()
| 96 | // SampleType returns the set of value types present in samples recorded by the |
| 97 | // memory profiler. |
| 98 | func (p *MemoryProfiler) SampleType() []*profile.ValueType { |
| 99 | sampleType := []*profile.ValueType{ |
| 100 | {Type: "alloc_objects", Unit: "count"}, |
| 101 | {Type: "alloc_space", Unit: "bytes"}, |
| 102 | } |
| 103 | |
| 104 | if p.inuse != nil { |
| 105 | // TODO: when can track freeing of garbage collected languages like Go, |
| 106 | // this should be enabled by default, and we can remove the slicing of |
| 107 | // sample values in buildProfile. |
| 108 | sampleType = append(sampleType, |
| 109 | &profile.ValueType{Type: "inuse_objects", Unit: "count"}, |
| 110 | &profile.ValueType{Type: "inuse_space", Unit: "bytes"}, |
| 111 | ) |
| 112 | } |
| 113 | |
| 114 | return sampleType |
| 115 | } |
| 116 | |
| 117 | type memorySample struct { |
| 118 | stack stackTrace |