generateRawReport is allowed to modify p.
(p *profile.Profile, cmd []string, cfg config, o *plugin.Options)
| 62 | |
| 63 | // generateRawReport is allowed to modify p. |
| 64 | func generateRawReport(p *profile.Profile, cmd []string, cfg config, o *plugin.Options) (*command, *report.Report, error) { |
| 65 | // Identify units of numeric tags in profile. |
| 66 | numLabelUnits := identifyNumLabelUnits(p, o.UI) |
| 67 | |
| 68 | // Get report output format |
| 69 | c := pprofCommands[cmd[0]] |
| 70 | if c == nil { |
| 71 | panic("unexpected nil command") |
| 72 | } |
| 73 | |
| 74 | cfg = applyCommandOverrides(cmd[0], c.format, cfg) |
| 75 | |
| 76 | // Create label pseudo nodes before filtering, in case the filters use |
| 77 | // the generated nodes. |
| 78 | generateTagRootsLeaves(p, cfg, o.UI) |
| 79 | |
| 80 | // Delay focus after configuring report to get percentages on all samples. |
| 81 | relative := cfg.RelativePercentages |
| 82 | if relative { |
| 83 | if err := applyFocus(p, numLabelUnits, cfg, o.UI); err != nil { |
| 84 | return nil, nil, err |
| 85 | } |
| 86 | } |
| 87 | ropt, err := reportOptions(p, numLabelUnits, cfg) |
| 88 | if err != nil { |
| 89 | return nil, nil, err |
| 90 | } |
| 91 | ropt.OutputFormat = c.format |
| 92 | if len(cmd) == 2 { |
| 93 | s, err := regexp.Compile(cmd[1]) |
| 94 | if err != nil { |
| 95 | return nil, nil, fmt.Errorf("parsing argument regexp %s: %v", cmd[1], err) |
| 96 | } |
| 97 | ropt.Symbol = s |
| 98 | } |
| 99 | |
| 100 | rpt := report.New(p, ropt) |
| 101 | if !relative { |
| 102 | if err := applyFocus(p, numLabelUnits, cfg, o.UI); err != nil { |
| 103 | return nil, nil, err |
| 104 | } |
| 105 | } |
| 106 | if err := aggregate(p, cfg); err != nil { |
| 107 | return nil, nil, err |
| 108 | } |
| 109 | |
| 110 | return c, rpt, nil |
| 111 | } |
| 112 | |
| 113 | // generateReport is allowed to modify p. |
| 114 | func generateReport(p *profile.Profile, cmd []string, cfg config, o *plugin.Options) error { |
no test coverage detected
searching dependent graphs…