Recent changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit ddb754dbb54a8174080f753c85ff56a7ffca3957:

  HOWTO: typo: write_log_log -> write_lat_log + use suffix (2012-04-05 18:18:35 -0600)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Jens Axboe (5):
      Fio 2.0.7
      Free disk util on exit, not on stats display
      Define SIGUSR1 to inform fio to dump run stats while continuing to run
      Make fio include the git version in the version output
      Fix repeated link of fio

 FIO-VERSION-GEN |   42 ++++++++++++++++++++++++++++++++++++++++++
 Makefile        |   19 ++++++++++++++-----
 backend.c       |   11 +++++++++++
 client.c        |   10 ++++++++++
 fio_version.h   |    2 +-
 init.c          |   15 ++++-----------
 stat.c          |   51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 stat.h          |    1 +
 8 files changed, 132 insertions(+), 19 deletions(-)
 create mode 100755 FIO-VERSION-GEN

---

Diff of recent changes:

diff --git a/FIO-VERSION-GEN b/FIO-VERSION-GEN
new file mode 100755
index 0000000..d812255
--- /dev/null
+++ b/FIO-VERSION-GEN
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+GVF=FIO-VERSION-FILE
+DEF_VER=v2.0.5.GIT
+
+LF='
+'
+
+# First see if there is a version file (included in release tarballs),
+# then try git-describe, then default.
+if test -f version
+then
+	VN=$(cat version) || VN="$DEF_VER"
+elif test -d .git -o -f .git &&
+	VN=$(git describe --match "fio-[0-9]*" --abbrev=4 HEAD 2>/dev/null) &&
+	case "$VN" in
+	*$LF*) (exit 1) ;;
+	v[0-9]*)
+		git update-index -q --refresh
+		test -z "$(git diff-index --name-only HEAD --)" ||
+		VN="$VN-dirty" ;;
+	esac
+then
+	VN=$VN
+else
+	VN="$DEF_VER"
+fi
+
+VN=$(expr "$VN" : v*'\(.*\)')
+
+if test -r $GVF
+then
+	VC=$(sed -e 's/^FIO_VERSION = //' <$GVF)
+else
+	VC=unset
+fi
+test "$VN" = "$VC" || {
+	echo >&2 "FIO_VERSION = $VN"
+	echo "FIO_VERSION = $VN" >$GVF
+}
+
+
diff --git a/Makefile b/Makefile
index 673107f..c605d7b 100644
--- a/Makefile
+++ b/Makefile
@@ -93,9 +93,18 @@ else
 mandir = $(prefix)/man
 endif
 
-all: .depend $(PROGS) $(SCRIPTS)
+all: .depend $(PROGS) $(SCRIPTS) FORCE
 
-.c.o: .depend
+.PHONY: all install clean
+.PHONY: FORCE cscope
+
+FIO-VERSION-FILE: FORCE
+	@$(SHELL_PATH) ./FIO-VERSION-GEN
+-include FIO-VERSION-FILE
+
+CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
+
+.c.o: .depend FORCE
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
 
 t/stest: $(T_SMALLOC_OBJS)
@@ -112,13 +121,13 @@ fio: $(OBJS)
 
 $(PROGS): .depend
 
-clean:
-	-rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core
+clean: FORCE
+	-rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE
 
 cscope:
 	@cscope -b -R
 
-install: $(PROGS) $(SCRIPTS)
+install: $(PROGS) $(SCRIPTS) FORCE
 	$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
 	$(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
 	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
diff --git a/backend.c b/backend.c
index ec42a5c..f4bc553 100644
--- a/backend.c
+++ b/backend.c
@@ -87,6 +87,11 @@ static void sig_int(int sig)
 	}
 }
 
+static void sig_show_status(int sig)
+{
+	show_running_run_stats();
+}
+
 static void set_sig_handlers(void)
 {
 	struct sigaction act;
@@ -101,6 +106,11 @@ static void set_sig_handlers(void)
 	act.sa_flags = SA_RESTART;
 	sigaction(SIGTERM, &act, NULL);
 
+	memset(&act, 0, sizeof(act));
+	act.sa_handler = sig_show_status;
+	act.sa_flags = SA_RESTART;
+	sigaction(SIGUSR1, &act, NULL);
+
 	if (is_backend) {
 		memset(&act, 0, sizeof(act));
 		act.sa_handler = sig_int;
@@ -1663,6 +1673,7 @@ int fio_backend(void)
 	for_each_td(td, i)
 		fio_options_free(td);
 
+	free_disk_util();
 	cgroup_kill(cgroup_list);
 	sfree(cgroup_list);
 	sfree(cgroup_mnt);
diff --git a/client.c b/client.c
index dd75882..ee6765e 100644
--- a/client.c
+++ b/client.c
@@ -344,6 +344,11 @@ static void sig_int(int sig)
 	fio_clients_terminate();
 }
 
+static void sig_show_status(int sig)
+{
+	show_running_run_stats();
+}
+
 static void client_signal_handler(void)
 {
 	struct sigaction act;
@@ -357,6 +362,11 @@ static void client_signal_handler(void)
 	act.sa_handler = sig_int;
 	act.sa_flags = SA_RESTART;
 	sigaction(SIGTERM, &act, NULL);
+
+	memset(&act, 0, sizeof(act));
+	act.sa_handler = sig_show_status;
+	act.sa_flags = SA_RESTART;
+	sigaction(SIGUSR1, &act, NULL);
 }
 
 static void probe_client(struct fio_client *client)
diff --git a/fio_version.h b/fio_version.h
index 42c0ff7..34b5784 100644
--- a/fio_version.h
+++ b/fio_version.h
@@ -3,6 +3,6 @@
 
 #define FIO_MAJOR	2
 #define FIO_MINOR	0
-#define FIO_PATCH	6
+#define FIO_PATCH	7
 
 #endif
diff --git a/init.c b/init.c
index 69ed30c..1eea800 100644
--- a/init.c
+++ b/init.c
@@ -25,14 +25,7 @@
 
 #include "fio_version.h"
 
-#if FIO_PATCH > 0
-const char fio_version_string[] =	__fio_stringify(FIO_MAJOR) "."	\
-					__fio_stringify(FIO_MINOR) "."	\
-					__fio_stringify(FIO_PATCH);
-#else
-const char fio_version_string[] =	__fio_stringify(FIO_MAJOR) "."	\
-					__fio_stringify(FIO_MINOR);
-#endif
+const char fio_version_string[] = FIO_VERSION;
 
 #define FIO_RANDSEED		(0xb1899bedUL)
 
@@ -1188,7 +1181,7 @@ static int fill_def_thread(void)
 
 static void usage(const char *name)
 {
-	printf("fio %s\n", fio_version_string);
+	printf("%s\n", fio_version_string);
 	printf("%s [options] [job options] <job file(s)>\n", name);
 	printf("  --debug=options\tEnable debug logging. May be one/more of:\n"
 		"\t\t\tprocess,file,io,mem,blktrace,verify,random,parse,\n"
@@ -1419,7 +1412,7 @@ int parse_cmd_line(int argc, char *argv[])
 			break;
 		case 'v':
 			if (!cur_client) {
-				log_info("fio %s\n", fio_version_string);
+				log_info("%s\n", fio_version_string);
 				do_exit++;
 			}
 			break;
@@ -1645,7 +1638,7 @@ int parse_options(int argc, char *argv[])
 	}
 
 	if (!terse_output)
-		log_info("fio %s\n", fio_version_string);
+		log_info("%s\n", fio_version_string);
 
 	return 0;
 }
diff --git a/stat.c b/stat.c
index 2ab5f1a..542e910 100644
--- a/stat.c
+++ b/stat.c
@@ -1102,12 +1102,59 @@ void show_run_stats(void)
 	else if (!terse_output)
 		show_disk_util(0);
 
-	free_disk_util();
-
 	free(runstats);
 	free(threadstats);
 }
 
+static void *__show_running_run_stats(void *arg)
+{
+	struct thread_data *td;
+	unsigned long long *rt;
+	struct timeval tv;
+	int i;
+
+	rt = malloc(thread_number * sizeof(unsigned long long));
+	fio_gettime(&tv, NULL);
+
+	for_each_td(td, i) {
+		rt[i] = mtime_since(&td->start, &tv);
+		if (td_read(td) && td->io_bytes[DDIR_READ])
+			td->ts.runtime[DDIR_READ] += rt[i];
+		if (td_write(td) && td->io_bytes[DDIR_WRITE])
+			td->ts.runtime[DDIR_WRITE] += rt[i];
+
+		update_rusage_stat(td);
+		td->ts.io_bytes[0] = td->io_bytes[0];
+		td->ts.io_bytes[1] = td->io_bytes[1];
+		td->ts.total_run_time = mtime_since(&td->epoch, &tv);
+	}
+
+	show_run_stats();
+
+	for_each_td(td, i) {
+		if (td_read(td) && td->io_bytes[DDIR_READ])
+			td->ts.runtime[DDIR_READ] -= rt[i];
+		if (td_write(td) && td->io_bytes[DDIR_WRITE])
+			td->ts.runtime[DDIR_WRITE] -= rt[i];
+	}
+
+	free(rt);
+	return NULL;
+}
+
+/*
+ * Called from signal handler. It _should_ be safe to just run this inline
+ * in the sig handler, but we should be disturbing the system less by just
+ * creating a thread to do it.
+ */
+void show_running_run_stats(void)
+{
+	pthread_t thread;
+
+	pthread_create(&thread, NULL, __show_running_run_stats, NULL);
+	pthread_detach(thread);
+}
+
 static inline void add_stat_sample(struct io_stat *is, unsigned long data)
 {
 	double val = data;
diff --git a/stat.h b/stat.h
index 3115539..be27c72 100644
--- a/stat.h
+++ b/stat.h
@@ -193,6 +193,7 @@ extern void show_group_stats(struct group_run_stats *rs);
 extern int calc_thread_status(struct jobs_eta *je, int force);
 extern void display_thread_status(struct jobs_eta *je);
 extern void show_run_stats(void);
+extern void show_running_run_stats(void);
 extern void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src, int nr);
 extern void sum_group_stats(struct group_run_stats *dst, struct group_run_stats *src);
 extern void init_thread_stat(struct thread_stat *ts);
--
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


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux