|
@@ -55,16 +55,15 @@ const (
|
55
|
55
|
type Options struct {
|
56
|
56
|
OutputFormat int
|
57
|
57
|
|
58
|
|
- CumSort bool
|
59
|
|
- CallTree bool
|
60
|
|
- DropNegative bool
|
61
|
|
- PositivePercentages bool
|
62
|
|
- CompactLabels bool
|
63
|
|
- Ratio float64
|
64
|
|
- Title string
|
65
|
|
- ProfileLabels []string
|
66
|
|
- ActiveFilters []string
|
67
|
|
- NumLabelUnits map[string]string
|
|
58
|
+ CumSort bool
|
|
59
|
+ CallTree bool
|
|
60
|
+ DropNegative bool
|
|
61
|
+ CompactLabels bool
|
|
62
|
+ Ratio float64
|
|
63
|
+ Title string
|
|
64
|
+ ProfileLabels []string
|
|
65
|
+ ActiveFilters []string
|
|
66
|
+ NumLabelUnits map[string]string
|
68
|
67
|
|
69
|
68
|
NodeCount int
|
70
|
69
|
NodeFraction float64
|
|
@@ -1192,7 +1191,7 @@ func New(prof *profile.Profile, o *Options) *Report {
|
1192
|
1191
|
}
|
1193
|
1192
|
return measurement.ScaledLabel(v, o.SampleUnit, o.OutputUnit)
|
1194
|
1193
|
}
|
1195
|
|
- return &Report{prof, computeTotal(prof, o.SampleValue, o.SampleMeanDivisor, !o.PositivePercentages),
|
|
1194
|
+ return &Report{prof, computeTotal(prof, o.SampleValue, o.SampleMeanDivisor),
|
1196
|
1195
|
o, format}
|
1197
|
1196
|
}
|
1198
|
1197
|
|
|
@@ -1213,11 +1212,8 @@ func NewDefault(prof *profile.Profile, options Options) *Report {
|
1213
|
1212
|
}
|
1214
|
1213
|
|
1215
|
1214
|
// computeTotal computes the sum of all sample values. This will be
|
1216
|
|
-// used to compute percentages. If includeNegative is set, use use
|
1217
|
|
-// absolute values to provide a meaningful percentage for both
|
1218
|
|
-// negative and positive values. Otherwise only use positive values,
|
1219
|
|
-// which is useful when comparing profiles from different jobs.
|
1220
|
|
-func computeTotal(prof *profile.Profile, value, meanDiv func(v []int64) int64, includeNegative bool) int64 {
|
|
1215
|
+// used to compute percentages.
|
|
1216
|
+func computeTotal(prof *profile.Profile, value, meanDiv func(v []int64) int64) int64 {
|
1221
|
1217
|
var div, ret int64
|
1222
|
1218
|
for _, sample := range prof.Sample {
|
1223
|
1219
|
var d, v int64
|
|
@@ -1225,13 +1221,11 @@ func computeTotal(prof *profile.Profile, value, meanDiv func(v []int64) int64, i
|
1225
|
1221
|
if meanDiv != nil {
|
1226
|
1222
|
d = meanDiv(sample.Value)
|
1227
|
1223
|
}
|
1228
|
|
- if v >= 0 {
|
1229
|
|
- ret += v
|
1230
|
|
- div += d
|
1231
|
|
- } else if includeNegative {
|
1232
|
|
- ret -= v
|
1233
|
|
- div += d
|
|
1224
|
+ if v < 0 {
|
|
1225
|
+ v = -v
|
1234
|
1226
|
}
|
|
1227
|
+ ret += v
|
|
1228
|
+ div += d
|
1235
|
1229
|
}
|
1236
|
1230
|
if div != 0 {
|
1237
|
1231
|
return ret / div
|