|
@@ -66,6 +66,7 @@ func interactive(p *profile.Profile, o *plugin.Options) error {
|
66
|
66
|
}
|
67
|
67
|
if v := pprofVariables[name]; v != nil {
|
68
|
68
|
if name == "sample_index" {
|
|
69
|
+ // Error check sample_index=xxx to ensure xxx is a valid sample type.
|
69
|
70
|
index, err := locateSampleIndex(p, value)
|
70
|
71
|
if err != nil {
|
71
|
72
|
o.UI.PrintErr(err)
|
|
@@ -78,6 +79,7 @@ func interactive(p *profile.Profile, o *plugin.Options) error {
|
78
|
79
|
}
|
79
|
80
|
continue
|
80
|
81
|
}
|
|
82
|
+ // Allow group=variable syntax by converting into variable="".
|
81
|
83
|
if v := pprofVariables[value]; v != nil && v.group == name {
|
82
|
84
|
if err := pprofVariables.set(value, ""); err != nil {
|
83
|
85
|
o.UI.PrintErr(err)
|
|
@@ -183,14 +185,17 @@ func printCurrentOptions(p *profile.Profile, ui plugin.UI) {
|
183
|
185
|
case n == "sample_index":
|
184
|
186
|
st := sampleTypes(p)
|
185
|
187
|
if v == "" {
|
|
188
|
+ // Apply default (last sample index).
|
186
|
189
|
v = st[len(st)-1]
|
187
|
190
|
}
|
|
191
|
+ // Add comments for all sample types in profile.
|
188
|
192
|
comment = "[" + strings.Join(st, " | ") + "]"
|
189
|
193
|
case n == "source_path":
|
190
|
194
|
continue
|
191
|
195
|
case n == "nodecount" && v == "-1":
|
192
|
196
|
comment = "default"
|
193
|
197
|
case v == "":
|
|
198
|
+ // Add quotes for empty values.
|
194
|
199
|
v = `""`
|
195
|
200
|
}
|
196
|
201
|
if comment != "" {
|
|
@@ -204,7 +209,7 @@ func printCurrentOptions(p *profile.Profile, ui plugin.UI) {
|
204
|
209
|
args = append(args, fmt.Sprintf(" %-25s = %-20s %s", g, vars.set, comment))
|
205
|
210
|
}
|
206
|
211
|
sort.Strings(args)
|
207
|
|
- ui.PrintErr(strings.Join(args, "\n"))
|
|
212
|
+ ui.Print(strings.Join(args, "\n"))
|
208
|
213
|
}
|
209
|
214
|
|
210
|
215
|
// parseCommandLine parses a command and returns the pprof command to
|