[dbench @ tridge@samba.org-20070716041205-ndm0vhllg1guj8eb]
[tridge/dbench.git] / dbench.h
index 9fabbf4e60af2e4f2d8d51dd14ba154ee95573cb..2639f62e2393da4a9bda444d68f44a92c24b679e 100644 (file)
--- a/dbench.h
+++ b/dbench.h
@@ -1,10 +1,10 @@
 /* 
-   dbench version 1
+   dbench version 2
    Copyright (C) Andrew Tridgell 1999
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#define _XOPEN_SOURCE 500
-
+#include "config.h"
+#include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <unistd.h>
-#include <stdio.h>
 #include <string.h>
 #include <ctype.h>
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <fcntl.h>
-#include <sys/fcntl.h>
+#include <time.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/mman.h>
+
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+#include <sys/param.h>
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#include <utime.h>
 #include <errno.h>
+#include <strings.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <netdb.h>
 
+#if HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#elif HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+#elif HAVE_SYS_ATTRIBUTES_H
+#include <sys/attributes.h>
+#endif
+
+#ifdef HAVE_SYS_EXTATTR_H
+#include <sys/extattr.h>
+#endif
+
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
 #ifndef MSG_WAITALL
 #define MSG_WAITALL 0x100
 #endif
 
 #define PRINT_FREQ 1
 
+#ifndef MIN
 #define MIN(x,y) ((x)<(y)?(x):(y))
+#endif
 
 #define TCP_PORT 7003
 #define TCP_OPTIONS "TCP_NODELAY SO_REUSEADDR"
 
 struct child_struct {
        int id;
-       int nprocs;
-       int status;
+       int failed;
        int line;
        int done;
-       double bytes_in, bytes_out;
+       int cleanup;
+       const char *directory;
+       double bytes;
+       double bytes_done_warmup;
+       double max_latency;
+       struct timeval starttime;
+       struct timeval lasttime;
+       off_t bytes_since_fsync;
+       char *cname;
+       struct {
+               double last_bytes;
+               struct timeval last_time;
+       } rate;
+       void *private;
 };
 
+struct options {
+       int nprocs;
+       int sync_open;
+       int sync_dirs;
+       int do_fsync;
+       int fsync_frequency;
+       char *tcp_options;
+       int timelimit;
+       int warmup;
+       const char *directory;
+       char *loadfile;
+       double targetrate;
+       int ea_enable;
+       const char *server;
+       int clients_per_process;
+};
 
 /* CreateDisposition field. */
 #define FILE_SUPERSEDE 0
@@ -91,3 +153,4 @@ struct child_struct {
 
 #include "proto.h"
 
+extern struct options options;