-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/tests/reads.c
*
{
printf("reads: read random or stride chunks of a file.\n");
printf("Usage:\n\n");
- printf("reads -f <filename> -s <filesize> -b <buffersize>"
- "-a <adjacent reads> [-v] [-h] [-C] [-l <stride_length> ] "
- "[ -o <stride_offset> ] [-S <seed>] [-n <iterations>]"
- "[-w <width>] [-t <timelimit>]\n");
+ printf("reads -f <filename> -s <filesize> -b <buffersize> -a <adjacent reads> [-v] [-h] [-C] [-l <stride_length> ] [ -o <stride_offset> ] [-S <seed>] [-n <iterations>][-w <width>] [-t <timelimit>]\n");
}
enum {
usage();
return RR_PARSE;
case 'v':
- verbosity ++;
+ verbosity++;
break;
case 'f':
fname = strdup(optarg);
case 's':
size = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse size %s\n", optarg);
+ fprintf(stderr, "Can't parse size %s\n",
+ optarg);
usage();
return RR_SET;
}
case 'b':
bsize = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse bsize %s\n", optarg);
+ fprintf(stderr, "Can't parse bsize %s\n",
+ optarg);
usage();
return RR_SET;
}
case 'a':
ad = (int)strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse ad %s\n", optarg);
+ fprintf(stderr, "Can't parse ad %s\n",
+ optarg);
usage();
return RR_SET;
}
case 'S':
seed = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse seed %s\n", optarg);
+ fprintf(stderr, "Can't parse seed %s\n",
+ optarg);
usage();
return RR_SET;
}
case 'n':
iterations = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse seed %s\n", optarg);
+ fprintf(stderr, "Can't parse seed %s\n",
+ optarg);
usage();
return RR_SET;
}
case 't':
timelimit = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse seed %s\n", optarg);
+ fprintf(stderr, "Can't parse seed %s\n",
+ optarg);
usage();
return RR_SET;
}
break;
- case 'l':
- stride_length = strtol(optarg, &term, 0);
+ case 'l':
+ stride_length = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse seed %s\n", optarg);
+ fprintf(stderr, "Can't parse seed %s\n",
+ optarg);
usage();
return RR_SET;
}
- break;
+ break;
case 'o':
stride_offset = strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse seed %s\n", optarg);
+ fprintf(stderr, "Can't parse seed %s\n",
+ optarg);
usage();
return RR_SET;
}
case 'w':
width = (int)strtol(optarg, &term, 0);
if (term == optarg) {
- fprintf (stderr, "Can't parse seed %s\n", optarg);
+ fprintf(stderr, "Can't parse seed %s\n",
+ optarg);
usage();
return RR_SET;
}
srand(seed);
gettimeofday(&start, NULL);
timelimit += start.tv_sec;
- for (i = 0; !iterations || i < iterations; i ++) {
+ for (i = 0; !iterations || i < iterations; i++) {
unsigned long block_nr;
int j;
- if (stride_length)
- block_nr = (unsigned long)(i*stride_length +
+ if (stride_length)
+ block_nr = (unsigned long)(i*stride_length +
stride_offset) % nblocks;
else
block_nr = (unsigned long)((double)nblocks*rand()/