aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-01-04 19:56:18 +0100
committerArnd Bergmann <arnd@arndb.de>2011-01-04 19:56:18 +0100
commit84bc2c99c98de41f4a94235590d18e17a7a49b9d (patch)
tree51ea227756d346c2473cc24ace846885fb8b9bbe
parent0f6ead3914b5436785469e770a14fff753723f06 (diff)
downloadflashbench-84bc2c99c98de41f4a94235590d18e17a7a49b9d.tar.gz
flashbench: make use of max argument
In a O_OFF_LIN or O_OFF_RAND series, autofill until max using the current length. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--flashbench.c44
-rw-r--r--vm.c13
2 files changed, 53 insertions, 4 deletions
diff --git a/flashbench.c b/flashbench.c
index 21d29fb..001e749 100644
--- a/flashbench.c
+++ b/flashbench.c
@@ -438,6 +438,7 @@ static int try_program(struct device *dev)
};
#endif
+#if 0
struct operation program[] = {
{O_SEQUENCE, 3},
{O_PRINT, .string="read by size\n"},
@@ -451,7 +452,7 @@ static int try_program(struct device *dev)
{O_PRINTF},
{O_FORMAT},
{O_REDUCE, .aggregate = A_MINIMUM},
- {O_OFF_LIN, 128, 4096 * 1024},
+ {O_OFF_LIN, 8, 4096 * 1024},
{O_READ},
{O_NEWLINE},
{O_END},
@@ -459,7 +460,46 @@ static int try_program(struct device *dev)
{O_END},
{O_END},
};
-
+#endif
+
+ struct operation program[] = {
+ {O_LEN_POW2, 12, 2048},
+ {O_SEQUENCE, 4},
+ {O_DROP},
+ {O_PRINTF},
+ {O_FORMAT},
+ {O_LENGTH},
+ {O_PRINT, .string = " linear write0/write1/writerand/read\n"},
+ {O_PRINTF},
+ {O_FORMAT},
+ {O_SEQUENCE, 4},
+ {O_REDUCE, .aggregate = A_TOTAL},
+ {O_OFF_LIN, 2048, -1},
+ {O_WRITE_ZERO},
+ {O_REDUCE, .aggregate = A_TOTAL},
+ {O_OFF_LIN, 2048, -1},
+ {O_WRITE_ONE},
+ {O_REDUCE, .aggregate = A_TOTAL},
+ {O_OFF_LIN, 2048, -1},
+ {O_WRITE_RAND},
+ {O_REDUCE, .aggregate = A_TOTAL},
+ {O_OFF_LIN, 2048, -1},
+ {O_READ},
+ {O_END},
+ {O_NEWLINE},
+#if 0
+ {O_DROP},
+ {O_PRINTF},
+ {O_SEQUENCE, 3},
+ {O_FORMAT}, {O_OFFSET},
+ {O_FORMAT}, {O_LENGTH},
+ {O_NEWLINE},
+ {O_END},
+#endif
+ {O_END},
+ {O_END},
+ };
+
call(program, dev, 0, 4096 * 1024, 1);
return 0;
diff --git a/vm.c b/vm.c
index 2bcf34c..70a3c34 100644
--- a/vm.c
+++ b/vm.c
@@ -377,9 +377,18 @@ static struct operation *off_lin(struct operation *op, struct device *dev,
{
struct operation *next = op+1;
unsigned int i;
+ unsigned int num, val;
+
+ if (op->val == -1) {
+ num = max/len;
+ val = max/num;
+ } else {
+ val = op->val;
+ num = op->num;
+ }
- for (i = 0; i < op->num && next; i++)
- next = call_aggregate(op+1, dev, off + i * op->val, max, len, op);
+ for (i = 0; i < num && next; i++)
+ next = call_aggregate(op+1, dev, off + i * val, max, len, op);
return next;
}