javaCPUProfile returns a new Profile from profilez data. b is the profile bytes after the header, period is the profiling period, and parse is a function to parse 8-byte chunks from the profile in its native endianness.
(b []byte, period int64, parse func(b []byte) (uint64, []byte))
| 40 | // period, and parse is a function to parse 8-byte chunks from the |
| 41 | // profile in its native endianness. |
| 42 | func javaCPUProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte)) (*Profile, error) { |
| 43 | p := &Profile{ |
| 44 | Period: period * 1000, |
| 45 | PeriodType: &ValueType{Type: "cpu", Unit: "nanoseconds"}, |
| 46 | SampleType: []*ValueType{{Type: "samples", Unit: "count"}, {Type: "cpu", Unit: "nanoseconds"}}, |
| 47 | } |
| 48 | var err error |
| 49 | var locs map[uint64]*Location |
| 50 | if b, locs, err = parseCPUSamples(b, parse, false, p); err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | |
| 54 | if err = parseJavaLocations(b, locs, p); err != nil { |
| 55 | return nil, err |
| 56 | } |
| 57 | |
| 58 | // Strip out addresses for better merge. |
| 59 | if err = p.Aggregate(true, true, true, true, false, false); err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | |
| 63 | return p, nil |
| 64 | } |
| 65 | |
| 66 | // parseJavaProfile returns a new profile from heapz or contentionz |
| 67 | // data. b is the profile bytes after the header. |
no test coverage detected
searching dependent graphs…