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 2008 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 my_pid; /* this process' process id */ 70 extern procflow_t *my_procflow; /* if slave process, procflow pointer */ 71 extern int errno; 72 extern char *execname; 73 extern int noproc; 74 75 void filebench_init(); 76 void filebench_log __V((int level, const char *fmt, ...)); 77 void filebench_shutdown(int error); 78 79 #ifndef HAVE_UINT64_MAX 80 #define UINT64_MAX (((off64_t)1UL<<63UL) - 1UL) 81 #endif 82 83 #define FILEBENCH_RANDMAX64 UINT64_MAX 84 #define FILEBENCH_RANDMAX32 UINT32_MAX 85 86 #if defined(_LP64) || (__WORDSIZE == 64) 87 #define filebench_randomno filebench_randomno64 88 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX64 89 #else 90 #define filebench_randomno filebench_randomno32 91 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX32 92 #endif 93 int filebench_randomno32(uint32_t *, uint32_t, uint32_t); 94 int filebench_randomno64(uint64_t *, uint64_t, uint64_t); 95 96 #define KB (1024LL) 97 #define MB (KB * KB) 98 #define GB (KB * MB) 99 100 #define MMAP_SIZE (1024UL * 1024UL * 1024UL) 101 102 #ifndef MIN 103 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 104 #endif 105 106 #define FILEBENCH_VERSION "1.1.1" 107 #define FILEBENCHDIR "/usr/benchmarks/filebench" 108 #define FILEBENCH_PROMPT "filebench> " 109 #define MAX_LINE_LEN 1024 110 #define MAX_CMD_HIST 128 111 #define SHUTDOWN_WAIT_SECONDS 5 /* time to wait for proc / thrd to quit */ 112 113 #define FILEBENCH_DONE 1 114 #define FILEBENCH_OK 0 115 #define FILEBENCH_ERROR -1 116 #define FILEBENCH_NORSC -2 117 118 /* For MacOSX */ 119 #ifndef HAVE_OFF64_T 120 #define mmap64 mmap 121 #define off64_t off_t 122 #define open64 open 123 #define stat64 stat 124 #define pread64 pread 125 #define pwrite64 pwrite 126 #define lseek64 lseek 127 #define fstat64 fstat 128 #endif 129 130 #ifdef __cplusplus 131 } 132 #endif 133 134 #endif /* _FB_FILEBENCH_H */ 135