Browse Source

Merge pull request #18 from rauls5382/varset

Add mechanism for extensions to set variable defaults
Josef Jelinek 9 years ago
parent
commit
c82ebe2745
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      internal/driver/commands.go

+ 8
- 0
internal/driver/commands.go View File

68
 	pprofCommands[cmd] = &command{format, post, false, desc, usage}
68
 	pprofCommands[cmd] = &command{format, post, false, desc, usage}
69
 }
69
 }
70
 
70
 
71
+// SetVariableDefault sets the default value for a pprof
72
+// variable. This enables extensions to set their own defaults.
73
+func SetVariableDefault(variable, value string) {
74
+	if v := pprofVariables[variable]; v != nil {
75
+		v.value = value
76
+	}
77
+}
78
+
71
 // PostProcessor is a function that applies post-processing to the report output
79
 // PostProcessor is a function that applies post-processing to the report output
72
 type PostProcessor func(input []byte, output io.Writer, ui plugin.UI) error
80
 type PostProcessor func(input []byte, output io.Writer, ui plugin.UI) error
73
 
81