55 "compress/gzip"
66 "io"
77
8+ "github.com/threadedstream/ppmerge/profile"
89 "google.golang.org/protobuf/proto"
910)
1011
@@ -35,7 +36,7 @@ func (gpm *GoroutineProfileMerger) WriteCompressed(w io.Writer) error {
3536 return err
3637}
3738
38- func (gpm * GoroutineProfileMerger ) Merge (gps ... * GoroutineProfile ) * MergedGoroutineProfile {
39+ func (gpm * GoroutineProfileMerger ) Merge (gps ... * profile. GoroutineProfile ) * MergedGoroutineProfile {
3940 gpm .mergedProfile .Totals = make ([]uint64 , 0 , len (gps ))
4041 gpm .mergedProfile .NumStacktraces = make ([]uint64 , 0 , len (gps ))
4142
@@ -45,16 +46,16 @@ func (gpm *GoroutineProfileMerger) Merge(gps ...*GoroutineProfile) *MergedGorout
4546 return gpm .mergedProfile
4647}
4748
48- func (gpm * GoroutineProfileMerger ) merge (gps ... * GoroutineProfile ) {
49- var resultStacktraces []* Stacktrace
49+ func (gpm * GoroutineProfileMerger ) merge (gps ... * profile. GoroutineProfile ) {
50+ var resultStacktraces []* profile. Stacktrace
5051 for _ , gp := range gps {
5152 gpm .mergedProfile .Totals = append (gpm .mergedProfile .Totals , gp .Total )
5253 stacktraces := gp .GetStacktraces ()
5354
5455 gpm .mergedProfile .NumStacktraces = append (gpm .mergedProfile .NumStacktraces , uint64 (len (stacktraces )))
5556
5657 for _ , st := range stacktraces {
57- resultStacktrace := new (Stacktrace )
58+ resultStacktrace := new (profile. Stacktrace )
5859 resultStacktrace .Total = st .Total
5960
6061 resultStacktrace .PC = make ([]uint64 , len (st .PC ))
@@ -65,7 +66,7 @@ func (gpm *GoroutineProfileMerger) merge(gps ...*GoroutineProfile) {
6566 resultStacktraces = append (resultStacktraces , resultStacktrace )
6667 continue
6768 }
68- resultStacktrace .Frames = make ([]* Frame , 0 , len (frames ))
69+ resultStacktrace .Frames = make ([]* profile. Frame , 0 , len (frames ))
6970 for _ , f := range frames {
7071 resultStacktrace .Frames = append (resultStacktrace .Frames , gpm .remapFrame (f , gp .StringTable ))
7172 }
@@ -76,8 +77,8 @@ func (gpm *GoroutineProfileMerger) merge(gps ...*GoroutineProfile) {
7677 gpm .mergedProfile .Stacktraces = resultStacktraces
7778}
7879
79- func (gpm * GoroutineProfileMerger ) remapFrame (frame * Frame , gpStringTable []string ) * Frame {
80- return & Frame {
80+ func (gpm * GoroutineProfileMerger ) remapFrame (frame * profile. Frame , gpStringTable []string ) * profile. Frame {
81+ return & profile. Frame {
8182 Address : frame .Address ,
8283 FunctionName : gpm .putString (gpStringTable [frame .FunctionName ]),
8384 Offset : frame .Offset ,
@@ -116,7 +117,7 @@ func NewGoroutineProfileUnPacker(mergedProfile *MergedGoroutineProfile) *Gorouti
116117 }
117118}
118119
119- func (gpu * GoroutineProfileUnPacker ) UnpackRaw (compressedRawProfile []byte , idx uint64 ) (* GoroutineProfile , error ) {
120+ func (gpu * GoroutineProfileUnPacker ) UnpackRaw (compressedRawProfile []byte , idx uint64 ) (* profile. GoroutineProfile , error ) {
120121 bb := bytes .NewBuffer (compressedRawProfile )
121122
122123 gzReader , err := gzip .NewReader (bb )
@@ -140,11 +141,11 @@ func (gpu *GoroutineProfileUnPacker) UnpackRaw(compressedRawProfile []byte, idx
140141 return gpu .Unpack (idx )
141142}
142143
143- func (gpu * GoroutineProfileUnPacker ) Unpack (idx uint64 ) (* GoroutineProfile , error ) {
144+ func (gpu * GoroutineProfileUnPacker ) Unpack (idx uint64 ) (* profile. GoroutineProfile , error ) {
144145 if idx >= uint64 (len (gpu .mergedProfile .NumStacktraces )) {
145146 return nil , indexOutOfRangeErr
146147 }
147- gp := GoroutineProfileFromVTPool ()
148+ gp := profile . GoroutineProfileFromVTPool ()
148149
149150 gp .Total = gpu .mergedProfile .Totals [idx ]
150151
@@ -157,7 +158,7 @@ func (gpu *GoroutineProfileUnPacker) Unpack(idx uint64) (*GoroutineProfile, erro
157158
158159 limit := offset + numStacktraces
159160
160- gp .Stacktraces = make ([]* Stacktrace , 0 , numStacktraces )
161+ gp .Stacktraces = make ([]* profile. Stacktrace , 0 , numStacktraces )
161162 for offset < limit {
162163 gp .Stacktraces = append (gp .Stacktraces , gpu .remapStacktrace (gpu .mergedProfile .Stacktraces [offset ]))
163164 offset ++
@@ -168,8 +169,8 @@ func (gpu *GoroutineProfileUnPacker) Unpack(idx uint64) (*GoroutineProfile, erro
168169 return gp , nil
169170}
170171
171- func (gpu * GoroutineProfileUnPacker ) remapStacktrace (st * Stacktrace ) * Stacktrace {
172- resultStacktrace := new (Stacktrace )
172+ func (gpu * GoroutineProfileUnPacker ) remapStacktrace (st * profile. Stacktrace ) * profile. Stacktrace {
173+ resultStacktrace := new (profile. Stacktrace )
173174 resultStacktrace .Total = st .Total
174175
175176 resultStacktrace .PC = make ([]uint64 , len (st .PC ))
@@ -180,16 +181,16 @@ func (gpu *GoroutineProfileUnPacker) remapStacktrace(st *Stacktrace) *Stacktrace
180181 return resultStacktrace
181182 }
182183
183- resultStacktrace .Frames = make ([]* Frame , 0 , len (st .Frames ))
184+ resultStacktrace .Frames = make ([]* profile. Frame , 0 , len (st .Frames ))
184185 for _ , f := range frames {
185186 resultStacktrace .Frames = append (resultStacktrace .Frames , gpu .remapFrame (f ))
186187 }
187188
188189 return resultStacktrace
189190}
190191
191- func (gpu * GoroutineProfileUnPacker ) remapFrame (frame * Frame ) * Frame {
192- return & Frame {
192+ func (gpu * GoroutineProfileUnPacker ) remapFrame (frame * profile. Frame ) * profile. Frame {
193+ return & profile. Frame {
193194 Address : frame .Address ,
194195 FunctionName : gpu .putString (gpu .mergedProfile .StringTable [frame .FunctionName ]),
195196 Offset : frame .Offset ,
@@ -198,7 +199,7 @@ func (gpu *GoroutineProfileUnPacker) remapFrame(frame *Frame) *Frame {
198199 }
199200}
200201
201- func (gpu * GoroutineProfileUnPacker ) finalizeStringTable (gp * GoroutineProfile ) {
202+ func (gpu * GoroutineProfileUnPacker ) finalizeStringTable (gp * profile. GoroutineProfile ) {
202203 gp .StringTable = make ([]string , len (gpu .stringTable ))
203204 for k , v := range gpu .stringTable {
204205 gp .StringTable [v ] = k
0 commit comments