Skip to contentSkip to conversation

aio tiobench

PATCH William Lee Irwin III 2 participants 4 messages Mar 15, 2004 Kbuild

lore
Share & tools
lore
#0 lore raw

So I farted around for a hour or two seeing if I could get tiobench to do aio for the general purpose of exercising codepaths, benchmarking, etc. in simple ways. Hopefully this answers the need for regular, simple, and easily-available methods of exercising and/or benchmarking the aio code in some way.

What I have, vs. debian's tiobench-0.3.3, follows. It works here (TM), for some value of "works" that bears no relation to how meaningful the numbers the thing spews are. Someone might want to rearrange how the timing bits work in order to make it line up with what they think would be meaningful. At the moment it just treats setting up IO requests like ordinary IO operations and has waiting for the batches to go through interspersed in all that.

Would rewriting tiobench from scratch instead be more valuable?

-- wli

$ diffstat tiobench.patch
 Makefile  |   16 +-
 aio.c     |   36 ++++
 tiotest.c |  456 ++++++++++++++++++++++++++++++++++++++++++++++----------------
 tiotest.h |   10 +
 4 files changed, 398 insertions(+), 120 deletions(-)
Makefile +8 -8
diff -prauN tiobench-0.3.3/Makefile tiobench-0.3.3-wli/Makefile
@@ -2,16 +2,13 @@
 
 CC=gcc
 #CFLAGS=-O3 -fomit-frame-pointer -Wall
-CFLAGS = -Wall -g
+CFLAGS += -Wall -g
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 CFLAGS += -O0
 else
 CFLAGS += -O2
 endif
 
-#DEFINES=-DUSE_MMAP 
-#-DUSE_MADVISE
-
 # This enables support for 64bit file offsets, allowing
 # possibility to test with files larger than (2^31) bytes.
 
@@ -21,6 +18,7 @@ endif
 
 LINK=gcc
 EXE=tiotest
+OBJ:=tiotest.o crc32.o aio.o
 PROJECT=tiobench
 # do it once instead of each time referenced
 VERSION=$(shell egrep "tiotest v[0-9]+.[0-9]+" tiotest.c | cut -d " " -f 7 | sed "s/v//g")
@@ -32,20 +30,23 @@ DOCDIR=/usr/local/doc/$(DISTNAME)
 
 all: $(EXE)
 
+aio.o:
+	$(CC) -c $(CFLAGS) $(DEFINES) aio.c -o aio.o
+
 crc32.o: crc32.c crc32.h
 	$(CC) -c $(CFLAGS) $(DEFINES) crc32.c -o crc32.o
 
 tiotest.o: tiotest.c tiotest.h crc32.h crc32.c Makefile
 	$(CC) -c $(CFLAGS) $(DEFINES) tiotest.c -o tiotest.o
 
-$(EXE): tiotest.o crc32.o
-	$(LINK) -o $(EXE) tiotest.o crc32.o -lpthread
+$(EXE): $(OBJ)
+	$(LINK) -o $@ $^ -lpthread
 	@echo
 	@echo "./tiobench.pl --help for usage options"
 	@echo
 
 clean:
-	rm -f tiotest.o crc32.o $(EXE) core
+	$(RM) $(OBJ) $(EXE) core
 
 dist:
 	ln -s . $(DISTNAME)
@@ -73,4 +74,3 @@ uninstall:
 	rm -f $(BINDIR)/tiobench.pl
 	rm -f $(BINDIR)/tiosum.pl
 	rm -rf $(DOCDIR)
-
aio.c +36 -0
diff -prauN tiobench-0.3.3/aio.c tiobench-0.3.3-wli/aio.c
@@ -0,0 +1,36 @@
+#define __KERNEL_SYSCALLS__
+extern int errno;
+
+#include <linux/aio_abi.h>
+#include <linux/types.h>
+#include <asm/unistd.h>
+
+#ifndef __NR_io_setup
+#define __NR_io_setup           268
+#endif
+
+#ifndef __NR_io_destroy
+#define __NR_io_destroy         269
+#endif
+
+#ifndef __NR_io_submit
+#define __NR_io_submit          270
+#endif
+
+#ifndef __NR_io_cancel
+#define __NR_io_cancel          271
+#endif
+
+#ifdef __NR_io_getevents
+#error shit
+#endif
+
+#ifndef __NR_io_getevents
+#define __NR_io_getevents       272
+#endif
+
+_syscall2(long,io_setup,unsigned,nr_events,aio_context_t *,context);
+_syscall1(long,io_destroy,aio_context_t,context);
+_syscall3(long,io_submit,aio_context_t,context,long,nr,struct iocb **,iocbs);
+_syscall3(long,io_cancel,aio_context_t,context,struct iocb *,iocb,struct io_event *,results);
+_syscall5(long,io_getevents,aio_context_t,context,long,min_nr,long,nr,struct io_event *,events,struct timespec *,timeout);
tiotest.c +345 -111

615 lines not on this page · raw message

tiotest.h +9 -1
diff -prauN tiobench-0.3.3/tiotest.h tiobench-0.3.3-wli/tiotest.h
@@ -53,7 +53,7 @@
 #endif
 #endif
 
-#if (LARGEFILES && USE_MMAP)
+#if LARGEFILES
 #warning "LARGEFILES and USE_MMAP might not work on 32bit architectures!"
 #endif
 
@@ -153,6 +153,12 @@ typedef struct {
 
 } ThreadTest;
 
+enum ioStyle {
+	NormalIO,
+	AsyncIO,
+	MmapIO,
+};
+
 typedef struct {
 	
 	char     path[MAX_PATHS][KBYTE];
@@ -181,6 +187,8 @@ typedef struct {
 	  This should be from 0 - 10
 	*/
 	int      debugLevel;
+	enum ioStyle style;
+	int      mapflag;
 
 } ArgumentOptions;
 
#1 lore raw
Quoted 5 lines · William Lee Irwin III

So I farted around for a hour or two seeing if I could get tiobench to do aio for the general purpose of exercising codepaths, benchmarking, etc. in simple ways. Hopefully this answers the need for regular, simple, and easily-available methods of exercising and/or benchmarking the aio code in some way.

You might want to check out the list of benchmarks collected at:

http://lse.sourceforge.net/io/aio.html

I found that adapting existing benchmarks made it hard to test some of the aio corner cases, so aio-stress is just a big state machine, with options to tweak how badly you want to abuse the aio subsystem.

There are a few other good ones on the page though.

-chris

#2 lore raw
Quoted 5 lines · William Lee Irwin III
Quoted 5 lines

So I farted around for a hour or two seeing if I could get tiobench to do aio for the general purpose of exercising codepaths, benchmarking, etc. in simple ways. Hopefully this answers the need for regular, simple, and easily-available methods of exercising and/or benchmarking the aio code in some way.

Quoted 6 lines · Chris Mason

You might want to check out the list of benchmarks collected at:
http://lse.sourceforge.net/io/aio.html
I found that adapting existing benchmarks made it hard to test some of the aio corner cases, so aio-stress is just a big state machine, with options to tweak how badly you want to abuse the aio subsystem. There are a few other good ones on the page though.

Looks encouraging. What's the distro coverage like? deb doesn't have them.

-- wli

#3 lore raw
Quoted 8 lines · William Lee Irwin III
Quoted 5 lines · William Lee Irwin III
Quoted 5 lines

So I farted around for a hour or two seeing if I could get tiobench to do aio for the general purpose of exercising codepaths, benchmarking, etc. in simple ways. Hopefully this answers the need for regular, simple, and easily-available methods of exercising and/or benchmarking the aio code in some way.

On Mon, Mar 15, 2004 at 08:28:43AM -0500, Chris Mason wrote:

Quoted 9 lines
Quoted 6 lines

You might want to check out the list of benchmarks collected at:
http://lse.sourceforge.net/io/aio.html
I found that adapting existing benchmarks made it hard to test some of the aio corner cases, so aio-stress is just a big state machine, with options to tweak how badly you want to abuse the aio subsystem. There are a few other good ones on the page though.

Looks encouraging. What's the distro coverage like? deb doesn't have them.

I doubt anyone ships packages for them. LTP has integrated some aio tests though.

-chris