()
| 109 | ) |
| 110 | |
| 111 | func init() { |
| 112 | // Config names for fields that are not saved in settings and therefore |
| 113 | // do not have a JSON name. |
| 114 | notSaved := map[string]string{ |
| 115 | // Not saved in settings, but present in URLs. |
| 116 | "SampleIndex": "sample_index", |
| 117 | |
| 118 | // Following fields are also not placed in URLs. |
| 119 | "Output": "output", |
| 120 | "SourcePath": "source_path", |
| 121 | "TrimPath": "trim_path", |
| 122 | "DivideBy": "divide_by", |
| 123 | } |
| 124 | |
| 125 | // choices holds the list of allowed values for config fields that can |
| 126 | // take on one of a bounded set of values. |
| 127 | choices := map[string][]string{ |
| 128 | "sort": {"cum", "flat"}, |
| 129 | "granularity": {"functions", "filefunctions", "files", "lines", "addresses"}, |
| 130 | } |
| 131 | |
| 132 | // urlparam holds the mapping from a config field name to the URL |
| 133 | // parameter used to hold that config field. If no entry is present for |
| 134 | // a name, the corresponding field is not saved in URLs. |
| 135 | urlparam := map[string]string{ |
| 136 | "drop_negative": "dropneg", |
| 137 | "call_tree": "calltree", |
| 138 | "relative_percentages": "rel", |
| 139 | "unit": "unit", |
| 140 | "compact_labels": "compact", |
| 141 | "intel_syntax": "intel", |
| 142 | "nodecount": "n", |
| 143 | "nodefraction": "nf", |
| 144 | "edgefraction": "ef", |
| 145 | "trim": "trim", |
| 146 | "focus": "f", |
| 147 | "ignore": "i", |
| 148 | "prune_from": "prunefrom", |
| 149 | "hide": "h", |
| 150 | "show": "s", |
| 151 | "show_from": "sf", |
| 152 | "tagfocus": "tf", |
| 153 | "tagignore": "ti", |
| 154 | "tagshow": "ts", |
| 155 | "taghide": "th", |
| 156 | "mean": "mean", |
| 157 | "sample_index": "si", |
| 158 | "normalize": "norm", |
| 159 | "sort": "sort", |
| 160 | "granularity": "g", |
| 161 | "noinlines": "noinlines", |
| 162 | "showcolumns": "showcolumns", |
| 163 | } |
| 164 | |
| 165 | def := defaultConfig() |
| 166 | configFieldMap = map[string]configField{} |
| 167 | t := reflect.TypeFor[config]() |
| 168 | for i, n := 0, t.NumField(); i < n; i++ { |
nothing calls this directly
no test coverage detected
searching dependent graphs…