Browse Source

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 years ago
parent
commit
12a41b40ad
3 changed files with 1 additions and 44 deletions
  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 View File

93
 	// Save binary formats to a file
93
 	// Save binary formats to a file
94
 	"callgrind": {report.Callgrind, awayFromTTY("callgraph.out"), false, "Outputs a graph in callgrind format", reportHelp("callgrind", false, true)},
94
 	"callgrind": {report.Callgrind, awayFromTTY("callgraph.out"), false, "Outputs a graph in callgrind format", reportHelp("callgrind", false, true)},
95
 	"proto":     {report.Proto, awayFromTTY("pb.gz"), false, "Outputs the profile in compressed protobuf format", ""},
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
 	// Generate report in DOT format and postprocess with dot
97
 	// Generate report in DOT format and postprocess with dot
99
 	"gif": {report.Dot, invokeDot("gif"), false, "Outputs a graph image in GIF format", reportHelp("gif", false, true)},
98
 	"gif": {report.Dot, invokeDot("gif"), false, "Outputs a graph image in GIF format", reportHelp("gif", false, true)},

+ 0
- 25
internal/graph/graph.go View File

347
 	return strings.Join(labels, `\n`)
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
 // isNegative returns true if the node is considered as "negative" for the
350
 // isNegative returns true if the node is considered as "negative" for the
376
 // purposes of drop_negative.
351
 // purposes of drop_negative.
377
 func isNegative(n *Node) bool {
352
 func isNegative(n *Node) bool {

+ 1
- 18
internal/report/report.go View File

54
 		return printTags(w, rpt)
54
 		return printTags(w, rpt)
55
 	case Proto:
55
 	case Proto:
56
 		return rpt.prof.Write(w)
56
 		return rpt.prof.Write(w)
57
-	case TrimProto:
58
-		return printTrimmedProto(w, rpt)
59
 	case TopProto:
57
 	case TopProto:
60
 		return printTopProto(w, rpt)
58
 		return printTopProto(w, rpt)
61
 	case Dis:
59
 	case Dis:
197
 		}
195
 		}
198
 		s.NumLabel = numLabels
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
 	gopt := &graph.Options{
199
 	gopt := &graph.Options{
205
 		SampleValue:  o.SampleValue,
200
 		SampleValue:  o.SampleValue,
206
 		FormatTag:    formatTag,
201
 		FormatTag:    formatTag,
216
 		gopt.ObjNames = true
211
 		gopt.ObjNames = true
217
 	}
212
 	}
218
 
213
 
219
-	return gopt
214
+	return graph.New(rpt.prof, gopt)
220
 }
215
 }
221
 
216
 
222
 func formatTag(v int64, key string) string {
217
 func formatTag(v int64, key string) string {
272
 	return out.Write(w)
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
 // printAssembly prints an annotated assembly listing.
270
 // printAssembly prints an annotated assembly listing.
287
 func printAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
271
 func printAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
288
 	o := rpt.options
272
 	o := rpt.options
871
 	WebList
855
 	WebList
872
 	Callgrind
856
 	Callgrind
873
 	TopProto
857
 	TopProto
874
-	TrimProto
875
 )
858
 )
876
 
859
 
877
 // Options are the formatting and filtering options used to generate a
860
 // Options are the formatting and filtering options used to generate a