File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ pub fn perform_with_valgrind(commands: Vec<BenchmarkCommand>) -> Result<()> {
5959 cmd. env ( "PYTHONPERFSUPPORT" , "1" ) ;
6060 cmd. env ( constants:: URI_ENV , & name_and_uri. uri ) ;
6161
62+ crate :: node:: set_node_options ( & mut cmd) ;
63+
6264 let mut child = cmd. spawn ( ) . context ( "Failed to spawn command" ) ?;
6365
6466 let status = child. wait ( ) . context ( "Failed to execute command" ) ?;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use std::io::{self, BufRead};
55
66pub mod analysis;
77pub mod constants;
8+ pub mod node;
89pub mod prelude;
910mod uri;
1011pub mod walltime;
Original file line number Diff line number Diff line change 1+ use std:: process:: Command ;
2+
3+ const NODE_OPTIONS_TO_ADD : & [ & str ] = & [ "--perf-basic-prof" ] ;
4+
5+ /// Appends CodSpeed-required Node.js options to `NODE_OPTIONS` on a [`Command`],
6+ /// preserving any existing value from the environment.
7+ pub fn set_node_options ( cmd : & mut Command ) {
8+ let existing = std:: env:: var ( "NODE_OPTIONS" ) . unwrap_or_default ( ) ;
9+ let mut parts: Vec < & str > = existing. split_whitespace ( ) . collect ( ) ;
10+
11+ for opt in NODE_OPTIONS_TO_ADD {
12+ if !parts. contains ( opt) {
13+ parts. push ( opt) ;
14+ }
15+ }
16+
17+ cmd. env ( "NODE_OPTIONS" , parts. join ( " " ) ) ;
18+ }
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ pub fn run_rounds(
1515 let hooks = InstrumentHooks :: instance ( INTEGRATION_NAME , INTEGRATION_VERSION ) ;
1616
1717 let do_one_round = || -> Result < ( u64 , u64 ) > {
18- let mut child = Command :: new ( & command[ 0 ] )
19- . args ( & command[ 1 ..] )
20- . spawn ( )
21- . context ( "Failed to execute command" ) ?;
18+ let mut cmd = Command :: new ( & command[ 0 ] ) ;
19+ cmd . args ( & command[ 1 ..] ) ;
20+ crate :: node :: set_node_options ( & mut cmd ) ;
21+ let mut child = cmd . spawn ( ) . context ( "Failed to execute command" ) ?;
2222 let bench_round_start_ts_ns = InstrumentHooks :: current_timestamp ( ) ;
2323 let status = child
2424 . wait ( )
You can’t perform that action at this time.
0 commit comments