From: Jens Axboe Date: Tue, 25 Oct 2005 12:59:17 +0000 (+0200) Subject: [PATCH] fio: Fixup install target and modify client status X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=8dbff0b12e928930ee682209f24ab4fc3ab25036;p=disktools.git [PATCH] fio: Fixup install target and modify client status --- diff --git a/Makefile b/Makefile index 72d7cb0..28db831 100644 --- a/Makefile +++ b/Makefile @@ -25,4 +25,5 @@ bindir = $(prefix)/bin install: $(PROGS) $(INSTALL) -m755 -d $(DESTDIR)$(bindir) + $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) diff --git a/fio.c b/fio.c index afb82bf..7663cd1 100644 --- a/fio.c +++ b/fio.c @@ -136,6 +136,8 @@ static char *ini_file; static int max_jobs = MAX_JOBS; +static char run_str[MAX_JOBS + 1]; + static int shm_id; enum { @@ -915,8 +917,6 @@ static void *thread_main(int shm_id, int offset, char *argv[]) goto err; } - printf("Client%d (pid=%u) started\n", td->thread_number, td->pid); - sprintf(argv[0], "fio%d", offset); if (td->use_aio && init_aio(td)) @@ -1082,6 +1082,8 @@ static int add_job(struct thread_data *td, const char *filename, int prioclass, td->slat_stat.min_val = ULONG_MAX; td->bw_stat.min_val = ULONG_MAX; + run_str[td->thread_number - 1] = 'P'; + if (td->use_aio) { if (!td->aio_depth) td->aio_depth = 1; @@ -1602,14 +1604,13 @@ static int parse_options(int argc, char *argv[]) } static void print_thread_status(struct thread_data *td, int nr_running, - int t_rate, int m_rate, int die) + int t_rate, int m_rate) { - printf("Client%d: %s\n", td->thread_number, die ? "exited" : "spawned"); - printf("Threads now running: %d", nr_running); if (m_rate || t_rate) printf(", commitrate %d/%dKiB/sec", t_rate, m_rate); - printf("\n"); + printf(" : [%s]\r", run_str); + fflush(stdout); } static void reap_threads(int *nr_running, int *t_rate, int *m_rate) @@ -1626,6 +1627,7 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate) continue; td->runstate = TD_REAPED; + run_str[td->thread_number - 1] = '_'; waitpid(td->pid, NULL, 0); (*nr_running)--; (*m_rate) -= td->ratemin; @@ -1634,7 +1636,7 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate) if (td->terminate) continue; - print_thread_status(td, *nr_running, *t_rate, *m_rate, 1); + print_thread_status(td, *nr_running, *t_rate, *m_rate); } } @@ -1683,6 +1685,7 @@ static void run_threads(char *argv[]) } td->runstate = TD_CREATED; + run_str[td->thread_number - 1] = 'C'; sem_init(&startup_sem, 1, 1); todo--; @@ -1704,12 +1707,13 @@ static void run_threads(char *argv[]) continue; td->runstate = TD_STARTED; + run_str[td->thread_number - 1] = '+'; nr_running++; m_rate += td->ratemin; t_rate += td->rate; sem_post(&td->mutex); - print_thread_status(td, nr_running, t_rate, m_rate, 0); + print_thread_status(td, nr_running, t_rate, m_rate); } reap_threads(&nr_running, &t_rate, &m_rate);