Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Oct 4, 2014 Kbuild

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit e3b4e568b362ec8d89243609e75763b37cf81b17:

engines/libaio: reset 'wait_start' on non-EAGAIN (2014-10-01 08:48:54 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to b220c6d6f37fc55760d66728f6f9f521ea2f9b46:

Merge branch 'expression-parser' (2014-10-03 13:20:16 -0600)

----------------------------------------------------------------

Jens Axboe (18):
fio: support modulus for the arithmetic parser Update .gitignore with auto-generated lex/yacc outputs
exp: set float output for int modulus
Wire up exp/test-expression-parser
Makefile: silence fixup
Makefile: silence make clean
exp: fix __pow_finite being undefined
Merge branch 'master' into expression-parser
configure: fix for the cases where bison provides yacc
exp: get rid of the #line bug workaround
Makefile: PARSER_OBJS is not used anymore
exp: update man page and HOWTO
Makefile: properly annotate LEX/YACC parts
exp: we don't need -ly
Makefile: exp/fixup-buggy-yacc-output is no more engines/libaio: modify getevents and commit error handling Fio 2.1.13
Merge branch 'expression-parser'

Stephen M. Cameron (10):
fio: allow arithmetic expressions to be used in job files
fio: support suffixes in expression parser
fio: support exponentiation in expression parser
exp: fix shift/reduce conflict complaints
Treat colons and commas as end of input in expression parser verify that expression parsing code gets the right answer do not call fprintf from yyerror in expression parser enable informing arithmetic parser of implicit units remove unused bye symbol from arithmetic parser make expression parser handle scientific notation

 .gitignore                   |    2 +
 FIO-VERSION-GEN              |    2 +-
 HOWTO                        |   15 ++-
 Makefile                     |   36 ++++++-
 configure                    |   51 +++++++++
 engines/libaio.c             |   11 ++
 exp/README.md                |    7 ++
 exp/expression-parser.l      |  167 +++++++++++++++++++++++++++++
 exp/expression-parser.y      |  244 ++++++++++++++++++++++++++++++++++++++++++
 exp/test-expression-parser.c |   54 ++++++++++
 fio.1                        |   24 ++++-
 os/windows/install.wxs       |    2 +-
 parse.c                      |  109 +++++++++++++++++--
 13 files changed, 708 insertions(+), 16 deletions(-)
 create mode 100644 exp/README.md
 create mode 100644 exp/expression-parser.l
 create mode 100644 exp/expression-parser.y
 create mode 100644 exp/test-expression-parser.c

---

Diff of recent changes:

.gitignore +2 -0
index 3993a30..c9d90fb 100644
@@ -7,3 +7,5 @@
 /config.log
 /cscope.out
 /fio
+y.tab.*
+lex.yy.c
FIO-VERSION-GEN +1 -1
index d36c76d..3057fed 100755
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=FIO-VERSION-FILE
-DEF_VER=fio-2.1.12
+DEF_VER=fio-2.1.13
 
 LF='
 '
HOWTO +14 -1
index 693eeb1..2cecbbb 100644
@@ -253,7 +253,20 @@ machine.
 
 This section describes in details each parameter associated with a job.
 Some parameters take an option of a given type, such as an integer or
-a string. The following types are used:
+a string. Anywhere a numeric value is required, an arithmetic expression
+may be used, provided it is surrounded by parentheses. Supported operators
+are:
+
+	addition (+)
+	subtraction (-)
+	multiplication (*)
+	division (/)
+	modulus (%)
+	exponentiation (^)
+
+For time values in expressions, units are microseconds by default. This is
+different than for time values not in expressions (not enclosed in
+parentheses). The following types are used:
 
 str	String. This is a sequence of alpha characters.
 time	Integer with possible time suffix. In seconds unless otherwise
Makefile +33 -3
index 8c6c056..d735ec7 100644
@@ -158,6 +158,11 @@ endif
 OBJS = $(SOURCE:.c=.o)
 
 FIO_OBJS = $(OBJS) fio.o
+
+ifdef CONFIG_ARITHMETIC
+FIO_OBJS += lex.yy.o y.tab.o
+endif
+
 GFIO_OBJS = $(OBJS) gfio.o graph.o tickmarks.o ghelpers.o goptions.o gerror.o \
 			gclient.o gcompat.o cairo_text_helpers.o printing.o
 
@@ -218,8 +223,10 @@ PROGS += $(T_PROGS)
 ifneq ($(findstring $(MAKEFLAGS),s),s)
 ifndef V
 	QUIET_CC	= @echo '   ' CC $@;
-	QUIET_LINK	= @echo '   ' LINK $@;
-	QUIET_DEP	= @echo '   ' DEP $@;
+	QUIET_LINK	= @echo ' ' LINK $@;
+	QUIET_DEP	= @echo '  ' DEP $@;
+	QUIET_YACC	= @echo ' ' YACC $@;
+	QUIET_LEX	= @echo '  ' LEX $@;
 endif
 endif
 
@@ -259,6 +266,29 @@ override CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
 		sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
 	@rm -f $*.d.tmp
 
+ifdef CONFIG_ARITHMETIC
+lex.yy.c: exp/expression-parser.l
+	$(QUIET_LEX)$(LEX) exp/expression-parser.l
+
+lex.yy.o: lex.yy.c y.tab.h
+	$(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
+
+y.tab.o: y.tab.c y.tab.h
+	$(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
+
+y.tab.c: exp/expression-parser.y
+	$(QUIET_YACC)$(YACC) --no-lines -d exp/expression-parser.y
+
+y.tab.h: y.tab.c
+
+exp/test-expression-parser.o: exp/test-expression-parser.c
+	$(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
+exp/test-expression-parser: exp/test-expression-parser.o
+	$(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) $< y.tab.o lex.yy.o -o $@ $(LIBS)
+
+parse.o: lex.yy.o y.tab.o
+endif
+
 init.o: FIO-VERSION-FILE init.c
 	$(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c
 
@@ -319,7 +349,7 @@ t/dedupe: $(T_DEDUPE_OBJS)
 	$(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_DEDUPE_OBJS) $(LIBS)
 
 clean: FORCE
-	-rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE *.d lib/*.d crc/*.d engines/*.d profiles/*.d t/*.d config-host.mak config-host.h
+	@rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE *.d lib/*.d crc/*.d engines/*.d profiles/*.d t/*.d config-host.mak config-host.h y.tab.[ch] lex.yy.c exp/*.[do]
 
 distclean: clean FORCE
 	@rm -f cscope.out fio.pdf fio_generate_plots.pdf fio2gnuplot.pdf
configure +51 -0

63 lines not on this page · raw message

engines/libaio.c +11 -0
index 31c850e..6c5d73e 100644
@@ -167,6 +167,8 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
 			events += r;
 		else if (r == -EAGAIN)
 			usleep(100);
+		else
+			break;
 	} while (events < min);
 
 	return r < 0 ? r : events;
@@ -283,6 +285,15 @@ static int fio_libaio_commit(struct thread_data *td)
 			}
 			usleep(1);
 			continue;
+		} else if (ret == -ENOMEM) {
+			/*
+			 * If we get -ENOMEM, reap events if we can. If
+			 * we cannot, treat it as a fatal event since there's
+			 * nothing we can do about it.
+			 */
+			if (ld->queued)
+				ret = 0;
+			break;
 		} else
 			break;
 	} while (ld->queued);
exp/README.md new file +7 -0
new file mode 100644
index 0000000..48c11c9
@@ -0,0 +1,7 @@
+simple-expression-parser
+========================
+
+A simple expression parser for arithmetic expressions made with bison + flex
+
+To use, see the example test-expression-parser.c
+
exp/expression-parser.l new file +167 -0

167 lines not on this page · raw message

exp/expression-parser.y new file +244 -0

244 lines not on this page · raw message

exp/test-expression-parser.c new file +54 -0

54 lines not on this page · raw message

fio.1 +23 -1
index d64fbb7..b4dec91 100644
@@ -115,7 +115,29 @@ and there may be any number of global sections.  Specific job definitions
 may override any parameter set in global sections.
 .SH "JOB PARAMETERS"
 .SS Types
-Some parameters may take arguments of a specific type.  The types used are:
+Some parameters may take arguments of a specific type.
+Anywhere a numeric value is required, an arithmetic expression may be used,
+provided it is surrounded by parentheses. Supported operators are:
+.RS
+.RS
+.TP
+.B addition (+)
+.TP
+.B subtraction (-)
+.TP
+.B multiplication (*)
+.TP
+.B division (/)
+.TP
+.B modulus (%)
+.TP
+.B exponentiation (^)
+.RE
+.RE
+.P
+For time values in expressions, units are microseconds by default. This is
+different than for time values not in expressions (not enclosed in
+parentheses). The types used are:
 .TP
 .I str
 String: a sequence of alphanumeric characters.
os/windows/install.wxs +1 -1
index 18918cc..7338d63 100755
@@ -10,7 +10,7 @@
 	<Product Id="*"
 	  Codepage="1252" Language="1033"
 	  Manufacturer="fio" Name="fio"
-	  UpgradeCode="2338A332-5511-43CF-B9BD-5C60496CCFCC" Version="2.1.12">
+	  UpgradeCode="2338A332-5511-43CF-B9BD-5C60496CCFCC" Version="2.1.13">
 		<Package
 		  Description="Flexible IO Tester"
 		  InstallerVersion="301" Keywords="Installer,MSI,Database"
parse.c +100 -9

144 lines not on this page · raw message