ソースを参照

Expose sample_index argument through web ui (#412)

The option is exposed in the web ui's query string under a
new `?si=<sample_index>` parameter. This is particularly
useful for heap profiles, where switching between the four
indices (alloc_objects, alloc_space, inuse_objects, and inuse_space)
is a common task.

We could add a menu to the UI to make discovery of these
options easier, but for now this seems sufficient.
Nathan VanBenschoten 6 年 前
コミット
e98137b3ea
共有1 個のファイルを変更した2 個の追加0 個の削除を含む
  1. 2
    0
      internal/driver/webui.go

+ 2
- 0
internal/driver/webui.go ファイルの表示

@@ -201,6 +201,7 @@ func openBrowser(url string, o *plugin.Options) {
201 201
 		{"s", "show"},
202 202
 		{"i", "ignore"},
203 203
 		{"h", "hide"},
204
+		{"si", "sample_index"},
204 205
 	} {
205 206
 		if v := pprofVariables[p.key].value; v != "" {
206 207
 			q.Set(p.param, v)
@@ -232,6 +233,7 @@ func varsFromURL(u *gourl.URL) variables {
232 233
 	vars["show"].value = u.Query().Get("s")
233 234
 	vars["ignore"].value = u.Query().Get("i")
234 235
 	vars["hide"].value = u.Query().Get("h")
236
+	vars["sample_index"].value = u.Query().Get("si")
235 237
 	return vars
236 238
 }
237 239