summaryrefslogtreecommitdiffstats
path: root/dlm
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2011-07-13 13:37:09 -0500
committerDavid Teigland <teigland@redhat.com>2011-07-13 13:37:28 -0500
commiteaba84e44dbac2eaefcbbcbd1c70cbfcd0c41b6a (patch)
tree48d8455269fb1a839148271fa45c7b06034c2004 /dlm
parent5ef1c190d61091af2201929a9633d044385fa694 (diff)
downloaddct-stuff-eaba84e44dbac2eaefcbbcbd1c70cbfcd0c41b6a.tar.gz
dct-stuff-eaba84e44dbac2eaefcbbcbd1c70cbfcd0c41b6a.tar.xz
dct-stuff-eaba84e44dbac2eaefcbbcbd1c70cbfcd0c41b6a.zip
dlm_load: sleep options
Diffstat (limited to 'dlm')
-rw-r--r--dlm/dlm_load.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/dlm/dlm_load.c b/dlm/dlm_load.c
index 9a953fe..52bcbea 100644
--- a/dlm/dlm_load.c
+++ b/dlm/dlm_load.c
@@ -40,6 +40,9 @@
#define MAX_LOCKS 32
#define MAX_RESOURCES 32
+#define DEFAULT_SLEEP_ITER 10
+#define DEFAULT_SLEEP_TIME 200000 /* usecs */
+
static dlm_lshandle_t *dh;
static int libdlm_fd;
static uint32_t iterations = 0;
@@ -47,6 +50,8 @@ static int maxn = MAX_LOCKS;
static int maxr = MAX_RESOURCES;
static int openclose = 0;
static int quiet = 0;
+static int sleep_iter = DEFAULT_SLEEP_ITER;
+static int sleep_time = DEFAULT_SLEEP_TIME;
static int timewarn = 0;
static uint64_t our_xid = 0;
static uint32_t ast_count = 0;
@@ -538,8 +543,9 @@ static void loop(void)
n++;
if (iterations && n == iterations)
break;
- if (!(n % 10))
- usleep(200000);
+
+ if (sleep_iter && !(n % sleep_iter))
+ usleep(sleep_time);
locknum = rand_int(0, maxn - 1);
noqueue = rand_int(0, 1);
@@ -677,9 +683,11 @@ static void print_usage(void)
{
printf("Options:\n");
printf("\n");
- printf(" -n The number of locks to work with, default %d\n", MAX_LOCKS);
- printf(" -r The number of resources to work with, default %d\n", MAX_RESOURCES);
- printf(" -i Iterations in looping stress test, default 0 is no limit\n");
+ printf(" -n <num> The number of locks to work with, default %d\n", MAX_LOCKS);
+ printf(" -r <num> The number of resources to work with, default %d\n", MAX_RESOURCES);
+ printf(" -i <num> Iterations in looping stress test, default 0 is no limit\n");
+ printf(" -S <num> sleep every <num> iterations, default %d\n", DEFAULT_SLEEP_ITER);
+ printf(" -s <num> sleep <num> usecs, default %d\n", DEFAULT_SLEEP_TIME);
printf(" -o Open/close existing lockspace\n");
printf(" -q Quiet output, only print errors\n");
}
@@ -690,7 +698,7 @@ static void decode_arguments(int argc, char **argv)
int optchar;
while (cont) {
- optchar = getopt(argc, argv, "n:r:i:qoh");
+ optchar = getopt(argc, argv, "n:r:i:s:S:qoh");
switch (optchar) {
@@ -714,6 +722,14 @@ static void decode_arguments(int argc, char **argv)
quiet = 1;
break;
+ case 's':
+ sleep_time = atoi(optarg);
+ break;
+
+ case 'S':
+ sleep_iter = atoi(optarg);
+ break;
+
case 'h':
print_usage();
exit(EXIT_SUCCESS);