Skip to content

Commit

Permalink
fddev: add bench command
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgee-jump committed Dec 8, 2023
1 parent af56cda commit 05366cb
Show file tree
Hide file tree
Showing 9 changed files with 435 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/fdctl/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ dynamic_port_range = "8900-9000"
# downstream consumers, after which additional packets begin to
# replace older ones, which will be dropped. TODO: ... Should
# this really be configurable?
send_buffer_size = 8192
send_buffer_size = 16384

# QUIC tiles are responsible for serving network traffic, including
# parsing and responding to packets and managing connection timeouts
Expand Down
9 changes: 6 additions & 3 deletions src/app/fdctl/ready.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ready_cmd_fn( args_t * args,
anyway. */
if( FD_UNLIKELY( fd_topo_tile_kind_is_labs( tile->kind ) ) ) continue;

int first_iter = 1;
long start = fd_log_wallclock();
int printed = 0;
do {
ulong signal = fd_cnc_signal_query( tile->cnc );
char buf[ FD_CNC_SIGNAL_CSTR_BUF_MAX ];
Expand All @@ -32,8 +33,10 @@ ready_cmd_fn( args_t * args,
else if( FD_UNLIKELY( signal!=FD_CNC_SIGNAL_BOOT ) )
FD_LOG_ERR(( "cnc for tile %s(%lu) is in bad state %s", fd_topo_tile_kind_str( tile->kind ), tile->kind_id, fd_cnc_signal_cstr( signal, buf ) ));

if( FD_UNLIKELY( first_iter ) ) FD_LOG_NOTICE(( "waiting for tile %s(%lu) to be ready", fd_topo_tile_kind_str( tile->kind ), tile->kind_id ));
first_iter = 0;
if( FD_UNLIKELY( !printed && (fd_log_wallclock()-start) > 1000000000L*1L ) ) {
FD_LOG_NOTICE(( "waiting for tile %s(%lu) to be ready", fd_topo_tile_kind_str( tile->kind ), tile->kind_id ));
printed = 1;
}
} while(1);
}

Expand Down
9 changes: 7 additions & 2 deletions src/app/fdctl/run/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ run_cmd_perm( args_t * args,
struct pidns_clone_args {
config_t * config;
int * pipefd;
int closefd;
};

extern char fd_log_private_path[ 1024 ]; /* empty string on start */
Expand Down Expand Up @@ -164,6 +165,9 @@ int
main_pid_namespace( void * _args ) {
struct pidns_clone_args * args = _args;
if( FD_UNLIKELY( close( args->pipefd[ 0 ] ) ) ) FD_LOG_ERR(( "close() failed (%i-%s)", errno, fd_io_strerror( errno ) ));
if( FD_UNLIKELY( -1!=args->closefd ) ) {
if( FD_UNLIKELY( close( args->closefd ) ) ) FD_LOG_ERR(( "close() failed (%i-%s)", errno, fd_io_strerror( errno ) ));
}

config_t * const config = args->config;

Expand Down Expand Up @@ -340,6 +344,7 @@ main_pid_namespace( void * _args ) {

int
clone_firedancer( config_t * const config,
int close_fd,
int * out_pipe ) {
/* This pipe is here just so that the child process knows when the
parent has died (it will get a HUP). */
Expand All @@ -348,7 +353,7 @@ clone_firedancer( config_t * const config,

/* clone into a pid namespace */
int flags = config->development.sandbox ? CLONE_NEWPID : 0;
struct pidns_clone_args args = { .config = config, .pipefd = pipefd, };
struct pidns_clone_args args = { .config = config, .closefd = close_fd, .pipefd = pipefd, };

void * stack = fd_tile_private_stack_new( 0, 65535UL );
if( FD_UNLIKELY( !stack ) ) FD_LOG_ERR(( "unable to create a stack for boot process" ));
Expand Down Expand Up @@ -406,7 +411,7 @@ run_firedancer( config_t * const config ) {
if( FD_UNLIKELY( close( 1 ) ) ) FD_LOG_ERR(( "close(1) failed (%i-%s)", errno, fd_io_strerror( errno ) ));

int pipefd;
pid_namespace = clone_firedancer( config, &pipefd );
pid_namespace = clone_firedancer( config, -1, &pipefd );

/* Print the location of the logfile on SIGINT or SIGTERM, and also
kill the child. They are connected by a pipe which the child is
Expand Down
1 change: 1 addition & 0 deletions src/app/fdctl/run/run.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tile_main( void * _args );

int
clone_firedancer( config_t * const config,
int close_fd,
int * out_pipe );

void
Expand Down
2 changes: 1 addition & 1 deletion src/app/fddev/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ifdef FD_HAS_X86
ifdef FD_HAS_DOUBLE

.PHONY: fddev run monitor
$(call make-bin-rust,fddev,main dev dev1 txn configure/netns configure/keys configure/kill configure/genesis,fd_fdctl fd_disco fd_flamenco fd_reedsol fd_ballet fd_tango fd_util fd_quic solana_validator solana_genesis)
$(call make-bin-rust,fddev,main dev dev1 txn bench configure/netns configure/keys configure/kill configure/genesis,fd_fdctl fd_fddev fd_disco fd_flamenco fd_reedsol fd_ballet fd_tango fd_util fd_quic solana_validator solana_genesis)

solana/target/$(RUST_PROFILE)/libsolana_genesis.a: cargo

Expand Down
Loading

0 comments on commit 05366cb

Please sign in to comment.