Home | History | Annotate | Download | only in common
      1  5184  ek110237 /*
      2  5184  ek110237  * CDDL HEADER START
      3  5184  ek110237  *
      4  5184  ek110237  * The contents of this file are subject to the terms of the
      5  5184  ek110237  * Common Development and Distribution License (the "License").
      6  5184  ek110237  * You may not use this file except in compliance with the License.
      7  5184  ek110237  *
      8  5184  ek110237  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  5184  ek110237  * or http://www.opensolaris.org/os/licensing.
     10  5184  ek110237  * See the License for the specific language governing permissions
     11  5184  ek110237  * and limitations under the License.
     12  5184  ek110237  *
     13  5184  ek110237  * When distributing Covered Code, include this CDDL HEADER in each
     14  5184  ek110237  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  5184  ek110237  * If applicable, add the following below this CDDL HEADER, with the
     16  5184  ek110237  * fields enclosed by brackets "[]" replaced with your own identifying
     17  5184  ek110237  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  5184  ek110237  *
     19  5184  ek110237  * CDDL HEADER END
     20  5184  ek110237  */
     21  5184  ek110237 /*
     22  8615    Andrew  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     23  5184  ek110237  * Use is subject to license terms.
     24  6613  ek110237  *
     25  6613  ek110237  * Portions Copyright 2008 Denis Cheng
     26  5184  ek110237  */
     27  5184  ek110237 
     28  5184  ek110237 #ifndef _FB_FILEBENCH_H
     29  5184  ek110237 #define	_FB_FILEBENCH_H
     30  5184  ek110237 
     31  5184  ek110237 #include "config.h"
     32  5184  ek110237 
     33  5184  ek110237 #include <stdio.h>
     34  5184  ek110237 #include <string.h>
     35  6613  ek110237 #include <errno.h>
     36  5184  ek110237 
     37  6613  ek110237 #ifndef HAVE_BOOLEAN_T
     38  6613  ek110237 typedef enum { B_FALSE, B_TRUE } boolean_t;
     39  6613  ek110237 #endif
     40  6613  ek110237 
     41  6613  ek110237 #ifndef HAVE_U_LONGLONG_T
     42  6613  ek110237 typedef unsigned long long u_longlong_t;
     43  7556    Andrew #endif
     44  7556    Andrew 
     45  9513    Andrew #ifndef HAVE_UINT_T
     46  9513    Andrew typedef unsigned int uint_t;
     47  9513    Andrew #endif
     48  9513    Andrew 
     49  7556    Andrew #ifndef TRUE
     50  7556    Andrew #define	TRUE 1
     51  7556    Andrew #endif
     52  7556    Andrew 
     53  7556    Andrew #ifndef FALSE
     54  7556    Andrew #define	FALSE 0
     55  6613  ek110237 #endif
     56  6613  ek110237 
     57  6613  ek110237 #include "procflow.h"
     58  5184  ek110237 #include "misc.h"
     59  5184  ek110237 #include "ipc.h"
     60  5184  ek110237 
     61  5184  ek110237 #ifdef HAVE_STDINT_H
     62  5184  ek110237 #include <stdint.h>
     63  5184  ek110237 #endif
     64  5184  ek110237 
     65  5184  ek110237 
     66  5184  ek110237 #ifdef __STDC__
     67  5184  ek110237 #include <stdarg.h>
     68  5184  ek110237 #define	__V(x)  x
     69  5184  ek110237 #ifndef __P
     70  5184  ek110237 #define	__P(x)  x
     71  5184  ek110237 #endif
     72  5184  ek110237 #else
     73  5184  ek110237 #include <varargs.h>
     74  5184  ek110237 #define	__V(x)  (va_alist) va_dcl
     75  5184  ek110237 #define	__P(x)  ()
     76  5184  ek110237 #define	const
     77  5184  ek110237 #endif
     78  5184  ek110237 
     79  5184  ek110237 #include <sys/times.h>
     80  5184  ek110237 
     81  5184  ek110237 #ifdef HAVE_SYS_INT_LIMITS_H
     82  5184  ek110237 #include <sys/int_limits.h>
     83  5184  ek110237 #endif /* HAVE_SYS_INT_LIMITS_H */
     84  5184  ek110237 
     85  5184  ek110237 #ifdef	__cplusplus
     86  5184  ek110237 extern "C" {
     87  6212  aw148015 #endif
     88  6212  aw148015 
     89  6084  aw148015 extern pid_t my_pid;		/* this process' process id */
     90  6084  aw148015 extern procflow_t *my_procflow;	/* if slave process, procflow pointer */
     91  5184  ek110237 extern int errno;
     92  5184  ek110237 extern char *execname;
     93  9513    Andrew extern char *fbbasepath;
     94  5184  ek110237 extern int noproc;
     95  5184  ek110237 
     96  5184  ek110237 void filebench_init();
     97  5184  ek110237 void filebench_log __V((int level, const char *fmt, ...));
     98  5184  ek110237 void filebench_shutdown(int error);
     99  8615    Andrew void filebench_plugin_funcvecinit(void);
    100  5184  ek110237 
    101  5184  ek110237 #ifndef HAVE_UINT64_MAX
    102  5184  ek110237 #define	UINT64_MAX (((off64_t)1UL<<63UL) - 1UL)
    103  5184  ek110237 #endif
    104  5184  ek110237 
    105  5184  ek110237 #define	FILEBENCH_RANDMAX64 UINT64_MAX
    106  5184  ek110237 #define	FILEBENCH_RANDMAX32 UINT32_MAX
    107  5184  ek110237 
    108  5184  ek110237 #if defined(_LP64) || (__WORDSIZE == 64)
    109  5184  ek110237 #define	filebench_randomno filebench_randomno64
    110  5184  ek110237 #define	FILEBENCH_RANDMAX FILEBENCH_RANDMAX64
    111  5184  ek110237 #else
    112  5184  ek110237 #define	filebench_randomno filebench_randomno32
    113  5184  ek110237 #define	FILEBENCH_RANDMAX FILEBENCH_RANDMAX32
    114  5184  ek110237 #endif
    115  5184  ek110237 
    116  5184  ek110237 #define	KB (1024LL)
    117  5184  ek110237 #define	MB (KB * KB)
    118  5184  ek110237 #define	GB (KB * MB)
    119  5184  ek110237 
    120  5184  ek110237 #define	MMAP_SIZE	(1024UL * 1024UL * 1024UL)
    121  5184  ek110237 
    122  5184  ek110237 #ifndef MIN
    123  5184  ek110237 #define	MIN(x, y) ((x) < (y) ? (x) : (y))
    124  5184  ek110237 #endif
    125  5184  ek110237 
    126  9801    Andrew #define	FILEBENCH_VERSION	"1.4.8"
    127  5184  ek110237 #define	FILEBENCHDIR	"/usr/benchmarks/filebench"
    128  5184  ek110237 #define	FILEBENCH_PROMPT	"filebench> "
    129  5184  ek110237 #define	MAX_LINE_LEN	1024
    130  5184  ek110237 #define	MAX_CMD_HIST	128
    131  8762    Andrew #define	SHUTDOWN_WAIT_SECONDS	3 /* time to wait for proc / thrd to quit */
    132  6084  aw148015 
    133  6084  aw148015 #define	FILEBENCH_DONE	 1
    134  6084  aw148015 #define	FILEBENCH_OK	 0
    135  6084  aw148015 #define	FILEBENCH_ERROR -1
    136  6084  aw148015 #define	FILEBENCH_NORSC -2
    137  5184  ek110237 
    138  5184  ek110237 /* For MacOSX */
    139  5184  ek110237 #ifndef HAVE_OFF64_T
    140  5184  ek110237 #define	mmap64 mmap
    141  5184  ek110237 #define	off64_t off_t
    142  5184  ek110237 #define	open64 open
    143  5184  ek110237 #define	stat64 stat
    144  5184  ek110237 #define	pread64 pread
    145  5184  ek110237 #define	pwrite64 pwrite
    146  5184  ek110237 #define	lseek64 lseek
    147  5184  ek110237 #define	fstat64 fstat
    148  5184  ek110237 #endif
    149  5184  ek110237 
    150  5184  ek110237 #ifdef	__cplusplus
    151  5184  ek110237 }
    152  5184  ek110237 #endif
    153  5184  ek110237 
    154  5184  ek110237 #endif	/* _FB_FILEBENCH_H */
    155