|
@@ -417,9 +417,8 @@ func profileProtoReader(path string, ui plugin.UI) (io.ReadCloser, error) {
|
417
|
417
|
}
|
418
|
418
|
|
419
|
419
|
// convertPerfData converts the file at path which should be in perf.data format
|
420
|
|
-// using the perf_to_profile tool. It prints the stderr and stdout of
|
421
|
|
-// perf_to_profile to the stderr and stdout of this process, then returns the
|
422
|
|
-// path to a file containing the profile.proto formatted data.
|
|
420
|
+// using the perf_to_profile tool and returns the path to a file containing the
|
|
421
|
+// profile.proto formatted data.
|
423
|
422
|
func convertPerfData(perfPath string, ui plugin.UI) (string, error) {
|
424
|
423
|
ui.Print(fmt.Sprintf(
|
425
|
424
|
"Converting %s to a profile.proto... (May take a few minutes)",
|
|
@@ -432,23 +431,6 @@ func convertPerfData(perfPath string, ui plugin.UI) (string, error) {
|
432
|
431
|
randomFileName := "/tmp/pprof_" +
|
433
|
432
|
base64.StdEncoding.EncodeToString(randomBytes)
|
434
|
433
|
cmd := exec.Command("perf_to_profile", perfPath, randomFileName)
|
435
|
|
-
|
436
|
|
- stdout, stdoutErr := cmd.StdoutPipe()
|
437
|
|
- if stdoutErr != nil {
|
438
|
|
- return "", stdoutErr
|
439
|
|
- }
|
440
|
|
- go func() {
|
441
|
|
- io.Copy(os.Stdout, stdout)
|
442
|
|
- }()
|
443
|
|
-
|
444
|
|
- stderr, stderrErr := cmd.StderrPipe()
|
445
|
|
- if stderrErr != nil {
|
446
|
|
- return "", stderrErr
|
447
|
|
- }
|
448
|
|
- go func() {
|
449
|
|
- io.Copy(os.Stderr, stderr)
|
450
|
|
- }()
|
451
|
|
-
|
452
|
434
|
if err := cmd.Run(); err != nil {
|
453
|
435
|
return "", err
|
454
|
436
|
}
|