File tree Expand file tree Collapse file tree 8 files changed +17
-11
lines changed Expand file tree Collapse file tree 8 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const INTROSPECTED_GO_SCRIPT: &str = include_str!("go.sh");
5
5
6
6
/// Creates the `go` script that will replace the `go` binary while running
7
7
/// 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 > {
9
9
let script_folder = env:: temp_dir ( ) . join ( "codspeed_introspected_go" ) ;
10
10
std:: fs:: create_dir_all ( & script_folder) ?;
11
11
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");
5
5
6
6
/// Creates the `node` script that will replace the `node` binary while running
7
7
/// 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 > {
9
9
let script_folder = env:: temp_dir ( ) . join ( "codspeed_introspected_node" ) ;
10
10
std:: fs:: create_dir_all ( & script_folder) ?;
11
11
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
2
2
set -eo pipefail
3
3
4
4
# 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 1
1
pub mod env;
2
2
pub mod get_bench_command;
3
3
pub mod introspected_golang;
4
+ pub mod introspected_nodejs;
4
5
pub mod profile_folder;
5
6
pub mod run_command_with_log_pipe;
6
7
pub mod setup;
Original file line number Diff line number Diff line change 1
1
pub mod ignored_objects_path;
2
- pub mod introspected_nodejs;
3
2
pub mod perf_maps;
4
3
pub mod venv_compat;
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ use crate::run::runner::RunnerMode;
3
3
use crate :: run:: runner:: helpers:: env:: get_base_injected_env;
4
4
use crate :: run:: runner:: helpers:: get_bench_command:: get_bench_command;
5
5
use crate :: run:: runner:: helpers:: introspected_golang;
6
+ use crate :: run:: runner:: helpers:: introspected_nodejs;
6
7
use crate :: run:: runner:: helpers:: run_command_with_log_pipe:: run_command_with_log_pipe;
7
8
use 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;
9
9
use crate :: run:: { config:: Config , instruments:: mongo_tracer:: MongoTracer } ;
10
10
use lazy_static:: lazy_static;
11
11
use std:: env;
@@ -92,10 +92,10 @@ pub async fn measure(
92
92
"PATH" ,
93
93
format ! (
94
94
"{}:{}:{}" ,
95
- setup_introspected_nodejs ( )
95
+ introspected_nodejs :: setup ( )
96
96
. map_err( |e| anyhow!( "failed to setup NodeJS introspection. {}" , e) ) ?
97
97
. to_string_lossy( ) ,
98
- introspected_golang:: setup_introspected_go ( )
98
+ introspected_golang:: setup ( )
99
99
. map_err( |e| anyhow!( "failed to setup Go introspection. {}" , e) ) ?
100
100
. to_string_lossy( ) ,
101
101
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;
5
5
use crate :: run:: runner:: executor:: Executor ;
6
6
use crate :: run:: runner:: helpers:: env:: { get_base_injected_env, is_codspeed_debug_enabled} ;
7
7
use 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;
9
10
use crate :: run:: runner:: helpers:: run_command_with_log_pipe:: run_command_with_log_pipe;
10
11
use crate :: run:: runner:: { ExecutorName , RunData } ;
11
12
use crate :: run:: { check_system:: SystemInfo , config:: Config } ;
@@ -108,11 +109,13 @@ impl WallTimeExecutor {
108
109
. collect :: < Vec < _ > > ( )
109
110
. join ( "\n " ) ;
110
111
111
- // We need to intercept the `go` command to ensure we can run it with our custom runner.
112
112
let path_env = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
113
113
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( )
116
119
. map_err( |e| anyhow!( "failed to setup Go introspection. {}" , e) ) ?
117
120
. to_string_lossy( ) ,
118
121
path_env
Original file line number Diff line number Diff line change @@ -277,6 +277,7 @@ impl PerfRunner {
277
277
let mut symbols_by_pid = HashMap :: < u32 , ProcessSymbols > :: new ( ) ;
278
278
let mut unwind_data_by_pid = HashMap :: < u32 , Vec < UnwindData > > :: new ( ) ;
279
279
let mut integration = None ;
280
+ let mut perf_ping_timeout = 5 ;
280
281
281
282
let perf_pid = OnceCell :: new ( ) ;
282
283
loop {
@@ -287,6 +288,8 @@ impl PerfRunner {
287
288
debug ! ( "Failed to ping perf FIFO, ending perf fifo loop" ) ;
288
289
break ;
289
290
}
291
+ // Perf has started successfully, we can decrease the timeout for future pings
292
+ perf_ping_timeout = 1 ;
290
293
291
294
let result = tokio:: time:: timeout ( Duration :: from_secs ( 5 ) , runner_fifo. recv_cmd ( ) ) . await ;
292
295
let Ok ( Ok ( cmd) ) = result else {
You can’t perform that action at this time.
0 commit comments