(cmd string, outputFormat int, cfg config)
| 176 | } |
| 177 | |
| 178 | func applyCommandOverrides(cmd string, outputFormat int, cfg config) config { |
| 179 | // Some report types override the trim flag to false below. This is to make |
| 180 | // sure the default heuristics of excluding insignificant nodes and edges |
| 181 | // from the call graph do not apply. One example where it is important is |
| 182 | // annotated source or disassembly listing. Those reports run on a specific |
| 183 | // function (or functions), but the trimming is applied before the function |
| 184 | // data is selected. So, with trimming enabled, the report could end up |
| 185 | // showing no data if the specified function is "uninteresting" as far as the |
| 186 | // trimming is concerned. |
| 187 | trim := cfg.Trim |
| 188 | |
| 189 | switch cmd { |
| 190 | case "disasm": |
| 191 | trim = false |
| 192 | cfg.Granularity = "addresses" |
| 193 | // Force the 'noinlines' mode so that source locations for a given address |
| 194 | // collapse and there is only one for the given address. Without this |
| 195 | // cumulative metrics would be double-counted when annotating the assembly. |
| 196 | // This is because the merge is done by address and in case of an inlined |
| 197 | // stack each of the inlined entries is a separate callgraph node. |
| 198 | cfg.NoInlines = true |
| 199 | case "weblist": |
| 200 | trim = false |
| 201 | cfg.Granularity = "addresses" |
| 202 | cfg.NoInlines = false // Need inline info to support call expansion |
| 203 | case "peek": |
| 204 | trim = false |
| 205 | case "list": |
| 206 | trim = false |
| 207 | cfg.Granularity = "lines" |
| 208 | // Do not force 'noinlines' to be false so that specifying |
| 209 | // "-list foo -noinlines" is supported and works as expected. |
| 210 | case "text", "top", "topproto": |
| 211 | if cfg.NodeCount == -1 { |
| 212 | cfg.NodeCount = 0 |
| 213 | } |
| 214 | default: |
| 215 | if cfg.NodeCount == -1 { |
| 216 | cfg.NodeCount = 80 |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | switch outputFormat { |
| 221 | case report.Proto, report.Raw, report.Callgrind: |
| 222 | trim = false |
| 223 | cfg.Granularity = "addresses" |
| 224 | } |
| 225 | |
| 226 | if !trim { |
| 227 | cfg.NodeCount = 0 |
| 228 | cfg.NodeFraction = 0 |
| 229 | cfg.EdgeFraction = 0 |
| 230 | } |
| 231 | return cfg |
| 232 | } |
| 233 | |
| 234 | // generateTagRootsLeaves generates extra nodes from the tagroot and tagleaf options. |
| 235 | func generateTagRootsLeaves(prof *profile.Profile, cfg config, ui plugin.UI) { |
no outgoing calls
searching dependent graphs…