convertPerfData converts the file at path which should be in perf.data format using the perf_to_profile tool and returns the file containing the profile.proto formatted data.
(perfPath string, ui plugin.UI)
| 572 | // using the perf_to_profile tool and returns the file containing the |
| 573 | // profile.proto formatted data. |
| 574 | func convertPerfData(perfPath string, ui plugin.UI) (*os.File, error) { |
| 575 | ui.Print(fmt.Sprintf( |
| 576 | "Converting %s to a profile.proto... (May take a few minutes)", |
| 577 | perfPath)) |
| 578 | profile, err := newTempFile(os.TempDir(), "pprof_", ".pb.gz") |
| 579 | if err != nil { |
| 580 | return nil, err |
| 581 | } |
| 582 | deferDeleteTempFile(profile.Name()) |
| 583 | cmd := exec.Command("perf_to_profile", "-i", perfPath, "-o", profile.Name(), "-f") |
| 584 | cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr |
| 585 | if err := cmd.Run(); err != nil { |
| 586 | profile.Close() |
| 587 | return nil, fmt.Errorf("failed to convert perf.data file. Try github.com/google/perf_data_converter: %v", err) |
| 588 | } |
| 589 | return profile, nil |
| 590 | } |
| 591 | |
| 592 | // adjustURL validates if a profile source is a URL and returns an |
| 593 | // cleaned up URL and the timeout to use for retrieval over HTTP. |
no test coverage detected
searching dependent graphs…