The following changes since commit 259e47dea8db94a372a73b07b5245d43d4f9ab92: Only print ts->description if set for non-terse output (2011-10-13 21:05:59 +0200) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (5): Add fio version to terse output Scale bw output to MB/sec if larger than 99999 KB/sec Memory leak fixes Pretty up output a bit Fio 1.99.7 HOWTO | 2 +- fio.1 | 2 +- fio.c | 16 +++++++++++--- fio.h | 1 + fio_version.h | 2 +- init.c | 14 ++++++++++-- options.c | 37 ++++++++++++----------------------- options.h | 2 + os/windows/install.wxs | 2 +- os/windows/version.h | 2 +- parse.c | 19 ++++++++++++++++++ parse.h | 1 + stat.c | 50 ++++++++++++++++++++++++++++++++--------------- 13 files changed, 98 insertions(+), 52 deletions(-) --- Diff of recent changes: diff --git a/HOWTO b/HOWTO index a8d5197..34c3505 100644 --- a/HOWTO +++ b/HOWTO @@ -1360,7 +1360,7 @@ signify that change. Split up, the format is as follows: - version, jobname, groupid, error + terse version, fio version, jobname, groupid, error READ status: Total IO (KB), bandwidth (KB/sec), IOPS, runtime (msec) Submission latency: min, max, mean, deviation diff --git a/fio.1 b/fio.1 index 2473b44..aa027dc 100644 --- a/fio.1 +++ b/fio.1 @@ -1121,7 +1121,7 @@ for some reason, this number will be incremented by 1 to signify that change. The fields are: .P .RS -.B version, jobname, groupid, error +.B terse version, fio version, jobname, groupid, error .P Read status: .RS diff --git a/fio.c b/fio.c index e5d3bbf..856ca75 100644 --- a/fio.c +++ b/fio.c @@ -1361,7 +1361,6 @@ err: if (td->o.write_iolog_file) write_iolog_close(td); - options_mem_free(td); td_set_runstate(td, TD_EXITED); return (void *) (unsigned long) td->error; } @@ -1773,11 +1772,17 @@ static void run_threads(void) int exec_run(void) { + struct thread_data *td; + int i; + if (nr_clients) return fio_handle_clients(); - if (exec_profile && load_profile(exec_profile)) - return 1; - + if (exec_profile) { + if (load_profile(exec_profile)) + return 1; + free(exec_profile); + exec_profile = NULL; + } if (!thread_number) return 0; @@ -1810,6 +1815,9 @@ int exec_run(void) } } + for_each_td(td, i) + fio_options_free(td); + cgroup_kill(cgroup_list); sfree(cgroup_list); sfree(cgroup_mnt); diff --git a/fio.h b/fio.h index 04963cd..df0daf6 100644 --- a/fio.h +++ b/fio.h @@ -502,6 +502,7 @@ extern int terse_version; extern int is_backend; extern int nr_clients; extern int log_syslog; +extern const char fio_version_string[]; extern const fio_fp64_t def_percentile_list[FIO_IO_U_LIST_MAX_LEN]; extern struct thread_data *threads; diff --git a/fio_version.h b/fio_version.h index 3008c64..9f897cc 100644 --- a/fio_version.h +++ b/fio_version.h @@ -3,6 +3,6 @@ #define FIO_MAJOR 1 #define FIO_MINOR 99 -#define FIO_PATCH 6 +#define FIO_PATCH 7 #endif diff --git a/init.c b/init.c index 5bea948..0ccb185 100644 --- a/init.c +++ b/init.c @@ -26,11 +26,11 @@ #include "fio_version.h" #if FIO_PATCH > 0 -static char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ +const char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ __fio_stringify(FIO_MINOR) "." \ __fio_stringify(FIO_PATCH); #else -static char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ +const char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ __fio_stringify(FIO_MINOR); #endif @@ -318,6 +318,8 @@ static void put_job(struct thread_data *td) if (td->error) log_info("fio: %s\n", td->verror); + fio_options_free(td); + memset(&threads[td->thread_number - 1], 0, sizeof(*td)); thread_number--; } @@ -1070,6 +1072,12 @@ int parse_jobs_ini(char *file, int is_buf, int stonewall_flag) if (dump_cmdline) log_info("\n"); + i = 0; + while (i < nr_job_sections) { + free(job_sections[i]); + i++; + } + for (i = 0; i < num_opts; i++) free(opts[i]); @@ -1497,7 +1505,7 @@ int parse_options(int argc, char *argv[]) } free(ini_file); - options_mem_free(&def_thread); + fio_options_free(&def_thread); if (!thread_number) { if (dump_cmdline) diff --git a/options.c b/options.c index 48bb2a4..4207537 100644 --- a/options.c +++ b/options.c @@ -2347,7 +2347,10 @@ int fio_show_option_help(const char *opt) return show_cmd_help(options, opt); } -static void __options_mem(struct thread_data *td, int alloc) +/* + * dupe FIO_OPT_STR_STORE options + */ +void options_mem_dupe(struct thread_data *td) { struct thread_options *o = &td->o; struct fio_option *opt; @@ -2359,32 +2362,13 @@ static void __options_mem(struct thread_data *td, int alloc) continue; ptr = (void *) o + opt->off1; - if (*ptr) { - if (alloc) - *ptr = strdup(*ptr); - else { - free(*ptr); - *ptr = NULL; - } - } + if (!*ptr) + ptr = td_var(o, opt->off1); + if (*ptr) + *ptr = strdup(*ptr); } } -/* - * dupe FIO_OPT_STR_STORE options - */ -void options_mem_dupe(struct thread_data *td) -{ - __options_mem(td, 1); -} - -void options_mem_free(struct thread_data fio_unused *td) -{ -#if 0 - __options_mem(td, 0); -#endif -} - unsigned int fio_get_kb_base(void *data) { struct thread_data *td = data; @@ -2465,3 +2449,8 @@ void del_opt_posval(const char *optname, const char *ival) o->posval[i].help = NULL; } } + +void fio_options_free(struct thread_data *td) +{ + options_free(options, td); +} diff --git a/options.h b/options.h index c6c2086..ed6b9c2 100644 --- a/options.h +++ b/options.h @@ -15,6 +15,8 @@ extern char *exec_profile; void add_opt_posval(const char *, const char *, const char *); void del_opt_posval(const char *, const char *); +struct thread_data; +void fio_options_free(struct thread_data *); static inline int o_match(struct fio_option *o, const char *opt) { diff --git a/os/windows/install.wxs b/os/windows/install.wxs index 69a0e98..914d744 100755 --- a/os/windows/install.wxs +++ b/os/windows/install.wxs @@ -3,7 +3,7 @@ <?define VersionMajor = 1?> <?define VersionMinor = 99?> -<?define VersionBuild = 6?> +<?define VersionBuild = 7?> <Product Id="*" Codepage="1252" Language="1033" diff --git a/os/windows/version.h b/os/windows/version.h index b7d3308..5d7c1f1 100644 --- a/os/windows/version.h +++ b/os/windows/version.h @@ -3,4 +3,4 @@ #define FIO_VERSION_MAJOR FIO_MAJOR #define FIO_VERSION_MINOR FIO_MINOR #define FIO_VERSION_BUILD FIO_PATCH -#define FIO_VERSION_STRING "1.99.6" +#define FIO_VERSION_STRING "1.99.7" diff --git a/parse.c b/parse.c index 27e7336..afbde61 100644 --- a/parse.c +++ b/parse.c @@ -1094,3 +1094,22 @@ void options_init(struct fio_option *options) for (o = &options[0]; o->name; o++) option_init(o); } + +void options_free(struct fio_option *options, void *data) +{ + struct fio_option *o; + char **ptr; + + dprint(FD_PARSE, "free options\n"); + + for (o = &options[0]; o->name; o++) { + if (o->type != FIO_OPT_STR_STORE) + continue; + + ptr = td_var(data, o->off1); + if (*ptr) { + free(*ptr); + *ptr = NULL; + } + } +} diff --git a/parse.h b/parse.h index f2265a4..cb0b48f 100644 --- a/parse.h +++ b/parse.h @@ -72,6 +72,7 @@ extern int show_cmd_help(struct fio_option *, const char *); extern void fill_default_options(void *, struct fio_option *); extern void option_init(struct fio_option *); extern void options_init(struct fio_option *); +extern void options_free(struct fio_option *, void *); extern void strip_blank_front(char **); extern void strip_blank_end(char *); diff --git a/stat.c b/stat.c index d310686..d54aa85 100644 --- a/stat.c +++ b/stat.c @@ -262,7 +262,7 @@ void show_group_stats(struct group_run_stats *rs) const char *ddir_str[] = { " READ", " WRITE" }; int i; - log_info("Run status group %d (all jobs):\n", rs->groupid); + log_info("\nRun status group %d (all jobs):\n", rs->groupid); for (i = 0; i <= DDIR_WRITE; i++) { const int i2p = is_power_of_2(rs->kb_base); @@ -441,26 +441,39 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts, } if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) { double p_of_agg; + const char *bw_str = "KB"; p_of_agg = mean * 100 / (double) rs->agg[ddir]; - log_info(" bw (KB/s) : min=%5lu, max=%5lu, per=%3.2f%%," - " avg=%5.02f, stdev=%5.02f\n", min, max, p_of_agg, - mean, dev); + if (p_of_agg > 100.0) + p_of_agg = 100.0; + + if (mean > 999999.9) { + min /= 1000.0; + max /= 1000.0; + mean /= 1000.0; + dev /= 1000.0; + bw_str = "MB"; + } + + log_info(" bw (%s/s) : min=%5lu, max=%5lu, per=%3.2f%%," + " avg=%5.02f, stdev=%5.02f\n", bw_str, min, max, + p_of_agg, mean, dev); } } -static void show_lat(double *io_u_lat, int nr, const char **ranges, - const char *msg) +static int show_lat(double *io_u_lat, int nr, const char **ranges, + const char *msg) { - int new_line = 1, i, line = 0; + int new_line = 1, i, line = 0, shown = 0; for (i = 0; i < nr; i++) { if (io_u_lat[i] <= 0.0) continue; + shown = 1; if (new_line) { if (line) log_info("\n"); - log_info(" lat (%s): ", msg); + log_info(" lat (%s) : ", msg); new_line = 0; line = 0; } @@ -471,6 +484,11 @@ static void show_lat(double *io_u_lat, int nr, const char **ranges, if (line == 5) new_line = 1; } + + if (shown) + log_info("\n"); + + return shown; } static void show_lat_u(double *io_u_lat_u) @@ -493,9 +511,7 @@ static void show_lat_m(double *io_u_lat_m) static void show_latencies(double *io_u_lat_u, double *io_u_lat_m) { show_lat_u(io_u_lat_u); - log_info("\n"); show_lat_m(io_u_lat_m); - log_info("\n"); } void show_thread_status(struct thread_stat *ts, struct group_run_stats *rs) @@ -528,6 +544,10 @@ void show_thread_status(struct thread_stat *ts, struct group_run_stats *rs) if (ts->io_bytes[DDIR_WRITE]) show_ddir_status(rs, ts, DDIR_WRITE); + stat_calc_lat_u(ts, io_u_lat_u); + stat_calc_lat_m(ts, io_u_lat_m); + show_latencies(io_u_lat_u, io_u_lat_m); + runtime = ts->total_run_time; if (runtime) { double runt = (double) runtime; @@ -561,14 +581,12 @@ void show_thread_status(struct thread_stat *ts, struct group_run_stats *rs) io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]); - log_info(" issued r/w/d: total=%lu/%lu/%lu, short=%lu/%lu/%lu\n", + log_info(" issued : total=r=%lu/w=%lu/d=%lu," + " short=r=%lu/w=%lu/d=%lu\n", ts->total_io_u[0], ts->total_io_u[1], ts->total_io_u[2], ts->short_io_u[0], ts->short_io_u[1], ts->short_io_u[2]); - stat_calc_lat_u(ts, io_u_lat_u); - stat_calc_lat_m(ts, io_u_lat_m); - show_latencies(io_u_lat_u, io_u_lat_m); if (ts->continue_on_error) { log_info(" errors : total=%lu, first_error=%d/<%s>\n", ts->total_err_count, @@ -654,8 +672,8 @@ static void show_thread_status_terse(struct thread_stat *ts, int i; /* General Info */ - log_info("%s;%s;%d;%d", FIO_TERSE_VERSION, ts->name, ts->groupid, - ts->error); + log_info("%s;%s;%s;%d;%d", FIO_TERSE_VERSION, fio_version_string, + ts->name, ts->groupid, ts->error); /* Log Read Status */ show_ddir_status_terse(ts, rs, 0); /* Log Write Status */ -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html