1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _FB_FILEBENCH_H 27 #define _FB_FILEBENCH_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include "config.h" 32 33 #include <stdio.h> 34 #include <string.h> 35 36 #include "vars.h" 37 #include "misc.h" 38 #include "flowop.h" 39 #include "ipc.h" 40 41 #ifdef HAVE_STDINT_H 42 #include <stdint.h> 43 #endif 44 45 46 #ifdef __STDC__ 47 #include <stdarg.h> 48 #define __V(x) x 49 #ifndef __P 50 #define __P(x) x 51 #endif 52 #else 53 #include <varargs.h> 54 #define __V(x) (va_alist) va_dcl 55 #define __P(x) () 56 #define const 57 #endif 58 59 #include <sys/times.h> 60 61 #ifdef HAVE_SYS_INT_LIMITS_H 62 #include <sys/int_limits.h> 63 #endif /* HAVE_SYS_INT_LIMITS_H */ 64 65 #ifdef __cplusplus 66 extern "C" { 67 #endif 68 69 extern pid_t pid; 70 extern int errno; 71 extern char *execname; 72 extern int noproc; 73 74 void filebench_init(); 75 void filebench_log __V((int level, const char *fmt, ...)); 76 void filebench_shutdown(int error); 77 78 #ifndef HAVE_UINT64_MAX 79 #define UINT64_MAX (((off64_t)1UL<<63UL) - 1UL) 80 #endif 81 82 #define FILEBENCH_RANDMAX64 UINT64_MAX 83 #define FILEBENCH_RANDMAX32 UINT32_MAX 84 85 #if defined(_LP64) || (__WORDSIZE == 64) 86 #define filebench_randomno filebench_randomno64 87 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX64 88 #else 89 #define filebench_randomno filebench_randomno32 90 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX32 91 #endif 92 int filebench_randomno32(uint32_t *, uint32_t, uint32_t); 93 int filebench_randomno64(uint64_t *, uint64_t, uint64_t); 94 95 #define KB (1024LL) 96 #define MB (KB * KB) 97 #define GB (KB * MB) 98 99 #define MMAP_SIZE (1024UL * 1024UL * 1024UL) 100 101 #ifndef MIN 102 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 103 #endif 104 105 #define FILEBENCH_VERSION "1.1.0" 106 #define FILEBENCHDIR "/usr/benchmarks/filebench" 107 #define FILEBENCH_PROMPT "filebench> " 108 #define MAX_LINE_LEN 1024 109 #define MAX_CMD_HIST 128 110 111 /* For MacOSX */ 112 #ifndef HAVE_OFF64_T 113 #define mmap64 mmap 114 #define off64_t off_t 115 #define open64 open 116 #define stat64 stat 117 #define pread64 pread 118 #define pwrite64 pwrite 119 #define lseek64 lseek 120 #define fstat64 fstat 121 #endif 122 123 #ifdef __cplusplus 124 } 125 #endif 126 127 #endif /* _FB_FILEBENCH_H */ 128