From 99d633af3611958ea6217f270677d0a657e4dddc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 15 Mar 2012 15:55:04 +0100 Subject: [PATCH] gfio: add bs display Signed-off-by: Jens Axboe --- fio.h | 1 + gfio.c | 21 ++++++++++++++++++++- init.c | 10 +++++----- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/fio.h b/fio.h index 6e117540..919c6cde 100644 --- a/fio.h +++ b/fio.h @@ -414,6 +414,7 @@ extern int initialize_fio(char *envp[]); */ extern void print_thread_status(void); extern void print_status_init(int); +extern char *fio_uint_to_kmg(unsigned int val); /* * Thread life cycle. Once a thread has a runstate beyond TD_INITIALIZED, it diff --git a/gfio.c b/gfio.c index bbeb2299..c67e4924 100644 --- a/gfio.c +++ b/gfio.c @@ -81,6 +81,7 @@ struct multitext_widget { struct eta_widget { GtkWidget *names; struct multitext_widget iotype; + struct multitext_widget bs; struct multitext_widget ioengine; struct multitext_widget iodepth; GtkWidget *jobs; @@ -300,6 +301,7 @@ static void clear_ge_ui_info(struct gui_entry *ge) gtk_entry_set_text(GTK_ENTRY(ge->eta.name), ""); #endif multitext_update_entry(&ge->eta.iotype, 0, ""); + multitext_update_entry(&ge->eta.bs, 0, ""); multitext_update_entry(&ge->eta.ioengine, 0, ""); multitext_update_entry(&ge->eta.iodepth, 0, ""); gtk_entry_set_text(GTK_ENTRY(ge->eta.jobs), ""); @@ -1893,7 +1895,8 @@ static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd) struct gfio_client *gc = client->client_data; struct thread_options *o = &gc->o; struct gui_entry *ge = gc->ge; - char tmp[8]; + char *c1, *c2, *c3, *c4; + char tmp[80]; p->thread_number = le32_to_cpu(p->thread_number); p->groupid = le32_to_cpu(p->groupid); @@ -1907,12 +1910,25 @@ static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd) gtk_combo_box_set_active(GTK_COMBO_BOX(ge->eta.names), 0); multitext_add_entry(&ge->eta.iotype, ddir_str(o->td_ddir)); + + c1 = fio_uint_to_kmg(o->min_bs[DDIR_READ]); + c2 = fio_uint_to_kmg(o->max_bs[DDIR_WRITE]); + c3 = fio_uint_to_kmg(o->min_bs[DDIR_READ]); + c4 = fio_uint_to_kmg(o->max_bs[DDIR_WRITE]); + sprintf(tmp, "%s-%s/%s-%s", c1, c2, c3, c4); + free(c1); + free(c2); + free(c3); + free(c4); + multitext_add_entry(&ge->eta.bs, tmp); + multitext_add_entry(&ge->eta.ioengine, (const char *) o->ioengine); sprintf(tmp, "%u", o->iodepth); multitext_add_entry(&ge->eta.iodepth, tmp); multitext_set_entry(&ge->eta.iotype, 0); + multitext_set_entry(&ge->eta.bs, 0); multitext_set_entry(&ge->eta.ioengine, 0); multitext_set_entry(&ge->eta.iodepth, 0); @@ -2954,6 +2970,7 @@ static void combo_entry_changed(GtkComboBox *box, gpointer data) index = gtk_combo_box_get_active(box); multitext_set_entry(&ge->eta.iotype, index); + multitext_set_entry(&ge->eta.bs, index); multitext_set_entry(&ge->eta.ioengine, index); multitext_set_entry(&ge->eta.iodepth, index); } @@ -2963,6 +2980,7 @@ static void combo_entry_destroy(GtkWidget *widget, gpointer data) struct gui_entry *ge = (struct gui_entry *) data; multitext_free(&ge->eta.iotype); + multitext_free(&ge->eta.bs); multitext_free(&ge->eta.ioengine); multitext_free(&ge->eta.iodepth); } @@ -2998,6 +3016,7 @@ static GtkWidget *new_client_page(struct gui_entry *ge) g_signal_connect(ge->eta.names, "changed", G_CALLBACK(combo_entry_changed), ge); g_signal_connect(ge->eta.names, "destroy", G_CALLBACK(combo_entry_destroy), ge); ge->eta.iotype.entry = new_info_entry_in_frame(probe_box, "IO"); + ge->eta.bs.entry = new_info_entry_in_frame(probe_box, "Blocksize (Read/Write)"); ge->eta.ioengine.entry = new_info_entry_in_frame(probe_box, "IO Engine"); ge->eta.iodepth.entry = new_info_entry_in_frame(probe_box, "IO Depth"); ge->eta.jobs = new_info_entry_in_frame(probe_box, "Jobs"); diff --git a/init.c b/init.c index d4a4f339..2d10498b 100644 --- a/init.c +++ b/init.c @@ -583,7 +583,7 @@ static int fixup_options(struct thread_data *td) /* * This function leaks the buffer */ -static char *to_kmg(unsigned int val) +char *fio_uint_to_kmg(unsigned int val) { char *buf = malloc(32); char post[] = { 0, 'K', 'M', 'G', 'P', 'E', 0 }; @@ -871,10 +871,10 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, } else { char *c1, *c2, *c3, *c4; - c1 = to_kmg(td->o.min_bs[DDIR_READ]); - c2 = to_kmg(td->o.max_bs[DDIR_READ]); - c3 = to_kmg(td->o.min_bs[DDIR_WRITE]); - c4 = to_kmg(td->o.max_bs[DDIR_WRITE]); + c1 = fio_uint_to_kmg(td->o.min_bs[DDIR_READ]); + c2 = fio_uint_to_kmg(td->o.max_bs[DDIR_READ]); + c3 = fio_uint_to_kmg(td->o.min_bs[DDIR_WRITE]); + c4 = fio_uint_to_kmg(td->o.max_bs[DDIR_WRITE]); log_info("%s: (g=%d): rw=%s, bs=%s-%s/%s-%s," " ioengine=%s, iodepth=%u\n", -- 2.25.1