static void handle_gs(struct fio_client *client, struct fio_net_cmd *cmd);
static void handle_probe(struct fio_client *client, struct fio_net_cmd *cmd);
static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd);
+static void handle_stop(struct fio_client *client, struct fio_net_cmd *cmd);
struct client_ops fio_client_ops = {
.text_op = handle_text,
.disk_util = handle_du,
.thread_status = handle_ts,
.group_stats = handle_gs,
+ .stop = handle_stop,
.eta = display_thread_status,
.probe = handle_probe,
};
static void handle_stop(struct fio_client *client, struct fio_net_cmd *cmd)
{
- struct cmd_end_pdu *pdu = (struct cmd_end_pdu *) cmd->payload;
-
- client->state = Client_stopped;
- client->error = le32_to_cpu(pdu->error);
-
if (client->error)
log_info("client <%s>: exited with error %d\n", client->hostname, client->error);
}
+static void convert_stop(struct fio_net_cmd *cmd)
+{
+ struct cmd_end_pdu *pdu = (struct cmd_end_pdu *) cmd->payload;
+
+ pdu->error = le32_to_cpu(pdu->error);
+}
+
static void convert_text(struct fio_net_cmd *cmd)
{
struct cmd_text_pdu *pdu = (struct cmd_text_pdu *) cmd->payload;
handle_start(client, cmd);
free(cmd);
break;
- case FIO_NET_CMD_STOP:
- handle_stop(client, cmd);
+ case FIO_NET_CMD_STOP: {
+ struct cmd_end_pdu *pdu = (struct cmd_end_pdu *) cmd->payload;
+
+ convert_stop(cmd);
+ client->state = Client_stopped;
+ client->error = pdu->error;
+ ops->stop(client, cmd);
free(cmd);
break;
+ }
case FIO_NET_CMD_ADD_JOB:
if (ops->add_job)
ops->add_job(client, cmd);
typedef void (*client_quit_op)(struct fio_client *);
typedef void (*client_add_job_op)(struct fio_client *, struct fio_net_cmd *);
typedef void (*client_timed_out)(struct fio_client *);
+typedef void (*client_stop_op)(struct fio_client *, struct fio_net_cmd *);
struct client_ops {
client_text_op_func text_op;
client_quit_op quit;
client_add_job_op add_job;
client_timed_out timed_out;
+ client_stop_op stop;
int stay_connected;
};
*/
#include <locale.h>
#include <malloc.h>
+#include <string.h>
#include <glib.h>
#include <cairo.h>
static const char *gfio_graph_font;
static void gfio_update_thread_status(char *status_message, double perc);
+static void view_log(GtkWidget *w, gpointer data);
#define ARRAYSIZE(x) (sizeof((x)) / (sizeof((x)[0])))
struct gui *ui;
GtkWidget *results_widget;
GtkWidget *disk_util_frame;
+ GtkWidget *err_entry;
};
static void setup_iops_graph(struct gui *ui)
entry_set_int_value(entry, ts->groupid);
entry = new_info_entry_in_frame(box, "Jobs");
entry_set_int_value(entry, ts->members);
- entry = new_info_entry_in_frame(box, "Error");
+ gc->err_entry = entry = new_info_entry_in_frame(box, "Error");
entry_set_int_value(entry, ts->error);
entry = new_info_entry_in_frame(box, "PID");
entry_set_int_value(entry, ts->pid);
gtk_list_store_set(gc->ui->log_model, &iter, 2, p->level, -1);
gtk_list_store_set(gc->ui->log_model, &iter, 3, p->buf, -1);
+ if (p->level == FIO_LOG_ERR)
+ view_log(NULL, (gpointer) gc->ui);
+
gdk_threads_leave();
}
gdk_threads_leave();
}
+static void gfio_client_stop(struct fio_client *client, struct fio_net_cmd *cmd)
+{
+ struct gfio_client *gc = client->client_data;
+
+ gdk_threads_enter();
+
+ gfio_set_connected(gc->ui, 0);
+
+ if (gc->err_entry)
+ entry_set_int_value(gc->err_entry, client->error);
+
+ gdk_threads_leave();
+}
+
struct client_ops gfio_client_ops = {
.text_op = gfio_text_op,
.disk_util = gfio_disk_util_op,
.quit = gfio_quit_op,
.add_job = gfio_add_job_op,
.timed_out = gfio_client_timed_out,
+ .stop = gfio_client_stop,
.stay_connected = 1,
};