summaryrefslogtreecommitdiff
path: root/usr/src/cmd/filebench/common
diff options
context:
space:
mode:
authorek110237 <none@none>2008-05-12 13:15:37 -0700
committerek110237 <none@none>2008-05-12 13:15:37 -0700
commit718ea316b79115f814af49cb880a75c9e74124e1 (patch)
tree4c5ebc358aecc69182d6362b8952e6b267cbfddf /usr/src/cmd/filebench/common
parentb21718f06a7f8468913c84002f8381a5ee1cb8c4 (diff)
downloadillumos-gate-718ea316b79115f814af49cb880a75c9e74124e1.tar.gz
6698910 filebench should build on gentoo (linux)
Contributed by Denis Cheng 6699435 filebench should be buildable on OSX 6699618 some mutexes in filebench aren't being init'd 6694960 go_filebench -h is outdated 6699410 oltp.f's dbwr threads should do dsync writes
Diffstat (limited to 'usr/src/cmd/filebench/common')
-rw-r--r--usr/src/cmd/filebench/common/auto_comp.c5
-rw-r--r--usr/src/cmd/filebench/common/config.h4
-rw-r--r--usr/src/cmd/filebench/common/eventgen.c5
-rw-r--r--usr/src/cmd/filebench/common/filebench.h16
-rw-r--r--usr/src/cmd/filebench/common/fileset.c18
-rw-r--r--usr/src/cmd/filebench/common/flowop.c1
-rw-r--r--usr/src/cmd/filebench/common/flowop_library.c5
-rw-r--r--usr/src/cmd/filebench/common/misc.h2
-rw-r--r--usr/src/cmd/filebench/common/parser_gram.y14
-rw-r--r--usr/src/cmd/filebench/common/parser_lex.l6
-rw-r--r--usr/src/cmd/filebench/common/parsertypes.h2
-rw-r--r--usr/src/cmd/filebench/common/procflow.c6
-rw-r--r--usr/src/cmd/filebench/common/stats.c2
-rw-r--r--usr/src/cmd/filebench/common/threadflow.c8
-rw-r--r--usr/src/cmd/filebench/common/utils.c6
-rw-r--r--usr/src/cmd/filebench/common/vars.c4
16 files changed, 71 insertions, 33 deletions
diff --git a/usr/src/cmd/filebench/common/auto_comp.c b/usr/src/cmd/filebench/common/auto_comp.c
index 81a5d24a98..02141bfae2 100644
--- a/usr/src/cmd/filebench/common/auto_comp.c
+++ b/usr/src/cmd/filebench/common/auto_comp.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <dirent.h>
#include <strings.h>
+
#include "filebench.h"
#include "auto_comp.h"
@@ -46,10 +47,6 @@
#define VAR_ASSIGN_OP '='
#define VAR_PREFIX '$'
-#ifndef HAVE_BOOLEAN_T
-typedef enum { B_FALSE, B_TRUE } boolean_t;
-#endif
-
typedef char ac_fname_t[FILENAME_MAXLEN];
typedef struct ac_fname_cache {
diff --git a/usr/src/cmd/filebench/common/config.h b/usr/src/cmd/filebench/common/config.h
index e60519347a..5423d160e4 100644
--- a/usr/src/cmd/filebench/common/config.h
+++ b/usr/src/cmd/filebench/common/config.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -61,8 +61,10 @@ extern "C" {
#define HAVE_UINT64_MAX 1
#define HAVE_UINT_T 1
#define HAVE_BOOLEAN_T 1
+#define HAVE_U_LONGLONG_T 1
#define HAVE_LIBTECLA 1
#define HAVE_RAW_SUPPORT 1
+#define HAVE_FTRUNCATE64 1
#define USE_PROCESS_MODEL 1
/* Define to 1 if you have the <libaio.h> header file. */
diff --git a/usr/src/cmd/filebench/common/eventgen.c b/usr/src/cmd/filebench/common/eventgen.c
index f8e4dc7b66..5080004ba3 100644
--- a/usr/src/cmd/filebench/common/eventgen.c
+++ b/usr/src/cmd/filebench/common/eventgen.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -40,9 +42,10 @@
*/
#include <sys/time.h>
+
+#include "filebench.h"
#include "vars.h"
#include "eventgen.h"
-#include "filebench.h"
#include "flowop.h"
#include "ipc.h"
diff --git a/usr/src/cmd/filebench/common/filebench.h b/usr/src/cmd/filebench/common/filebench.h
index 80e0d4156e..f6c3e63b34 100644
--- a/usr/src/cmd/filebench/common/filebench.h
+++ b/usr/src/cmd/filebench/common/filebench.h
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#ifndef _FB_FILEBENCH_H
@@ -32,10 +34,18 @@
#include <stdio.h>
#include <string.h>
+#include <errno.h>
+
+#ifndef HAVE_BOOLEAN_T
+typedef enum { B_FALSE, B_TRUE } boolean_t;
+#endif
+
+#ifndef HAVE_U_LONGLONG_T
+typedef unsigned long long u_longlong_t;
+#endif
-#include "vars.h"
+#include "procflow.h"
#include "misc.h"
-#include "flowop.h"
#include "ipc.h"
#ifdef HAVE_STDINT_H
@@ -109,7 +119,7 @@ void filebench_shutdown(int error);
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
-#define FILEBENCH_VERSION "1.3.0"
+#define FILEBENCH_VERSION "1.3.1"
#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 284aef19ec..57d97ad2e6 100644
--- a/usr/src/cmd/filebench/common/fileset.c
+++ b/usr/src/cmd/filebench/common/fileset.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -32,8 +34,9 @@
#include <math.h>
#include <libgen.h>
#include <sys/mman.h>
-#include "fileset.h"
+
#include "filebench.h"
+#include "fileset.h"
#include "gamma_dist.h"
/*
@@ -303,8 +306,11 @@ fileset_alloc_file(filesetentry_t *entry)
filebench_log(LOG_INFO,
"Truncating & re-using file %s", path);
- (void) ftruncate64(fd,
- (off64_t)entry->fse_size);
+#ifdef HAVE_FTRUNCATE64
+ (void) ftruncate64(fd, (off64_t)entry->fse_size);
+#else
+ (void) ftruncate(fd, (off_t)entry->fse_size);
+#endif
if (!avd_get_bool(entry->fse_fileset->fs_cached))
(void) fileset_freemem(fd,
@@ -630,10 +636,8 @@ fileset_create(fileset_t *fileset)
} else {
/* we are re-using */
reusing = 1;
- filebench_log(LOG_VERBOSE,
- "Re-using %s %s on %s file system.",
- fileset_entity_name(fileset),
- fileset_name, sb.st_fstype);
+ filebench_log(LOG_VERBOSE, "Re-using %s %s.",
+ fileset_entity_name(fileset), fileset_name);
}
}
(void) mkdir(path, 0755);
diff --git a/usr/src/cmd/filebench/common/flowop.c b/usr/src/cmd/filebench/common/flowop.c
index 5ba66529cb..4aa46166c3 100644
--- a/usr/src/cmd/filebench/common/flowop.c
+++ b/usr/src/cmd/filebench/common/flowop.c
@@ -584,6 +584,7 @@ flowop_start(threadflow_t *threadflow)
void
flowop_init(void)
{
+ (void) pthread_mutex_init(&controlstats_lock, ipc_mutexattr());
flowoplib_init();
}
diff --git a/usr/src/cmd/filebench/common/flowop_library.c b/usr/src/cmd/filebench/common/flowop_library.c
index 9a2bb8c192..d884e48b24 100644
--- a/usr/src/cmd/filebench/common/flowop_library.c
+++ b/usr/src/cmd/filebench/common/flowop_library.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -789,8 +791,7 @@ flowoplib_aiowait(threadflow_t *threadflow, flowop_t *flowop)
for (ncompleted = 0, inprogress = 0,
aio = flowop->fo_thread->tf_aiolist;
ncompleted < todo, aio != NULL; aio = aio->al_next) {
-
- result = aio_error64(&aio->al_aiocb);
+ int result = aio_error64(&aio->al_aiocb);
if (result == EINPROGRESS) {
inprogress++;
diff --git a/usr/src/cmd/filebench/common/misc.h b/usr/src/cmd/filebench/common/misc.h
index f9034b7e94..1f4cdf75d7 100644
--- a/usr/src/cmd/filebench/common/misc.h
+++ b/usr/src/cmd/filebench/common/misc.h
@@ -37,6 +37,8 @@
#include <sys/times.h>
+#include "vars.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/usr/src/cmd/filebench/common/parser_gram.y b/usr/src/cmd/filebench/common/parser_gram.y
index c8edfd5812..00cadd19f0 100644
--- a/usr/src/cmd/filebench/common/parser_gram.y
+++ b/usr/src/cmd/filebench/common/parser_gram.y
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
%{
@@ -2277,10 +2279,8 @@ parser_inner_flowop_define(threadflow_t *thread, flowop_t *comp0_flow,
char fullname[MAXPATHLEN];
/* create composite_name.name for new flowop */
- (void) strlcpy(fullname, comp_mstr_flow->fo_name, MAXPATHLEN);
- (void) strlcat(fullname, ".", MAXPATHLEN);
- (void) strlcat(fullname, inner_flowtype->fo_name,
- MAXPATHLEN);
+ snprintf(fullname, MAXPATHLEN, "%s.%s",
+ comp_mstr_flow->fo_name, inner_flowtype->fo_name);
if ((inner_flowop = flowop_define(thread, fullname,
inner_flowtype, &comp_mstr_flow->fo_comp_fops,
@@ -2918,7 +2918,7 @@ parser_help(cmd_t *cmd)
} else {
filebench_log(LOG_INFO,
"load <personality> (ls "
- "/usr/benchmarks/filebench/workloads for list)");
+ FILEBENCHDIR "/workloads for list)");
}
}
@@ -3858,7 +3858,7 @@ alloc_list()
#define USAGE1 \
"Usage:\n" \
-"%s: interpret f script and generate file workload\n" \
+"go_filebench: interpret f script and generate file workload\n" \
"Options:\n" \
" [-h] Display verbose help\n" \
" [-p] Disable opening /proc to set uacct to enable truss\n"
@@ -3878,7 +3878,7 @@ alloc_list()
#define PARSER_EXAMPLE \
"Example:\n\n" \
-"#!/usr/bin/filebench -f\n" \
+"#!" FILEBENCHDIR "/bin/go_filebench -f\n" \
"\n" \
"define file name=bigfile,path=bigfile,size=1g,prealloc,reuse\n" \
"define process name=randomizer\n" \
diff --git a/usr/src/cmd/filebench/common/parser_lex.l b/usr/src/cmd/filebench/common/parser_lex.l
index 064b5eb453..166d423b51 100644
--- a/usr/src/cmd/filebench/common/parser_lex.l
+++ b/usr/src/cmd/filebench/common/parser_lex.l
@@ -22,6 +22,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
%{
@@ -38,10 +40,10 @@
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
+
+#include "filebench.h"
#include "parsertypes.h"
#include "utils.h"
-#include "filebench.h"
-
#include "parser_gram.h"
int lex_lineno = 1; /* line-number for error reporting */
diff --git a/usr/src/cmd/filebench/common/parsertypes.h b/usr/src/cmd/filebench/common/parsertypes.h
index d0d8db0842..96cb38eced 100644
--- a/usr/src/cmd/filebench/common/parsertypes.h
+++ b/usr/src/cmd/filebench/common/parsertypes.h
@@ -29,6 +29,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include "config.h"
+
+#include "filebench.h"
#include "vars.h"
#ifdef __cplusplus
diff --git a/usr/src/cmd/filebench/common/procflow.c b/usr/src/cmd/filebench/common/procflow.c
index 37cd222fd7..0209871359 100644
--- a/usr/src/cmd/filebench/common/procflow.c
+++ b/usr/src/cmd/filebench/common/procflow.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -30,8 +32,8 @@
#include <sys/stat.h>
#include <sys/wait.h>
-#include "procflow.h"
#include "filebench.h"
+#include "procflow.h"
#include "flowop.h"
#include "ipc.h"
@@ -162,7 +164,7 @@ procflow_createproc(procflow_t *procflow)
}
#else
- if (execl(execname, procname, "-a", procname, "-i",
+ if (execlp(execname, procname, "-a", procname, "-i",
instance, "-s", shmaddr, "-m", shmpath, NULL) < 0) {
filebench_log(LOG_ERROR,
"procflow exec proc failed: %s",
diff --git a/usr/src/cmd/filebench/common/stats.c b/usr/src/cmd/filebench/common/stats.c
index bc1cdf1f8e..36edc7d3da 100644
--- a/usr/src/cmd/filebench/common/stats.c
+++ b/usr/src/cmd/filebench/common/stats.c
@@ -515,7 +515,7 @@ stats_snap(void)
flowop = filebench_shm->shm_flowoplist;
str = malloc(1048576);
- *str = NULL;
+ *str = '\0';
(void) strcpy(str, "Per-Operation Breakdown\n");
while (flowop) {
char line[1024];
diff --git a/usr/src/cmd/filebench/common/threadflow.c b/usr/src/cmd/filebench/common/threadflow.c
index d5c1965298..bcbf243272 100644
--- a/usr/src/cmd/filebench/common/threadflow.c
+++ b/usr/src/cmd/filebench/common/threadflow.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -31,8 +33,9 @@
#include <sys/lwp.h>
#endif
#include <signal.h>
-#include "threadflow.h"
+
#include "filebench.h"
+#include "threadflow.h"
#include "flowop.h"
#include "ipc.h"
@@ -273,6 +276,7 @@ threadflow_delete(threadflow_t **threadlist, threadflow_t *threadflow,
threadflow_kill(threadflow, wait_cnt);
flowop_delete_all(&threadflow->tf_thrd_fops);
*threadlist = threadflow->tf_next;
+ (void) pthread_mutex_destroy(&threadflow->tf_lock);
ipc_free(FILEBENCH_THREADFLOW, (char *)threadflow);
return (0);
}
@@ -293,6 +297,7 @@ threadflow_delete(threadflow_t **threadlist, threadflow_t *threadflow,
entry->tf_next->tf_instance);
threadflow_kill(entry->tf_next, wait_cnt);
flowop_delete_all(&entry->tf_next->tf_thrd_fops);
+ (void) pthread_mutex_destroy(&threadflow->tf_lock);
ipc_free(FILEBENCH_THREADFLOW, (char *)threadflow);
entry->tf_next = entry->tf_next->tf_next;
return (0);
@@ -421,6 +426,7 @@ threadflow_define_common(procflow_t *procflow, char *name,
threadflow->tf_instance = instance;
(void) strcpy(threadflow->tf_name, name);
threadflow->tf_process = procflow;
+ (void) pthread_mutex_init(&threadflow->tf_lock, ipc_mutexattr());
filebench_log(LOG_DEBUG_IMPL, "Defining thread %s-%d",
name, instance);
diff --git a/usr/src/cmd/filebench/common/utils.c b/usr/src/cmd/filebench/common/utils.c
index 3683a5f25c..68dc415a2f 100644
--- a/usr/src/cmd/filebench/common/utils.c
+++ b/usr/src/cmd/filebench/common/utils.c
@@ -19,8 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -34,6 +36,8 @@
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
+
+#include "filebench.h"
#include "utils.h"
#include "parsertypes.h"
diff --git a/usr/src/cmd/filebench/common/vars.c b/usr/src/cmd/filebench/common/vars.c
index cc3f3e6d32..eb2d4930e4 100644
--- a/usr/src/cmd/filebench/common/vars.c
+++ b/usr/src/cmd/filebench/common/vars.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2008 Denis Cheng
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -30,12 +32,12 @@
#include <string.h>
#include <errno.h>
+#include "filebench.h"
#include "vars.h"
#include "misc.h"
#include "utils.h"
#include "stats.h"
#include "eventgen.h"
-#include "filebench.h"
#include "fb_random.h"
static var_t *var_find_dynamic(char *name);