fio: add minimal gui program
authorStephen M. Cameron <stephenmcameron@gmail.com>
Fri, 24 Feb 2012 07:17:30 +0000 (08:17 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Feb 2012 07:17:30 +0000 (08:17 +0100)
Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Makefile
gfio.c [new file with mode: 0644]

index 673107f0d1dffb9a9c58719ba52fab2e865d60e2..888715eda795fcbf1351341bf85fe1be2f3f884e 100644 (file)
--- 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 (file)
index 0000000..36e27f7
--- /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 <stephenmcameron@gmail.com> 
+ *
+ * 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 <gtk/gtk.h>
+
+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;
+}