Преглед на файлове

Revert "Add mechanism to reduce profile size"

This reverts commit 9c191ebbce.
The trimproto option is no longer needed, removing it to avoid code growth.
Raul Silvera преди 9 години
родител
ревизия
12a41b40ad
променени са 3 файла, в които са добавени 1 реда и са изтрити 44 реда
  1. 0
    1
      internal/driver/commands.go
  2. 0
    25
      internal/graph/graph.go
  3. 1
    18
      internal/report/report.go

+ 0
- 1
internal/driver/commands.go Целия файл

@@ -93,7 +93,6 @@ var pprofCommands = commands{
93 93
 	// Save binary formats to a file
94 94
 	"callgrind": {report.Callgrind, awayFromTTY("callgraph.out"), false, "Outputs a graph in callgrind format", reportHelp("callgrind", false, true)},
95 95
 	"proto":     {report.Proto, awayFromTTY("pb.gz"), false, "Outputs the profile in compressed protobuf format", ""},
96
-	"trimproto": {report.TrimProto, awayFromTTY("pb.gz"), false, "Outputs the profile in compressed protobuf format, removing info about infrequent functions to reduce profile size", ""},
97 96
 
98 97
 	// Generate report in DOT format and postprocess with dot
99 98
 	"gif": {report.Dot, invokeDot("gif"), false, "Outputs a graph image in GIF format", reportHelp("gif", false, true)},

+ 0
- 25
internal/graph/graph.go Целия файл

@@ -347,31 +347,6 @@ func joinLabels(s *profile.Sample) string {
347 347
 	return strings.Join(labels, `\n`)
348 348
 }
349 349
 
350
-// TrimProfile reduces the size of a profile by removing information
351
-// about locations that contribute to infrequent graph nodes,
352
-// determined by the value of nodefraction. The locations are
353
-// preserved, but their line information is removed.
354
-func TrimProfile(p *profile.Profile, o *Options, nodeFraction float64) *profile.Profile {
355
-	g, locationMap := newGraph(p, o)
356
-
357
-	totalValue, _ := g.Nodes.Sum()
358
-	cutoff := abs64(int64(float64(totalValue) * nodeFraction))
359
-
360
-	for _, l := range p.Location {
361
-		nodes := locationMap[l.ID]
362
-		if len(nodes) == 0 || len(l.Line) != len(nodes) {
363
-			continue
364
-		}
365
-		for i, n := range nodes {
366
-			if n.Cum < cutoff {
367
-				l.Line[i] = profile.Line{}
368
-			}
369
-		}
370
-	}
371
-
372
-	return p.Compact()
373
-}
374
-
375 350
 // isNegative returns true if the node is considered as "negative" for the
376 351
 // purposes of drop_negative.
377 352
 func isNegative(n *Node) bool {

+ 1
- 18
internal/report/report.go Целия файл

@@ -54,8 +54,6 @@ func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
54 54
 		return printTags(w, rpt)
55 55
 	case Proto:
56 56
 		return rpt.prof.Write(w)
57
-	case TrimProto:
58
-		return printTrimmedProto(w, rpt)
59 57
 	case TopProto:
60 58
 		return printTopProto(w, rpt)
61 59
 	case Dis:
@@ -197,10 +195,7 @@ func (rpt *Report) newGraph(nodes graph.NodeSet) *graph.Graph {
197 195
 		}
198 196
 		s.NumLabel = numLabels
199 197
 	}
200
-	return graph.New(rpt.prof, graphOptions(o, nodes))
201
-}
202 198
 
203
-func graphOptions(o *Options, nodes graph.NodeSet) *graph.Options {
204 199
 	gopt := &graph.Options{
205 200
 		SampleValue:  o.SampleValue,
206 201
 		FormatTag:    formatTag,
@@ -216,7 +211,7 @@ func graphOptions(o *Options, nodes graph.NodeSet) *graph.Options {
216 211
 		gopt.ObjNames = true
217 212
 	}
218 213
 
219
-	return gopt
214
+	return graph.New(rpt.prof, gopt)
220 215
 }
221 216
 
222 217
 func formatTag(v int64, key string) string {
@@ -272,17 +267,6 @@ func printTopProto(w io.Writer, rpt *Report) error {
272 267
 	return out.Write(w)
273 268
 }
274 269
 
275
-// printTrimmedProto writes a profile in a serialize profile.proto,
276
-// removing symbol information from infrequent nodes to reduce the
277
-// size of the profile.
278
-func printTrimmedProto(w io.Writer, rpt *Report) error {
279
-	o := rpt.options
280
-	prof := rpt.prof
281
-	prof = graph.TrimProfile(prof, graphOptions(o, nil), o.NodeFraction)
282
-
283
-	return prof.Write(w)
284
-}
285
-
286 270
 // printAssembly prints an annotated assembly listing.
287 271
 func printAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
288 272
 	o := rpt.options
@@ -871,7 +855,6 @@ const (
871 855
 	WebList
872 856
 	Callgrind
873 857
 	TopProto
874
-	TrimProto
875 858
 )
876 859
 
877 860
 // Options are the formatting and filtering options used to generate a