Revision 14e8d4f6
b/xseg/peers/user/bench-utils.c | ||
---|---|---|
109 | 109 |
|
110 | 110 |
int read_pattern(char *pattern) |
111 | 111 |
{ |
112 |
if (strcmp(pattern, "sync") == 0)
|
|
113 |
return IO_SYNC;
|
|
112 |
if (strcmp(pattern, "seq") == 0)
|
|
113 |
return IO_SEQ;
|
|
114 | 114 |
if (strcmp(pattern, "rand") == 0) |
115 | 115 |
return IO_RAND; |
116 | 116 |
return -1; |
... | ... | |
168 | 168 |
|
169 | 169 |
uint64_t determine_next(struct bench *prefs) |
170 | 170 |
{ |
171 |
if ((prefs->flags & PATTERN_FLAG) == IO_SYNC)
|
|
171 |
if ((prefs->flags & (1 << PATTERN_FLAG)) == IO_SEQ)
|
|
172 | 172 |
return prefs->sub_tm->completed; |
173 | 173 |
else { |
174 | 174 |
return lfsr_next(prefs->lfsr); |
b/xseg/peers/user/bench-xseg.c | ||
---|---|---|
64 | 64 |
fprintf(stderr, "Custom peer options: \n" |
65 | 65 |
" --------------------------------------------\n" |
66 | 66 |
" -op | None | XSEG operation [read|write|info|delete]\n" |
67 |
" --pattern | None | I/O pattern [sync|rand]\n"
|
|
67 |
" --pattern | None | I/O pattern [seq|rand]\n"
|
|
68 | 68 |
" -to | None | Total objects (not for read/write)\n" |
69 | 69 |
" -ts | None | Total I/O size\n" |
70 | 70 |
" -os | 4M | Object size\n" |
... | ... | |
158 | 158 |
XSEGLOG2(&lc, E, "Invalid syntax: --pattern %s\n", pattern); |
159 | 159 |
goto arg_fail; |
160 | 160 |
} |
161 |
prefs->flags |= (uint8_t)r << PATTERN_FLAG;
|
|
161 |
prefs->flags |= (uint8_t)r; |
|
162 | 162 |
|
163 | 163 |
/**************************\ |
164 | 164 |
* Check timer parameters * |
... | ... | |
303 | 303 |
//variables. |
304 | 304 |
create_id(); |
305 | 305 |
|
306 |
if ((prefs->flags & PATTERN_FLAG) == IO_RAND) {
|
|
306 |
if ((prefs->flags & (1 <<PATTERN_FLAG)) == IO_RAND) {
|
|
307 | 307 |
prefs->lfsr = malloc(sizeof(struct lfsr)); |
308 | 308 |
if (!prefs->lfsr) { |
309 | 309 |
perror("malloc"); |
b/xseg/peers/user/bench-xseg.h | ||
---|---|---|
43 | 43 |
* Pattern type occupies first flag bit. |
44 | 44 |
* If 1, it's synchronous, if 0, it's random. |
45 | 45 |
*/ |
46 |
#define PATTERN_FLAG 1
|
|
47 |
#define IO_SYNC 0
|
|
48 |
#define IO_RAND 1 |
|
46 |
#define PATTERN_FLAG 0
|
|
47 |
#define IO_SEQ 0 << PATTERN_FLAG
|
|
48 |
#define IO_RAND 1 << PATTERN_FLAG
|
|
49 | 49 |
|
50 | 50 |
/* |
51 | 51 |
* FIXME: The following are variables and definitions used to name objects and |
Also available in: Unified diff