summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/filebench/common/filebench.h2
-rw-r--r--usr/src/cmd/filebench/common/fileset.c13
-rw-r--r--usr/src/cmd/filebench/common/fileset.h2
-rw-r--r--usr/src/cmd/filebench/common/flowop.c5
-rw-r--r--usr/src/cmd/filebench/common/flowop_library.c42
-rw-r--r--usr/src/cmd/filebench/common/ipc.h1
-rw-r--r--usr/src/cmd/filebench/common/misc.c7
-rw-r--r--usr/src/cmd/filebench/common/parser_gram.y157
-rw-r--r--usr/src/cmd/filebench/common/parser_lex.l54
-rw-r--r--usr/src/cmd/filebench/common/procflow.c21
-rw-r--r--usr/src/cmd/filebench/config/generic.func9
-rw-r--r--usr/src/cmd/filebench/config/newfeatures.prof3
-rwxr-xr-xusr/src/cmd/filebench/fbscript/filebench.pl7
-rw-r--r--usr/src/cmd/filebench/workloads/bringover.f9
-rw-r--r--usr/src/cmd/filebench/workloads/copyfiles.f8
-rw-r--r--usr/src/cmd/filebench/workloads/createfiles.f8
-rw-r--r--usr/src/cmd/filebench/workloads/filemicro_seqwriterand.f9
-rw-r--r--usr/src/cmd/filebench/workloads/filemicro_seqwriterandvargam.f9
-rw-r--r--usr/src/cmd/filebench/workloads/filemicro_seqwriterandvartab.f9
19 files changed, 274 insertions, 101 deletions
diff --git a/usr/src/cmd/filebench/common/filebench.h b/usr/src/cmd/filebench/common/filebench.h
index bcbe843723..bc98afed36 100644
--- a/usr/src/cmd/filebench/common/filebench.h
+++ b/usr/src/cmd/filebench/common/filebench.h
@@ -118,7 +118,7 @@ void filebench_plugin_funcvecinit(void);
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
-#define FILEBENCH_VERSION "1.4.4"
+#define FILEBENCH_VERSION "1.4.5"
#define FILEBENCHDIR "/usr/benchmarks/filebench"
#define FILEBENCH_PROMPT "filebench> "
#define MAX_LINE_LEN 1024
diff --git a/usr/src/cmd/filebench/common/fileset.c b/usr/src/cmd/filebench/common/fileset.c
index 64333a561f..03184162ec 100644
--- a/usr/src/cmd/filebench/common/fileset.c
+++ b/usr/src/cmd/filebench/common/fileset.c
@@ -308,6 +308,7 @@ fileset_alloc_file(filesetentry_t *entry)
char *pathtmp;
off64_t seek;
fb_fdesc_t fdesc;
+ int trust_tree;
fileset = entry->fse_fileset;
(void) fb_strlcpy(path, avd_get_str(fileset->fs_path), MAXPATHLEN);
@@ -320,7 +321,9 @@ fileset_alloc_file(filesetentry_t *entry)
filebench_log(LOG_DEBUG_IMPL, "Populated %s", entry->fse_path);
/* see if reusing and this file exists */
- if ((entry->fse_flags & FSE_REUSING) && (FB_STAT(path, &sb) == 0)) {
+ trust_tree = avd_get_bool(fileset->fs_trust_tree);
+ if ((entry->fse_flags & FSE_REUSING) && (trust_tree ||
+ (FB_STAT(path, &sb) == 0))) {
if (FB_OPEN(&fdesc, path, O_RDWR, 0) == FILEBENCH_ERROR) {
filebench_log(LOG_INFO,
"Attempted but failed to Re-use file %s",
@@ -329,7 +332,7 @@ fileset_alloc_file(filesetentry_t *entry)
return (FILEBENCH_ERROR);
}
- if (sb.st_size == (off64_t)entry->fse_size) {
+ if (trust_tree || (sb.st_size == (off64_t)entry->fse_size)) {
filebench_log(LOG_DEBUG_IMPL,
"Re-using file %s", path);
@@ -1012,8 +1015,12 @@ fileset_create(fileset_t *fileset)
(void) fb_strlcat(path, "/", MAXPATHLEN);
(void) fb_strlcat(path, fileset_name, MAXPATHLEN);
+ /* if reusing and trusting to exist, just blindly reuse */
+ if (avd_get_bool(fileset->fs_trust_tree)) {
+ reusing = 1;
+
/* if exists and resusing, then don't create new */
- if (((stat64(path, &sb) == 0)&& (strlen(path) > 3) &&
+ } else if (((stat64(path, &sb) == 0)&& (strlen(path) > 3) &&
(strlen(avd_get_str(fileset->fs_path)) > 2)) &&
avd_get_bool(fileset->fs_reuse)) {
reusing = 1;
diff --git a/usr/src/cmd/filebench/common/fileset.h b/usr/src/cmd/filebench/common/fileset.h
index 80537d174a..2abe1d41a2 100644
--- a/usr/src/cmd/filebench/common/fileset.h
+++ b/usr/src/cmd/filebench/common/fileset.h
@@ -131,6 +131,8 @@ typedef struct fileset {
avd_t fs_paralloc; /* Attr */
avd_t fs_cached; /* Attr */
avd_t fs_reuse; /* Attr */
+ avd_t fs_readonly; /* Attr */
+ avd_t fs_trust_tree; /* Attr */
double fs_meandepth; /* Computed mean depth */
double fs_meanwidth; /* Specified mean dir width */
double fs_meansize; /* Specified mean file size */
diff --git a/usr/src/cmd/filebench/common/flowop.c b/usr/src/cmd/filebench/common/flowop.c
index 6bbe470fa3..a36c296721 100644
--- a/usr/src/cmd/filebench/common/flowop.c
+++ b/usr/src/cmd/filebench/common/flowop.c
@@ -364,7 +364,7 @@ flowop_start(threadflow_t *threadflow)
{
flowop_t *flowop;
size_t memsize;
- int ret = 0;
+ int ret = FILEBENCH_OK;
#ifdef HAVE_PROCFS
if (noproc == 0) {
@@ -447,8 +447,7 @@ flowop_start(threadflow_t *threadflow)
#endif
/* Main filebench worker loop */
- /* CONSTCOND */
- while (1) {
+ while (ret == FILEBENCH_OK) {
int i, count;
/* Abort if asked */
diff --git a/usr/src/cmd/filebench/common/flowop_library.c b/usr/src/cmd/filebench/common/flowop_library.c
index 26e5f1a3d5..168f160414 100644
--- a/usr/src/cmd/filebench/common/flowop_library.c
+++ b/usr/src/cmd/filebench/common/flowop_library.c
@@ -393,6 +393,28 @@ flowoplib_filesetup(threadflow_t *threadflow, flowop_t *flowop,
if (fd == -1)
return (FILEBENCH_ERROR);
+ /* check for conflicting fdnumber and file name */
+ if ((fd > 0) && (threadflow->tf_fse[fd] != NULL)) {
+ char *fd_based_name;
+
+ fd_based_name =
+ avd_get_str(threadflow->tf_fse[fd]->fse_fileset->fs_name);
+
+ if (flowop->fo_filename != NULL) {
+ char *fo_based_name;
+
+ fo_based_name = avd_get_str(flowop->fo_filename);
+ if (strcmp(fd_based_name, fo_based_name) != 0) {
+ filebench_log(LOG_ERROR, "Name of fd refer"
+ "enced fileset name (%s) CONFLICTS with"
+ " flowop supplied fileset name (%s)",
+ fd_based_name, fo_based_name);
+ filebench_shutdown(1);
+ return (FILEBENCH_ERROR);
+ }
+ }
+ }
+
if (threadflow->tf_fd[fd].fd_ptr == NULL) {
int ret;
@@ -1482,6 +1504,7 @@ flowoplib_openfile_common(threadflow_t *threadflow, flowop_t *flowop, int fd)
filesetentry_t *file;
char *fileset_name;
int tid = 0;
+ int openflag = 0;
int err;
if (flowop->fo_fileset == NULL) {
@@ -1497,6 +1520,14 @@ flowoplib_openfile_common(threadflow_t *threadflow, flowop_t *flowop, int fd)
}
/*
+ * set the open flag for read only or read/write, as appropriate.
+ */
+ if (avd_get_bool(flowop->fo_fileset->fs_readonly) == TRUE)
+ openflag = O_RDONLY;
+ else
+ openflag = O_RDWR;
+
+ /*
* If the flowop doesn't default to persistent fd
* then get unique thread ID for use by fileset_pick
*/
@@ -1532,7 +1563,7 @@ flowoplib_openfile_common(threadflow_t *threadflow, flowop_t *flowop, int fd)
"open raw device %s flags %d = %d", name, open_attrs, fd);
if (FB_OPEN(&(threadflow->tf_fd[fd]), name,
- O_RDWR | open_attrs, 0666) == FILEBENCH_ERROR) {
+ openflag | open_attrs, 0666) == FILEBENCH_ERROR) {
filebench_log(LOG_ERROR,
"Failed to open raw device %s: %s",
name, strerror(errno));
@@ -1562,7 +1593,7 @@ flowoplib_openfile_common(threadflow_t *threadflow, flowop_t *flowop, int fd)
flowop_beginop(threadflow, flowop);
err = fileset_openfile(&threadflow->tf_fd[fd], flowop->fo_fileset,
- file, O_RDWR, 0666, flowoplib_fileattrs(flowop));
+ file, openflag, 0666, flowoplib_fileattrs(flowop));
flowop_endop(threadflow, flowop, 0);
if (err == FILEBENCH_ERROR) {
@@ -1609,6 +1640,13 @@ flowoplib_createfile(threadflow_t *threadflow, flowop_t *flowop)
return (FILEBENCH_ERROR);
}
+ if (avd_get_bool(flowop->fo_fileset->fs_readonly) == TRUE) {
+ filebench_log(LOG_ERROR, "Can not CREATE the READONLY file %s",
+ avd_get_str(flowop->fo_fileset->fs_name));
+ return (FILEBENCH_ERROR);
+ }
+
+
#ifdef HAVE_RAW_SUPPORT
/* can't be used with raw devices */
if (flowop->fo_fileset->fs_attrs & FILESET_IS_RAW_DEV) {
diff --git a/usr/src/cmd/filebench/common/ipc.h b/usr/src/cmd/filebench/common/ipc.h
index cc3372cf9c..1ed54a5fe2 100644
--- a/usr/src/cmd/filebench/common/ipc.h
+++ b/usr/src/cmd/filebench/common/ipc.h
@@ -80,6 +80,7 @@ extern "C" {
#define FILEBENCH_ABORT_ERROR 1
#define FILEBENCH_ABORT_DONE 2
#define FILEBENCH_ABORT_RSRC 3
+#define FILEBENCH_ABORT_FINI 4
#define FILEBENCH_MODE_TIMEOUT 0x0
#define FILEBENCH_MODE_Q1STDONE 0x1
diff --git a/usr/src/cmd/filebench/common/misc.c b/usr/src/cmd/filebench/common/misc.c
index 6f2eb4db2f..1b5c2868a4 100644
--- a/usr/src/cmd/filebench/common/misc.c
+++ b/usr/src/cmd/filebench/common/misc.c
@@ -336,7 +336,14 @@ filebench_shutdown(int error) {
if (error) {
filebench_log(LOG_DEBUG_IMPL, "Shutdown on error");
+ (void) ipc_mutex_lock(&filebench_shm->shm_procflow_lock);
+ if (filebench_shm->shm_f_abort == FILEBENCH_ABORT_FINI) {
+ (void) ipc_mutex_unlock(
+ &filebench_shm->shm_procflow_lock);
+ return;
+ }
filebench_shm->shm_f_abort = FILEBENCH_ABORT_ERROR;
+ (void) ipc_mutex_unlock(&filebench_shm->shm_procflow_lock);
} else {
filebench_log(LOG_DEBUG_IMPL, "Shutdown");
}
diff --git a/usr/src/cmd/filebench/common/parser_gram.y b/usr/src/cmd/filebench/common/parser_gram.y
index bfce53b9c8..a52f147d70 100644
--- a/usr/src/cmd/filebench/common/parser_gram.y
+++ b/usr/src/cmd/filebench/common/parser_gram.y
@@ -127,8 +127,6 @@ static void parser_filebench_shutdown(cmd_t *cmd);
/* Other Commands */
static void parser_foreach_integer(cmd_t *cmd);
static void parser_foreach_string(cmd_t *cmd);
-static void parser_sleep(cmd_t *cmd);
-static void parser_sleep_variable(cmd_t *cmd);
static void parser_log(cmd_t *cmd);
static void parser_statscmd(cmd_t *cmd);
static void parser_statsdump(cmd_t *cmd);
@@ -146,6 +144,10 @@ static void parser_enable_mc(cmd_t *cmd);
static void parser_domultisync(cmd_t *cmd);
static void parser_run(cmd_t *cmd);
static void parser_run_variable(cmd_t *cmd);
+static void parser_sleep(cmd_t *cmd);
+static void parser_sleep_variable(cmd_t *cmd);
+static void parser_warmup(cmd_t *cmd);
+static void parser_warmup_variable(cmd_t *cmd);
static void parser_help(cmd_t *cmd);
static void arg_parse(const char *command);
static void parser_abort(int arg);
@@ -170,6 +172,7 @@ static void parser_version(cmd_t *cmd);
%token FSC_LIST FSC_DEFINE FSC_EXEC FSC_QUIT FSC_DEBUG FSC_CREATE
%token FSC_SLEEP FSC_STATS FSC_FOREACH FSC_SET FSC_SHUTDOWN FSC_LOG
%token FSC_SYSTEM FSC_FLOWOP FSC_EVENTGEN FSC_ECHO FSC_LOAD FSC_RUN
+%token FSC_WARMUP
%token FSC_USAGE FSC_HELP FSC_VARS FSC_VERSION FSC_ENABLE FSC_DOMULTISYNC
%token FSV_STRING FSV_VAL_INT FSV_VAL_BOOLEAN FSV_VARIABLE FSV_WHITESTRING
%token FSV_RANDUNI FSV_RANDTAB FSV_RANDVAR FSV_URAND FSV_RAND48
@@ -180,7 +183,7 @@ static void parser_version(cmd_t *cmd);
%token FSK_SEPLST FSK_OPENLST FSK_CLOSELST FSK_ASSIGN FSK_IN FSK_QUOTE
%token FSK_DIRSEPLST
%token FSA_SIZE FSA_PREALLOC FSA_PARALLOC FSA_PATH FSA_REUSE
-%token FSA_PROCESS FSA_MEMSIZE FSA_RATE FSA_CACHED
+%token FSA_PROCESS FSA_MEMSIZE FSA_RATE FSA_CACHED FSA_READONLY FSA_TRUSTTREE
%token FSA_IOSIZE FSA_FILE FSA_WSS FSA_NAME FSA_RANDOM FSA_INSTANCES
%token FSA_DSYNC FSA_TARGET FSA_ITERS FSA_NICE FSA_VALUE FSA_BLOCKING
%token FSA_HIGHWATER FSA_DIRECTIO FSA_DIRWIDTH FSA_FD FSA_SRCFD FSA_ROTATEFD
@@ -217,7 +220,7 @@ static void parser_version(cmd_t *cmd);
%type <cmd> foreach_command log_command system_command flowop_command
%type <cmd> eventgen_command quit_command flowop_list thread_list
%type <cmd> thread echo_command usage_command help_command vars_command
-%type <cmd> version_command enable_command multisync_command
+%type <cmd> version_command enable_command multisync_command warmup_command
%type <attr> files_attr_op files_attr_ops pt_attr_op pt_attr_ops
%type <attr> fo_attr_op fo_attr_ops ev_attr_op ev_attr_ops
@@ -298,6 +301,7 @@ command:
| set_command
| shutdown_command
| sleep_command
+| warmup_command
| stats_command
| system_command
| version_command
@@ -1054,6 +1058,23 @@ shutdown_command: FSC_SHUTDOWN entity
};
+warmup_command: FSC_WARMUP FSV_VAL_INT
+{
+ if (($$ = alloc_cmd()) == NULL)
+ YYERROR;
+ $$->cmd = parser_warmup;
+ $$->cmd_qty = $2;
+}
+| FSC_WARMUP FSV_VARIABLE
+{
+ fbint_t *integer;
+
+ if (($$ = alloc_cmd()) == NULL)
+ YYERROR;
+ $$->cmd = parser_warmup_variable;
+ $$->cmd_tgt1 = fb_stralloc($2);
+};
+
sleep_command: FSC_SLEEP FSV_VAL_INT
{
if (($$ = alloc_cmd()) == NULL)
@@ -1401,13 +1422,13 @@ enable_multi_op: em_attr_name FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
-}
+};
multisync_op: FSA_VALUE FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = FSA_VALUE;
-}
+};
files_attr_name: attrs_define_file
|attrs_define_fileset;
@@ -1428,6 +1449,8 @@ attrs_define_file:
FSA_SIZE { $$ = FSA_SIZE;}
| FSA_NAME { $$ = FSA_NAME;}
| FSA_PATH { $$ = FSA_PATH;}
+| FSA_READONLY { $$ = FSA_READONLY;}
+| FSA_TRUSTTREE { $$ = FSA_TRUSTTREE;}
| FSA_REUSE { $$ = FSA_REUSE;}
| FSA_PREALLOC { $$ = FSA_PREALLOC;}
| FSA_PARALLOC { $$ = FSA_PARALLOC;};
@@ -1441,10 +1464,12 @@ attrs_define_fileset:
| FSA_PREALLOC { $$ = FSA_PREALLOC;}
| FSA_PARALLOC { $$ = FSA_PARALLOC;}
| FSA_REUSE { $$ = FSA_REUSE;}
+| FSA_READONLY { $$ = FSA_READONLY;}
+| FSA_TRUSTTREE { $$ = FSA_TRUSTTREE;}
| FSA_FILESIZEGAMMA { $$ = FSA_FILESIZEGAMMA;}
| FSA_DIRGAMMA { $$ = FSA_DIRGAMMA;}
| FSA_CACHED { $$ = FSA_CACHED;}
-| FSA_ENTRIES { $$ = FSA_ENTRIES;};
+| FSA_ENTRIES { $$ = FSA_ENTRIES;}
| FSA_LEAFDIRS { $$ = FSA_LEAFDIRS;};
randvar_attr_name:
@@ -1524,7 +1549,7 @@ attrs_eventgen:
FSA_RATE { $$ = FSA_RATE;};
em_attr_name:
- FSA_MASTER { $$ = FSA_MASTER;};
+ FSA_MASTER { $$ = FSA_MASTER;}
| FSA_CLIENT { $$ = FSA_CLIENT;};
comp_attr_ops: comp_attr_op
@@ -2267,6 +2292,9 @@ parser_flowop_get_attrs(cmd_t *cmd, flowop_t *flowop)
"define flowop: no filename specfied");
filebench_shutdown(1);
}
+ } else {
+ /* no filename attribute specified */
+ flowop->fo_filename = NULL;
}
/* Get the iosize of the op */
@@ -2305,8 +2333,13 @@ parser_flowop_get_attrs(cmd_t *cmd, flowop_t *flowop)
flowop->fo_value = avd_int_alloc(0);
/* FD */
- if (attr = get_attr_integer(cmd, FSA_FD))
+ if (attr = get_attr_integer(cmd, FSA_FD)) {
flowop->fo_fdnumber = avd_get_int(attr->attr_avd);
+ if (flowop->fo_filename != NULL)
+ filebench_log(LOG_DEBUG_SCRIPT, "It is not "
+ "advisable to supply both an fd number "
+ "and a fileset name in most cases");
+ }
/* Rotatefd? */
if (attr = get_attr_bool(cmd, FSA_ROTATEFD))
@@ -2668,12 +2701,24 @@ parser_fileset_define_common(cmd_t *cmd)
else
fileset->fs_paralloc = avd_bool_alloc(FALSE);
+ /* Should we allow writes to the file? */
+ if (attr = get_attr_bool(cmd, FSA_READONLY))
+ fileset->fs_readonly = attr->attr_avd;
+ else
+ fileset->fs_readonly = avd_bool_alloc(FALSE);
+
/* Should we reuse the existing file? */
if (attr = get_attr_bool(cmd, FSA_REUSE))
fileset->fs_reuse = attr->attr_avd;
else
fileset->fs_reuse = avd_bool_alloc(FALSE);
+ /* Should we check for files actual existance? */
+ if (attr = get_attr_bool(cmd, FSA_TRUSTTREE))
+ fileset->fs_trust_tree = attr->attr_avd;
+ else
+ fileset->fs_trust_tree = avd_bool_alloc(FALSE);
+
/* Should we leave in cache? */
if (attr = get_attr_bool(cmd, FSA_CACHED))
fileset->fs_cached = attr->attr_avd;
@@ -2818,6 +2863,8 @@ static void
parser_proc_create(cmd_t *cmd)
{
filebench_shm->shm_1st_err = 0;
+ filebench_shm->shm_f_abort = FILEBENCH_OK;
+
if (procflow_init() != 0) {
filebench_log(LOG_ERROR, "Failed to create processes\n");
filebench_shutdown(1);
@@ -2910,7 +2957,7 @@ parser_filebench_shutdown(cmd_t *cmd)
* is raised. If given a time of zero or less, or the mode is stop on
* lack of resources, it will pause until f_abort is raised.
*/
-static void
+static int
parser_pause(int ptime)
{
int timeslept = 0;
@@ -2933,8 +2980,7 @@ parser_pause(int ptime)
break;
}
}
-
- filebench_log(LOG_INFO, "Run took %d seconds...", timeslept);
+ return (timeslept);
}
/*
@@ -2948,6 +2994,7 @@ static void
parser_run(cmd_t *cmd)
{
int runtime;
+ int timeslept;
runtime = cmd->cmd_qty;
@@ -2961,8 +3008,9 @@ parser_run(cmd_t *cmd)
filebench_log(LOG_INFO, "Running...");
stats_clear();
- parser_pause(runtime);
+ timeslept = parser_pause(runtime);
+ filebench_log(LOG_INFO, "Run took %d seconds...", timeslept);
parser_statssnap(cmd);
parser_proc_shutdown(cmd);
}
@@ -2976,6 +3024,7 @@ parser_run_variable(cmd_t *cmd)
{
avd_t integer = var_ref_attr(cmd->cmd_tgt1);
int runtime;
+ int timeslept;
if (integer == NULL) {
filebench_log(LOG_ERROR, "Unknown variable %s",
@@ -2992,8 +3041,9 @@ parser_run_variable(cmd_t *cmd)
filebench_log(LOG_INFO, "Running...");
stats_clear();
- parser_pause(runtime);
+ timeslept = parser_pause(runtime);
+ filebench_log(LOG_INFO, "Run took %d seconds...", timeslept);
parser_statssnap(cmd);
parser_proc_shutdown(cmd);
}
@@ -3117,10 +3167,32 @@ parser_vars(cmd_t *cmd)
}
/*
+ * used by the set command to set the integer part of a regular
+ * variable, or the appropriate field of a random variable
+ */
+static void
+parser_set_integer(char *name, fbint_t integer)
+{
+ var_assign_integer(name, integer);
+}
+
+/*
+ * used by the set command to set the integer part of a regular
+ * variable from another variable, or the appropriate field of a
+ * random variable from another variable
+ */
+static void
+parser_set_var(char *dst_name, char *src_name)
+{
+ var_assign_var(dst_name, src_name);
+}
+
+
+/*
* Sleeps for cmd->cmd_qty seconds, one second at a time.
*/
static void
-parser_sleep(cmd_t *cmd)
+parser_warmup(cmd_t *cmd)
{
int sleeptime;
@@ -3129,32 +3201,58 @@ parser_sleep(cmd_t *cmd)
return;
sleeptime = cmd->cmd_qty;
- filebench_log(LOG_INFO, "Running...");
+ filebench_log(LOG_INFO, "Warming up...");
- parser_pause(sleeptime);
+ (void) parser_pause(sleeptime);
}
/*
- * used by the set command to set the integer part of a regular
- * variable, or the appropriate field of a random variable
+ * Same as parser_sleep, except the sleep time is obtained from a variable
+ * whose name is passed to it as an argument on the command line.
*/
static void
-parser_set_integer(char *name, fbint_t integer)
+parser_warmup_variable(cmd_t *cmd)
{
- var_assign_integer(name, integer);
+ avd_t integer = var_ref_attr(cmd->cmd_tgt1);
+ int sleeptime;
+
+ if (integer == NULL) {
+ filebench_log(LOG_ERROR, "Unknown variable %s",
+ cmd->cmd_tgt1);
+ return;
+ }
+
+ sleeptime = avd_get_int(integer);
+
+ /* check for startup errors */
+ if (filebench_shm->shm_f_abort)
+ return;
+
+ filebench_log(LOG_INFO, "Warming up...");
+
+ (void) parser_pause(sleeptime);
}
/*
- * used by the set command to set the integer part of a regular
- * variable from another variable, or the appropriate field of a
- * random variable from another variable
+ * Sleeps for cmd->cmd_qty seconds, one second at a time.
*/
static void
-parser_set_var(char *dst_name, char *src_name)
+parser_sleep(cmd_t *cmd)
{
- var_assign_var(dst_name, src_name);
-}
+ int sleeptime;
+ int timeslept;
+ /* check for startup errors */
+ if (filebench_shm->shm_f_abort)
+ return;
+
+ sleeptime = cmd->cmd_qty;
+ filebench_log(LOG_INFO, "Running...");
+
+ timeslept = parser_pause(sleeptime);
+
+ filebench_log(LOG_INFO, "Run took %d seconds...", timeslept);
+}
/*
* Same as parser_sleep, except the sleep time is obtained from a variable
@@ -3165,6 +3263,7 @@ parser_sleep_variable(cmd_t *cmd)
{
avd_t integer = var_ref_attr(cmd->cmd_tgt1);
int sleeptime;
+ int timeslept;
if (integer == NULL) {
filebench_log(LOG_ERROR, "Unknown variable %s",
@@ -3180,7 +3279,9 @@ parser_sleep_variable(cmd_t *cmd)
filebench_log(LOG_INFO, "Running...");
- parser_pause(sleeptime);
+ timeslept = parser_pause(sleeptime);
+
+ filebench_log(LOG_INFO, "Run took %d seconds...", timeslept);
}
/*
diff --git a/usr/src/cmd/filebench/common/parser_lex.l b/usr/src/cmd/filebench/common/parser_lex.l
index 7e22c7895b..cbefc28ca1 100644
--- a/usr/src/cmd/filebench/common/parser_lex.l
+++ b/usr/src/cmd/filebench/common/parser_lex.l
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Portions Copyright 2008 Denis Cheng
@@ -85,6 +85,7 @@ system { return FSC_SYSTEM; }
usage { return FSC_USAGE; }
vars { return FSC_VARS; }
version { return FSC_VERSION; }
+warmup { return FSC_WARMUP; }
quit { return FSC_QUIT; }
file[s]* { return FSE_FILE; }
@@ -103,56 +104,59 @@ all { return FSE_ALL; }
mode { return FSE_MODE; }
multi { return FSE_MULTI; }
+alldone { return FSA_ALLDONE; }
+blocking { return FSA_BLOCKING; }
cached { return FSA_CACHED; }
+client { return FSA_CLIENT; }
dirwidth { return FSA_DIRWIDTH; }
dirdepthrv { return FSA_DIRDEPTHRV; }
-dirgamma { return FSA_DIRGAMMA; }
-filesize { return FSA_SIZE; }
-filesizegamma { return FSA_FILESIZEGAMMA; }
directio { return FSA_DIRECTIO; }
+dirgamma { return FSA_DIRGAMMA; }
dsync { return FSA_DSYNC; }
+entries { return FSA_ENTRIES;}
fd { return FSA_FD; }
-srcfd { return FSA_SRCFD; }
-opennext { return FSA_ROTATEFD; }
filename { return FSA_FILE; }
filesetname { return FSA_FILE; }
+filesize { return FSA_SIZE; }
+filesizegamma { return FSA_FILESIZEGAMMA; }
+firstdone { return FSA_FIRSTDONE; }
+gamma { return FSA_RANDGAMMA; }
+highwater { return FSA_HIGHWATER; }
+indexed { return FSA_INDEXED; }
instances { return FSA_INSTANCES;}
iosize { return FSA_IOSIZE; }
-indexed { return FSA_INDEXED; }
iters { return FSA_ITERS;}
+leafdirs { return FSA_LEAFDIRS;}
master { return FSA_MASTER; }
-client { return FSA_CLIENT; }
+mean { return FSA_RANDMEAN; }
memsize { return FSA_MEMSIZE; }
+min { return FSA_RANDMIN; }
name { return FSA_NAME;}
namelength { return FSA_NAMELENGTH; }
nice { return FSA_NICE;}
-entries { return FSA_ENTRIES;}
-leafdirs { return FSA_LEAFDIRS;}
-prealloc { return FSA_PREALLOC; }
+opennext { return FSA_ROTATEFD; }
paralloc { return FSA_PARALLOC; }
-reuse { return FSA_REUSE; }
path { return FSA_PATH; }
+prealloc { return FSA_PREALLOC; }
procname { return FSA_PROCESS; }
random { return FSA_RANDOM;}
+randsrc { return FSA_RANDSRC; }
+randtable { return FSA_RANDTABLE; }
rate { return FSA_RATE;}
+readonly { return FSA_READONLY; }
+reuse { return FSA_REUSE; }
+round { return FSA_RANDROUND; }
+seed { return FSA_RANDSEED; }
size { return FSA_SIZE; }
+srcfd { return FSA_SRCFD; }
target { return FSA_TARGET;}
+timeout { return FSA_TIMEOUT; }
+trusttree { return FSA_TRUSTTREE; }
+type { return FSA_TYPE; }
useism { return FSA_USEISM;}
value { return FSA_VALUE;}
workingset { return FSA_WSS; }
-blocking { return FSA_BLOCKING; }
-highwater { return FSA_HIGHWATER; }
-alldone { return FSA_ALLDONE; }
-firstdone { return FSA_FIRSTDONE; }
-timeout { return FSA_TIMEOUT; }
-type { return FSA_TYPE; }
-seed { return FSA_RANDSEED; }
-gamma { return FSA_RANDGAMMA; }
-mean { return FSA_RANDMEAN; }
-min { return FSA_RANDMIN; }
-round { return FSA_RANDROUND; }
-randsrc { return FSA_RANDSRC; }
-randtable { return FSA_RANDTABLE; }
+
uniform { return FSV_RANDUNI; }
tabular { return FSV_RANDTAB; }
"."type { return FSS_TYPE; }
diff --git a/usr/src/cmd/filebench/common/procflow.c b/usr/src/cmd/filebench/common/procflow.c
index 2a5207ca10..654329b5ee 100644
--- a/usr/src/cmd/filebench/common/procflow.c
+++ b/usr/src/cmd/filebench/common/procflow.c
@@ -370,10 +370,11 @@ procflow_createnwait(void *nothing)
(void) ipc_mutex_lock(&filebench_shm->shm_procflow_lock);
/* if normal shutdown in progress, just quit */
- if (filebench_shm->shm_f_abort)
+ if (filebench_shm->shm_f_abort) {
(void) ipc_mutex_unlock(
&filebench_shm->shm_procflow_lock);
pthread_exit(0);
+ }
/* if nothing running, exit */
if (filebench_shm->shm_procs_running == 0) {
@@ -440,13 +441,17 @@ procflow_init(void)
pthread_t tid;
int ret = 0;
+ if (procflow == NULL) {
+ filebench_log(LOG_ERROR, "Workload has no processes");
+ return (FILEBENCH_ERROR);
+ }
+
filebench_log(LOG_DEBUG_IMPL,
"procflow_init %s, %llu",
procflow->pf_name,
(u_longlong_t)avd_get_int(procflow->pf_instances));
#ifdef USE_PROCESS_MODEL
-
if ((pthread_create(&tid, NULL, procflow_createnwait, NULL)) != 0)
return (ret);
@@ -644,8 +649,15 @@ procflow_shutdown(void)
(void) ipc_mutex_unlock(&filebench_shm->shm_procs_running_lock);
(void) ipc_mutex_lock(&filebench_shm->shm_procflow_lock);
+ if (filebench_shm->shm_f_abort == FILEBENCH_ABORT_FINI) {
+ (void) ipc_mutex_unlock(
+ &filebench_shm->shm_procflow_lock);
+ return;
+ }
+
procflow = filebench_shm->shm_proclist;
- filebench_shm->shm_f_abort = 1;
+ if (filebench_shm->shm_f_abort == FILEBENCH_OK)
+ filebench_shm->shm_f_abort = FILEBENCH_ABORT_DONE;
while (procflow) {
if (procflow->pf_instance &&
@@ -687,8 +699,7 @@ procflow_shutdown(void)
wait_cnt--;
}
- filebench_shm->shm_f_abort = 0;
-
+ filebench_shm->shm_f_abort = FILEBENCH_ABORT_FINI;
(void) ipc_mutex_unlock(&filebench_shm->shm_procflow_lock);
/* indicate all processes are stopped, even if some are "stuck" */
diff --git a/usr/src/cmd/filebench/config/generic.func b/usr/src/cmd/filebench/config/generic.func
index 4bc82c9a0e..208ce0c775 100644
--- a/usr/src/cmd/filebench/config/generic.func
+++ b/usr/src/cmd/filebench/config/generic.func
@@ -19,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -50,6 +50,11 @@ sub post_run {
sub bm_run {
my $runtime = conf_reqval("runtime");
my $fs = get_CONFNAME();
+ my $warmuptime = "";
+
+ if (conf_exists("warmuptime") == 1) {
+ $warmuptime = conf_reqval("warmuptime");
+ }
# The following array must not contain empty values ! This causes the
# statistics scripts to miss arguments !
@@ -61,7 +66,7 @@ sub bm_run {
# <stats>/<hostname>-<date-time>/<personality>
# create processes and start run, then collect statistics
- op_stats($runtime,"stats.$fs",@ext_stats,@file_stats,@arg_stats);
+ op_stats($runtime,$warmuptime,"stats.$fs",@ext_stats,@file_stats,@arg_stats);
}
1;
diff --git a/usr/src/cmd/filebench/config/newfeatures.prof b/usr/src/cmd/filebench/config/newfeatures.prof
index 6040fc92db..ac93b37b1d 100644
--- a/usr/src/cmd/filebench/config/newfeatures.prof
+++ b/usr/src/cmd/filebench/config/newfeatures.prof
@@ -73,14 +73,17 @@ CONFIG video_server_test {
repintval = 20;
passvidsname = bigfileset;
actvidsname = u2fileset;
+ warmuptime = 120;
}
CONFIG file_indexing_test {
function = generic;
personality = randomfileaccess;
+ warmuptime = 120;
}
CONFIG composite_flowop_test {
function = generic;
personality = compflow_demo;
+ warmuptime = 120;
}
diff --git a/usr/src/cmd/filebench/fbscript/filebench.pl b/usr/src/cmd/filebench/fbscript/filebench.pl
index 20e71774c3..228774e162 100755
--- a/usr/src/cmd/filebench/fbscript/filebench.pl
+++ b/usr/src/cmd/filebench/fbscript/filebench.pl
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -233,6 +233,7 @@ sub op_indiv_stats {
sub op_stats {
my ($time) = shift;
+ my ($warmup) = shift;
my ($statsfile) = shift;
my $mstrstatsdir = $STATSBASE."/".$CONFNAME;
@@ -243,6 +244,10 @@ sub op_stats {
# Create the associated processes and start them running
print FSCRIPT "create processes\n";
+ if ($warmup ne '') {
+ print FSCRIPT "warmup $warmup\n";
+ }
+
if (($time ne '') && ($statsfile ne '')) {
# Clear the current statistics buffers
print FSCRIPT "stats clear\n";
diff --git a/usr/src/cmd/filebench/workloads/bringover.f b/usr/src/cmd/filebench/workloads/bringover.f
index 6e1aaff7c2..b575ed9870 100644
--- a/usr/src/cmd/filebench/workloads/bringover.f
+++ b/usr/src/cmd/filebench/workloads/bringover.f
@@ -19,11 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-
set $dir=/tmp
set $nfiles=1000
@@ -44,13 +41,13 @@ define process name=filereader,instances=1
flowop openfile name=openfile1,filesetname=srcfiles,fd=1
flowop readwholefile name=readfile1,fd=1,iosize=$iosize
flowop createfile name=createfile2,filesetname=destfiles,fd=2
- flowop writewholefile name=writefile2,filesetname=destfiles,fd=2,srcfd=1,iosize=$iosize
+ flowop writewholefile name=writefile2,fd=2,srcfd=1,iosize=$iosize
flowop closefile name=closefile1,fd=1
flowop closefile name=closefile2,fd=2
}
}
-echo "Bringover Version 2.4 personality successfully loaded"
+echo "Bringover Version 2.5 personality successfully loaded"
usage "Usage: set \$dir=<dir> defaults to $dir"
usage " set \$filesize=<size> defaults to $filesize"
usage " set \$nfiles=<value> defaults to $nfiles"
diff --git a/usr/src/cmd/filebench/workloads/copyfiles.f b/usr/src/cmd/filebench/workloads/copyfiles.f
index fa77ddd3f6..732684a7ab 100644
--- a/usr/src/cmd/filebench/workloads/copyfiles.f
+++ b/usr/src/cmd/filebench/workloads/copyfiles.f
@@ -19,10 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
set $dir=/tmp
set $nfiles=1000
@@ -43,13 +41,13 @@ define process name=filereader,instances=1
flowop openfile name=openfile1,filesetname=bigfileset,fd=1
flowop readwholefile name=readfile1,fd=1,iosize=$iosize
flowop createfile name=createfile2,filesetname=destfiles,fd=2
- flowop writewholefile name=writefile2,filesetname=destfiles,fd=2,srcfd=1,iosize=$iosize
+ flowop writewholefile name=writefile2,fd=2,srcfd=1,iosize=$iosize
flowop closefile name=closefile1,fd=1
flowop closefile name=closefile2,fd=2
}
}
-echo "CopyFiles Version 2.4 personality successfully loaded"
+echo "CopyFiles Version 2.5 personality successfully loaded"
usage "Usage: set \$dir=<dir> defaults to $dir"
usage " set \$filesize=<size> defaults to $filesize"
usage " set \$nfiles=<value> defaults to $nfiles"
diff --git a/usr/src/cmd/filebench/workloads/createfiles.f b/usr/src/cmd/filebench/workloads/createfiles.f
index 5905f6308e..a61fc30fe5 100644
--- a/usr/src/cmd/filebench/workloads/createfiles.f
+++ b/usr/src/cmd/filebench/workloads/createfiles.f
@@ -19,10 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
set $dir=/tmp
set $nfiles=50000
@@ -40,13 +38,13 @@ define process name=filecreate,instances=1
thread name=filecreatethread,memsize=10m,instances=$nthreads
{
flowop createfile name=createfile1,filesetname=bigfileset,fd=1
- flowop writewholefile name=writefile1,filesetname=bigfileset,fd=1,iosize=$iosize
+ flowop writewholefile name=writefile1,fd=1,iosize=$iosize
flowop closefile name=closefile1,fd=1
flowop opslimit name=limit
}
}
-echo "Createfiles Version 2.4 personality successfully loaded"
+echo "Createfiles Version 2.5 personality successfully loaded"
usage "Usage: set \$dir=<dir> defaults to $dir"
usage " set \$filesize=<size> defaults to $filesize"
usage " set \$iosize=<size> defaults to $iosize"
diff --git a/usr/src/cmd/filebench/workloads/filemicro_seqwriterand.f b/usr/src/cmd/filebench/workloads/filemicro_seqwriterand.f
index 51327affcd..e38fcf2bf8 100644
--- a/usr/src/cmd/filebench/workloads/filemicro_seqwriterand.f
+++ b/usr/src/cmd/filebench/workloads/filemicro_seqwriterand.f
@@ -19,10 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
# Single threaded appends/writes (I/Os of random size in the range
# of [1B - 8KB]) to a 1GB file.
@@ -41,13 +39,14 @@ define process name=filewriter,instances=1
{
thread name=filewriterthread,memsize=10m,instances=$nthreads
{
- flowop appendfilerand name=appendrand-file,dsync=$sync,filename=bigfile,iosize=$iosize,fd=1,iters=$count
+ flowop openfile name=open-file,filename=bigfile,fd=1
+ flowop appendfilerand name=appendrand-file,dsync=$sync,iosize=$iosize,fd=1,iters=$count
flowop closefile name=close,fd=1
flowop finishoncount name=finish,value=1
}
}
-echo "FileMicro-SeqWriteRand Version 2.1 personality successfully loaded"
+echo "FileMicro-SeqWriteRand Version 2.2 personality successfully loaded"
usage "Usage: set \$dir=<dir>"
usage " set \$cached=<bool> defaults to $cached"
usage " set \$count=<bool> defaults to $count"
diff --git a/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvargam.f b/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvargam.f
index f863021068..e63bd1b636 100644
--- a/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvargam.f
+++ b/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvargam.f
@@ -19,10 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
# Sequential write() of a 1G file, size picked from a gamma distribution
# min of 1k and a mean of 5.5K, followed by close(), cached.
@@ -43,13 +41,14 @@ define process name=filewriter,instances=1
{
thread name=filewriterthread,memsize=10m,instances=$nthreads
{
- flowop appendfile name=write-file,dsync=$sync,filesetname=bigfileset,iosize=$iosize,fd=1,iters=$count
+ flowop openfile name=open-file,filesetname=bigfileset,fd=1
+ flowop appendfile name=write-file,dsync=$sync,iosize=$iosize,fd=1,iters=$count
flowop closefile name=close,fd=1
flowop finishoncount name=finish,value=1
}
}
-echo "FileMicro-SeqWriteRandVarGam Version 1.0 personality successfully loaded"
+echo "FileMicro-SeqWriteRandVarGam Version 1.1 personality successfully loaded"
usage "Usage: set \$dir=<dir>"
usage " set \$cached=<bool> defaults to $cached"
usage " set \$count=<value> defaults to $count"
diff --git a/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvartab.f b/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvartab.f
index e01618e0ab..ddbaa67cf9 100644
--- a/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvartab.f
+++ b/usr/src/cmd/filebench/workloads/filemicro_seqwriterandvartab.f
@@ -19,10 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
# Sequential write() of a 1G file, size picked from a table in
# the [1K,64K] range with a mean of 5.5K, followed by close(), cached.
@@ -46,13 +44,14 @@ define process name=filewriter,instances=1
{
thread name=filewriterthread,memsize=10m,instances=$nthreads
{
- flowop appendfile name=write-file,dsync=$sync,filesetname=bigfileset,iosize=$iosize,fd=1,iters=$count
+ flowop openfile name=open-file,filesetname=bigfileset,fd=1
+ flowop appendfile name=write-file,dsync=$sync,iosize=$iosize,fd=1,iters=$count
flowop closefile name=close,fd=1
flowop finishoncount name=finish,value=1
}
}
-echo "FileMicro-SeqWriteRandVarTab Version 1.0 personality successfully loaded"
+echo "FileMicro-SeqWriteRandVarTab Version 1.1 personality successfully loaded"
usage "Usage: set \$dir=<dir>"
usage " set \$cached=<bool> defaults to $cached"
usage " set \$count=<value> defaults to $count"