From ff1f3280ded10c6844c07f0e466ca02224e48b62 Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Fri, 24 Feb 2012 08:17:30 +0100 Subject: [PATCH] fio: add minimal gui program Signed-off-by: Stephen M. Cameron Signed-off-by: Jens Axboe --- Makefile | 8 ++++++++ gfio.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 gfio.c diff --git a/Makefile b/Makefile index 673107f0..888715ed 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ PROGS = fio SCRIPTS = fio_generate_plots UNAME := $(shell uname) +GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` +GTKLDFLAGS = `pkg-config gtk+-2.0 --libs` + SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \ eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \ rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \ @@ -128,3 +131,8 @@ install: $(PROGS) $(SCRIPTS) ifneq ($(wildcard .depend),) include .depend endif + +gfio: gfio.c + $(CC) ${CFLAGS} ${GTKCFLAGS} ${GTKLDFLAGS} -pthread -o gfio gfio.c + + diff --git a/gfio.c b/gfio.c new file mode 100644 index 00000000..36e27f71 --- /dev/null +++ b/gfio.c @@ -0,0 +1,56 @@ +/* + * gfio - gui front end for fio - the flexible io tester + * + * Copyright (C) 2012 Stephen M. Cameron + * + * The license below covers all files distributed with fio unless otherwise + * noted in the file itself. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include + +struct gui { + GtkWidget *window; +}; + +static void quit_clicked(__attribute__((unused)) GtkWidget *widget, + __attribute__((unused)) gpointer data) +{ + gtk_main_quit(); +} + +static void init_ui(int *argc, char **argv[], struct gui *ui) +{ + gtk_init(argc, argv); + + ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(ui->window), "fio"); + gtk_window_set_default_size(GTK_WINDOW(ui->window), 700, 500); + + g_signal_connect(ui->window, "delete-event", G_CALLBACK (quit_clicked), NULL); + g_signal_connect(ui->window, "destroy", G_CALLBACK (quit_clicked), NULL); + + gtk_widget_show_all(ui->window); +} + +int main(int argc, char *argv[]) +{ + struct gui ui; + + init_ui(&argc, &argv, &ui); + gtk_main(); + return 0; +} -- 2.25.1