File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const INTROSPECTED_GO_SCRIPT: &str = include_str!("go.sh");
55
66/// Creates the `go` script that will replace the `go` binary while running
77/// Returns the path to the script folder, which should be added to the PATH environment variable
8- pub fn setup_introspected_go ( ) -> Result < PathBuf > {
8+ pub fn setup ( ) -> Result < PathBuf > {
99 let script_folder = env:: temp_dir ( ) . join ( "codspeed_introspected_go" ) ;
1010 std:: fs:: create_dir_all ( & script_folder) ?;
1111 let script_path = script_folder. join ( "go" ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const INTROSPECTED_NODE_SCRIPT: &str = include_str!("node.sh");
55
66/// Creates the `node` script that will replace the `node` binary while running
77/// Returns the path to the script folder, which should be added to the PATH environment variable
8- pub fn setup_introspected_nodejs ( ) -> Result < PathBuf > {
8+ pub ( crate ) fn setup ( ) -> Result < PathBuf > {
99 let script_folder = env:: temp_dir ( ) . join ( "codspeed_introspected_node" ) ;
1010 std:: fs:: create_dir_all ( & script_folder) ?;
1111 let script_path = script_folder. join ( "node" ) ;
Original file line number Diff line number Diff line change 1- #! /bin/bash
1+ #! /usr/ bin/env bash
22set -eo pipefail
33
44# Custom script to replace node and run with V8 flags that make the execution of the
Original file line number Diff line number Diff line change 11pub mod env;
22pub mod get_bench_command;
33pub mod introspected_golang;
4+ pub mod introspected_nodejs;
45pub mod profile_folder;
56pub mod run_command_with_log_pipe;
67pub mod setup;
Original file line number Diff line number Diff line change 11pub mod ignored_objects_path;
2- pub mod introspected_nodejs;
32pub mod perf_maps;
43pub mod venv_compat;
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ use crate::run::runner::RunnerMode;
33use crate :: run:: runner:: helpers:: env:: get_base_injected_env;
44use crate :: run:: runner:: helpers:: get_bench_command:: get_bench_command;
55use crate :: run:: runner:: helpers:: introspected_golang;
6+ use crate :: run:: runner:: helpers:: introspected_nodejs;
67use crate :: run:: runner:: helpers:: run_command_with_log_pipe:: run_command_with_log_pipe;
78use crate :: run:: runner:: valgrind:: helpers:: ignored_objects_path:: get_objects_path_to_ignore;
8- use crate :: run:: runner:: valgrind:: helpers:: introspected_nodejs:: setup_introspected_nodejs;
99use crate :: run:: { config:: Config , instruments:: mongo_tracer:: MongoTracer } ;
1010use lazy_static:: lazy_static;
1111use std:: env;
@@ -92,10 +92,10 @@ pub async fn measure(
9292 "PATH" ,
9393 format ! (
9494 "{}:{}:{}" ,
95- setup_introspected_nodejs ( )
95+ introspected_nodejs :: setup ( )
9696 . map_err( |e| anyhow!( "failed to setup NodeJS introspection. {}" , e) ) ?
9797 . to_string_lossy( ) ,
98- introspected_golang:: setup_introspected_go ( )
98+ introspected_golang:: setup ( )
9999 . map_err( |e| anyhow!( "failed to setup Go introspection. {}" , e) ) ?
100100 . to_string_lossy( ) ,
101101 env:: var( "PATH" ) . unwrap_or_default( ) ,
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ use crate::run::instruments::mongo_tracer::MongoTracer;
55use crate :: run:: runner:: executor:: Executor ;
66use crate :: run:: runner:: helpers:: env:: { get_base_injected_env, is_codspeed_debug_enabled} ;
77use crate :: run:: runner:: helpers:: get_bench_command:: get_bench_command;
8- use crate :: run:: runner:: helpers:: introspected_golang:: setup_introspected_go;
8+ use crate :: run:: runner:: helpers:: introspected_golang;
9+ use crate :: run:: runner:: helpers:: introspected_nodejs;
910use crate :: run:: runner:: helpers:: run_command_with_log_pipe:: run_command_with_log_pipe;
1011use crate :: run:: runner:: { ExecutorName , RunData } ;
1112use crate :: run:: { check_system:: SystemInfo , config:: Config } ;
@@ -108,11 +109,13 @@ impl WallTimeExecutor {
108109 . collect :: < Vec < _ > > ( )
109110 . join ( "\n " ) ;
110111
111- // We need to intercept the `go` command to ensure we can run it with our custom runner.
112112 let path_env = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
113113 let path_env = format ! (
114- "export PATH={}:{}" ,
115- setup_introspected_go( )
114+ "export PATH={}:{}:{}" ,
115+ introspected_nodejs:: setup( )
116+ . map_err( |e| anyhow!( "failed to setup NodeJS introspection. {}" , e) ) ?
117+ . to_string_lossy( ) ,
118+ introspected_golang:: setup( )
116119 . map_err( |e| anyhow!( "failed to setup Go introspection. {}" , e) ) ?
117120 . to_string_lossy( ) ,
118121 path_env
Original file line number Diff line number Diff line change @@ -277,6 +277,7 @@ impl PerfRunner {
277277 let mut symbols_by_pid = HashMap :: < u32 , ProcessSymbols > :: new ( ) ;
278278 let mut unwind_data_by_pid = HashMap :: < u32 , Vec < UnwindData > > :: new ( ) ;
279279 let mut integration = None ;
280+ let mut perf_ping_timeout = 5 ;
280281
281282 let perf_pid = OnceCell :: new ( ) ;
282283 loop {
@@ -287,6 +288,8 @@ impl PerfRunner {
287288 debug ! ( "Failed to ping perf FIFO, ending perf fifo loop" ) ;
288289 break ;
289290 }
291+ // Perf has started successfully, we can decrease the timeout for future pings
292+ perf_ping_timeout = 1 ;
290293
291294 let result = tokio:: time:: timeout ( Duration :: from_secs ( 5 ) , runner_fifo. recv_cmd ( ) ) . await ;
292295 let Ok ( Ok ( cmd) ) = result else {
You can’t perform that action at this time.
0 commit comments