@@ -661,7 +661,7 @@ impl<'a> Processor for ProfileProcessor<'a> {
661
661
}
662
662
663
663
// -Zself-profile produces (via rustc-fake) a data directory called
664
- // ' Zsp' containing three files with names of the form
664
+ // ` Zsp` containing three files with names of the form
665
665
// `$BENCHMARK-$PID.{events,string_data,string_index}`. We copy it
666
666
// from the temp dir to the output dir, renaming the files within
667
667
// as `Zsp.{events,string_data,string_index}` in the process, then
@@ -703,8 +703,7 @@ impl<'a> Processor for ProfileProcessor<'a> {
703
703
// Run `summarize`.
704
704
let mut summarize_cmd = Command :: new ( "summarize" ) ;
705
705
summarize_cmd. arg ( "summarize" ) . arg ( & zsp_files_prefix) ;
706
- let output = summarize_cmd. output ( ) ?;
707
- fs:: write ( & summarize_file, & output. stdout ) ?;
706
+ fs:: write ( & summarize_file, & summarize_cmd. output ( ) ?. stdout ) ?;
708
707
709
708
// Run `flamegraph`.
710
709
let mut flamegraph_cmd = Command :: new ( "flamegraph" ) ;
@@ -719,15 +718,16 @@ impl<'a> Processor for ProfileProcessor<'a> {
719
718
fs:: rename ( "chrome_profiler.json" , crox_file) ?;
720
719
}
721
720
722
- // -Ztime-passes writes its output to stdout. We copy that output
723
- // into a file in the output dir.
721
+ // ` -Ztime-passes` output is redirected (via rustc-fake) to a file
722
+ // called `Ztp`. We copy that output into a file in the output dir.
724
723
Profiler :: TimePasses => {
724
+ let tmp_ztp_file = filepath ( data. cwd . as_ref ( ) , "Ztp" ) ;
725
725
let ztp_file = filepath ( self . output_dir , & out_file ( "Ztp" ) ) ;
726
726
727
- fs:: write ( ztp_file , & output . stdout ) ?;
727
+ fs:: copy ( & tmp_ztp_file , & ztp_file ) ?;
728
728
}
729
729
730
- // perf-record produces (via rustc-fake) a data file called ' perf' .
730
+ // perf-record produces (via rustc-fake) a data file called ` perf` .
731
731
// We copy it from the temp dir to the output dir, giving it a new
732
732
// name in the process.
733
733
Profiler :: PerfRecord => {
@@ -738,7 +738,7 @@ impl<'a> Processor for ProfileProcessor<'a> {
738
738
}
739
739
740
740
// OProfile produces (via rustc-fake) a data directory called
741
- // ' oprofile_data' . We copy it from the temp dir to the output dir,
741
+ // ` oprofile_data` . We copy it from the temp dir to the output dir,
742
742
// giving it a new name in the process, and then post-process it
743
743
// twice to produce another two data files in the output dir.
744
744
Profiler :: OProfile => {
@@ -765,8 +765,7 @@ impl<'a> Processor for ProfileProcessor<'a> {
765
765
. arg ( "--threshold" )
766
766
. arg ( "0.5" )
767
767
. arg ( & session_dir_arg) ;
768
- let output = op_report_cmd. output ( ) ?;
769
- fs:: write ( oprep_file, & output. stdout ) ?;
768
+ fs:: write ( oprep_file, & op_report_cmd. output ( ) ?. stdout ) ?;
770
769
771
770
let mut op_annotate_cmd = Command :: new ( "opannotate" ) ;
772
771
// Other possibly useful args: --assembly
@@ -775,11 +774,10 @@ impl<'a> Processor for ProfileProcessor<'a> {
775
774
. arg ( "--threshold" )
776
775
. arg ( "0.5" )
777
776
. arg ( & session_dir_arg) ;
778
- let output = op_annotate_cmd. output ( ) ?;
779
- fs:: write ( opann_file, & output. stdout ) ?;
777
+ fs:: write ( opann_file, & op_annotate_cmd. output ( ) ?. stdout ) ?;
780
778
}
781
779
782
- // Cachegrind produces (via rustc-fake) a data file called ' cgout' .
780
+ // Cachegrind produces (via rustc-fake) a data file called ` cgout` .
783
781
// We copy it from the temp dir to the output dir, giving it a new
784
782
// name in the process, and then post-process it to produce another
785
783
// data file in the output dir.
@@ -795,11 +793,10 @@ impl<'a> Processor for ProfileProcessor<'a> {
795
793
. arg ( "--auto=yes" )
796
794
. arg ( "--show-percs=yes" )
797
795
. arg ( & cgout_file) ;
798
- let output = cg_annotate_cmd. output ( ) ?;
799
- fs:: write ( cgann_file, & output. stdout ) ?;
796
+ fs:: write ( cgann_file, & cg_annotate_cmd. output ( ) ?. stdout ) ?;
800
797
}
801
798
802
- // Callgrind produces (via rustc-fake) a data file called ' clgout' .
799
+ // Callgrind produces (via rustc-fake) a data file called ` clgout` .
803
800
// We copy it from the temp dir to the output dir, giving it a new
804
801
// name in the process, and then post-process it to produce another
805
802
// data file in the output dir.
@@ -815,11 +812,10 @@ impl<'a> Processor for ProfileProcessor<'a> {
815
812
. arg ( "--auto=yes" )
816
813
. arg ( "--show-percs=yes" )
817
814
. arg ( & clgout_file) ;
818
- let output = clg_annotate_cmd. output ( ) ?;
819
- fs:: write ( clgann_file, & output. stdout ) ?;
815
+ fs:: write ( clgann_file, & clg_annotate_cmd. output ( ) ?. stdout ) ?;
820
816
}
821
817
822
- // DHAT produces (via rustc-fake) a data file called ' dhout' . We
818
+ // DHAT produces (via rustc-fake) a data file called ` dhout` . We
823
819
// copy it from the temp dir to the output dir, giving it a new
824
820
// name in the process.
825
821
Profiler :: DHAT => {
@@ -829,7 +825,7 @@ impl<'a> Processor for ProfileProcessor<'a> {
829
825
fs:: copy ( & tmp_dhout_file, & dhout_file) ?;
830
826
}
831
827
832
- // Massif produces (via rustc-fake) a data file called ' msout' . We
828
+ // Massif produces (via rustc-fake) a data file called ` msout` . We
833
829
// copy it from the temp dir to the output dir, giving it a new
834
830
// name in the process.
835
831
Profiler :: Massif => {
@@ -839,12 +835,14 @@ impl<'a> Processor for ProfileProcessor<'a> {
839
835
fs:: copy ( & tmp_msout_file, & msout_file) ?;
840
836
}
841
837
842
- // `eprintln!` statements writes their output to stderr. We copy
843
- // that output into a file in the output dir.
838
+ // `eprintln!` statements are redirected (via rustc-fake) to a file
839
+ // called `eprintln`. We copy it from the temp dir to the output
840
+ // dir, giving it a new name in the process.
844
841
Profiler :: Eprintln => {
842
+ let tmp_eprintln_file = filepath ( data. cwd . as_ref ( ) , "eprintln" ) ;
845
843
let eprintln_file = filepath ( self . output_dir , & out_file ( "eprintln" ) ) ;
846
844
847
- fs:: write ( eprintln_file , & output . stderr ) ?;
845
+ fs:: copy ( & tmp_eprintln_file , & eprintln_file ) ?;
848
846
}
849
847
850
848
// `cargo llvm-lines` writes its output to stdout. We copy that
0 commit comments