├── bench-tools ├── fio │ ├── tools │ │ ├── .gitignore │ │ └── plot │ │ │ ├── samples │ │ │ ├── fio-logs.tar.gz │ │ │ └── Makefile │ │ │ ├── math.gpm │ │ │ └── graph2D.gpm │ ├── os │ │ ├── windows │ │ │ ├── posix │ │ │ │ └── include │ │ │ │ │ ├── netdb.h │ │ │ │ │ ├── poll.h │ │ │ │ │ ├── netinet │ │ │ │ │ ├── tcp.h │ │ │ │ │ └── in.h │ │ │ │ │ ├── sys │ │ │ │ │ ├── ipc.h │ │ │ │ │ ├── socket.h │ │ │ │ │ ├── poll.h │ │ │ │ │ ├── un.h │ │ │ │ │ ├── wait.h │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── uio.h │ │ │ │ │ ├── mman.h │ │ │ │ │ └── shm.h │ │ │ │ │ ├── semaphore.h │ │ │ │ │ ├── libgen.h │ │ │ │ │ ├── asm │ │ │ │ │ └── types.h │ │ │ │ │ ├── dlfcn.h │ │ │ │ │ ├── syslog.h │ │ │ │ │ ├── dirent.h │ │ │ │ │ └── arpa │ │ │ │ │ └── inet.h │ │ │ ├── posix.h │ │ │ ├── dobuild.cmd │ │ │ └── eula.rtf │ │ ├── kcompat.h │ │ ├── os-aix.h │ │ ├── os-openbsd.h │ │ └── os-netbsd.h │ ├── crc │ │ ├── test.h │ │ ├── crc64.h │ │ ├── sha256.h │ │ ├── sha512.h │ │ ├── crc7.h │ │ ├── sha1.h │ │ ├── md5.h │ │ ├── crc16.h │ │ ├── crc32.h │ │ └── crc32c.h │ ├── examples │ │ ├── cpuio.fio │ │ ├── null.fio │ │ ├── rdmaio-server.fio │ │ ├── rdmaio-client.fio │ │ ├── fsx.fio │ │ ├── zipf.fio │ │ ├── aio-read.fio │ │ ├── disk-zone-profile.fio │ │ ├── tiobench-example.fio │ │ ├── flow.fio │ │ ├── fusion-aw-sync.fio │ │ ├── netio.fio │ │ ├── netio_multicast.fio │ │ ├── numa.fio │ │ ├── surface-scan.fio │ │ ├── iometer-file-access-server.fio │ │ ├── latency-profile.fio │ │ ├── rbd.fio │ │ ├── e4defrag.fio │ │ ├── falloc.fio │ │ ├── ssd-test.fio │ │ ├── enospc-pressure.fio │ │ ├── ssd-steadystate.fio │ │ └── 1mbs_clients.fio │ ├── lib │ │ ├── strsep.h │ │ ├── inet_aton.c │ │ ├── inet_aton.h │ │ ├── getrusage.h │ │ ├── hweight.h │ │ ├── strcasestr.h │ │ ├── getrusage.c │ │ ├── getopt.h │ │ ├── strcasestr.c │ │ ├── strsep.c │ │ ├── ieee754.h │ │ ├── zipf.h │ │ ├── axmap.h │ │ ├── lfsr.h │ │ ├── ffz.h │ │ ├── fls.h │ │ ├── hweight.c │ │ ├── rand.h │ │ └── bswap.h │ ├── printing.h │ ├── .gitignore │ ├── SERVER-TODO │ ├── t │ │ ├── jobs │ │ │ ├── t0001-52c58027.fio │ │ │ ├── t0007-37cf9e3c.fio │ │ │ ├── t0008-ae2fafc8.fio │ │ │ ├── t0005-f7078f7b.fio │ │ │ ├── t0003-0ae2c6e1-pre.fio │ │ │ ├── t0006-82af2a7c.fio │ │ │ ├── t0002-13af05ae-pre │ │ │ ├── t0002-13af05ae-post │ │ │ ├── t0003-0ae2c6e1-post.fio │ │ │ └── t0004-8a99fdf6.fio │ │ ├── ieee754.c │ │ └── log.c │ ├── memalign.h │ ├── compiler │ │ ├── compiler-gcc4.h │ │ ├── compiler-gcc3.h │ │ └── compiler.h │ ├── goptions.h │ ├── minmax.h │ ├── gerror.h │ ├── flow.h │ ├── tickmarks.h │ ├── arch │ │ ├── arch-generic.h │ │ ├── arch-alpha.h │ │ ├── arch-hppa.h │ │ ├── arch-sparc.h │ │ ├── arch-mips.h │ │ ├── arch-sparc64.h │ │ ├── arch-aarch64.h │ │ ├── arch-arm.h │ │ ├── arch-s390.h │ │ ├── arch-ia64.h │ │ ├── arch-sh.h │ │ ├── arch-x86.h │ │ ├── arch-x86-common.h │ │ └── arch-x86_64.h │ ├── smalloc.h │ ├── filelock.h │ ├── filehash.h │ ├── gclient.h │ ├── helpers.h │ ├── gettime.h │ ├── REPORTING-BUGS │ ├── debug.c │ ├── cairo_text_helpers.h │ ├── engines │ │ └── gfapi.h │ ├── cgroup.h │ ├── log.h │ ├── fio_time.h │ ├── memalign.c │ ├── td_error.h │ ├── helpers.c │ ├── FIO-VERSION-GEN │ ├── trim.h │ ├── io_u_queue.c │ ├── LICENSE │ ├── err.h │ ├── td_error.c │ ├── debug.h │ ├── mutex.h │ ├── ghelpers.h │ ├── profile.h │ ├── idletime.h │ ├── gcompat.c │ ├── fio.c │ ├── gcompat.h │ └── io_u_queue.h ├── http_load │ ├── urls │ ├── timers.c │ ├── timers.h │ ├── http_load.1 │ ├── http_load.c │ ├── FILES │ ├── version.h │ ├── README │ └── make_test_files ├── sysbench │ ├── TODO │ ├── config │ │ └── stamp-h1 │ ├── sysbench │ │ ├── drivers │ │ │ ├── drizzle │ │ │ │ ├── .deps │ │ │ │ │ └── drv_drizzle.Po │ │ │ │ └── Makefile.am │ │ │ ├── pgsql │ │ │ │ ├── .deps │ │ │ │ │ └── libsbpgsql_a-drv_pgsql.Po │ │ │ │ └── Makefile.am │ │ │ ├── oracle │ │ │ │ ├── .deps │ │ │ │ │ └── libsboracle_a-drv_oracle.Po │ │ │ │ └── Makefile.am │ │ │ ├── mysql │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Makefile.am │ │ │ └── Makefile.am │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── fileio │ │ │ │ ├── crc32.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Makefile.am │ │ │ │ └── .deps │ │ │ │ │ └── libsbfileio_a-crc32.Po │ │ │ ├── db │ │ │ │ ├── delete.lua │ │ │ │ ├── select.lua │ │ │ │ ├── update_index.lua │ │ │ │ ├── oltp_simple.lua │ │ │ │ ├── parallel_prepare.lua │ │ │ │ ├── update_non_index.lua │ │ │ │ ├── insert.lua │ │ │ │ └── Makefile.am │ │ │ ├── Makefile.am │ │ │ ├── cpu │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Makefile.am │ │ │ ├── mutex │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Makefile.am │ │ │ ├── memory │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Makefile.am │ │ │ ├── threads │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Makefile.am │ │ │ ├── sb_cpu.h │ │ │ ├── sb_threads.h │ │ │ ├── sb_mutex.h │ │ │ ├── sb_fileio.h │ │ │ └── sb_memory.h │ │ └── scripting │ │ │ ├── lua │ │ │ ├── src │ │ │ │ ├── lapi.h │ │ │ │ ├── linit.c │ │ │ │ ├── lstring.h │ │ │ │ ├── lundump.h │ │ │ │ ├── ldebug.h │ │ │ │ ├── ltm.h │ │ │ │ ├── lfunc.h │ │ │ │ ├── lualib.h │ │ │ │ ├── lvm.h │ │ │ │ ├── ltable.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Makefile.am │ │ │ │ └── lmem.h │ │ │ ├── Makefile.am │ │ │ ├── README │ │ │ └── COPYRIGHT │ │ │ ├── CMakeLists.txt │ │ │ ├── script_lua.h │ │ │ ├── Makefile.am │ │ │ ├── sb_script.h │ │ │ └── sb_script.c │ ├── doc │ │ ├── xsl │ │ │ ├── xhtml.xsl │ │ │ ├── catalog.xml │ │ │ ├── catalog.xml.in │ │ │ └── Makefile.am │ │ └── Makefile.am │ ├── m4 │ │ ├── ac_lua_devel.m4 │ │ ├── ltversion.m4 │ │ ├── extensions.m4 │ │ └── ac_check_aio.m4 │ ├── Makefile.am │ └── README-WIN.txt ├── tpcc_mysql │ ├── tpcc_load │ ├── tpcc_start │ ├── scripts │ │ ├── memlock │ │ ├── analyze_checkpoint_xtradb.sh │ │ ├── analyze_flushed_innodb.sh │ │ ├── analyze_modified.sh │ │ ├── analyze_checkpoint.sh │ │ ├── flashcache_stat.sh │ │ ├── analyze_evicted.sh │ │ ├── analyze_flushed.sh │ │ ├── innodb_stat.sh │ │ ├── analyze_checkpoint_xtradb1.sh │ │ ├── virident_stat.sh │ │ ├── analyze_min.sh │ │ ├── analyze_dirty.sh │ │ ├── analyze.sh │ │ ├── analyzeR.sh │ │ └── memlock.c │ ├── src │ │ ├── sequence.h │ │ ├── spt_proc.h │ │ ├── rthist.h │ │ ├── spt_proc.c │ │ ├── Makefile │ │ ├── parse_port.h │ │ ├── trans_if.h │ │ └── sequence.c │ ├── count.sql │ ├── schema2 │ │ ├── count.sql │ │ ├── drop_cons.sql │ │ └── add_fkey_idx.sql │ ├── load.sh │ ├── drop_cons.sql │ ├── README │ └── add_fkey_idx.sql ├── script │ └── wubx │ │ ├── tpcc_mysql │ │ ├── run.sh │ │ └── run1.sh │ │ ├── fio │ │ └── daosen-mysql-test │ │ └── sysbench-scripts │ │ └── fileio │ │ ├── analyze.pl │ │ └── run.sh └── ibench │ └── run.sh ├── README.md └── LICENSE /bench-tools/fio/tools/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /bench-tools/http_load/urls: -------------------------------------------------------------------------------- 1 | http://192.168.199.75 2 | -------------------------------------------------------------------------------- /bench-tools/sysbench/TODO: -------------------------------------------------------------------------------- 1 | * Test line, to be deleted -------------------------------------------------------------------------------- /bench-tools/sysbench/config/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for config/config.h 2 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/drizzle/.deps/drv_drizzle.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/pgsql/.deps/libsbpgsql_a-drv_pgsql.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/oracle/.deps/libsboracle_a-drv_oracle.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /bench-tools/http_load/timers.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/http_load/timers.c -------------------------------------------------------------------------------- /bench-tools/http_load/timers.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/http_load/timers.h -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/netdb.h: -------------------------------------------------------------------------------- 1 | #ifndef NETDB_H 2 | #define NETDB_H 3 | 4 | #endif /* NETDB_H */ 5 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/poll.h: -------------------------------------------------------------------------------- 1 | #ifndef POLL_H 2 | #define POLL_H 3 | 4 | #endif /* POLL_H */ 5 | -------------------------------------------------------------------------------- /bench-tools/http_load/http_load.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/http_load/http_load.1 -------------------------------------------------------------------------------- /bench-tools/http_load/http_load.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/http_load/http_load.c -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/tpcc_load: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/tpcc_mysql/tpcc_load -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/tpcc_start: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/tpcc_mysql/tpcc_start -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/netinet/tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef NETINET_TCP_H 2 | #define NETINET_TCP_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/ipc.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_IPC_H 2 | #define SYS_IPC_H 3 | 4 | #endif /* SYS_IPC_H */ 5 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) 2 | ADD_LIBRARY(sbtests sb_cpu.) 3 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/memlock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/tpcc_mysql/scripts/memlock -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef SEMAPHORE_H 2 | #define SEMAPHORE_H 3 | 4 | #endif /* SEMAPHORE_H */ 5 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/socket.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_SOCKET_H 2 | #define SYS_SOCKET_H 3 | 4 | #endif /* SYS_SOCKET_H */ 5 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/test.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_CRC_TEST_H 2 | #define FIO_CRC_TEST_H 3 | 4 | int fio_crctest(const char *type); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/cpuio.fio: -------------------------------------------------------------------------------- 1 | [global] 2 | ioengine=cpuio 3 | time_based 4 | runtime=10 5 | 6 | [burn50percent] 7 | cpuload=50 8 | 9 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/mysql/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) 2 | ADD_LIBRARY(sbmysql drv_mysql.c) 3 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/strsep.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_STRSEP_LIB_H 2 | #define FIO_STRSEP_LIB_H 3 | 4 | char *strsep(char **, const char *); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /bench-tools/fio/printing.h: -------------------------------------------------------------------------------- 1 | #ifndef PRINTING_H 2 | #define PRINTING_H 3 | 4 | void gfio_print_results(struct gui_entry *ge); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_checkpoint_xtradb.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { } /Checkpoint age / {st=$3 ; print (st)/1024/1024 } ' 2 | -------------------------------------------------------------------------------- /bench-tools/fio/tools/plot/samples/fio-logs.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yejr/MyDBAtools/HEAD/bench-tools/fio/tools/plot/samples/fio-logs.tar.gz -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/sequence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sequence.h 3 | */ 4 | 5 | void seq_init( int n, int p, int o, int d, int s ); 6 | int seq_get(); 7 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_flushed_innodb.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { df=0 ; dl=0; } /Innodb_buffer_pool_pages_flushed/ { df=$4 ; print df } ' 2 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_modified.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { } /Log sequence number/ {st=$4 } /Log flushed up to/ { ed=$5; print (st-ed) } ' 2 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/crc64.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC64_H 2 | #define CRC64_H 3 | 4 | unsigned long long fio_crc64(const unsigned char *, unsigned long); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/libgen.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBGEN_H 2 | #define LIBGEN_H 3 | 4 | char *basename(char *path); 5 | 6 | #endif /* LIBGEN_H */ 7 | -------------------------------------------------------------------------------- /bench-tools/fio/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | *.o 3 | /.depend 4 | /FIO-VERSION-FILE 5 | /config-host.h 6 | /config-host.mak 7 | /config.log 8 | /cscope.out 9 | /fio 10 | -------------------------------------------------------------------------------- /bench-tools/fio/SERVER-TODO: -------------------------------------------------------------------------------- 1 | - Collate ETA output from multiple connections into 1 2 | - If group_reporting is set, collate final output from multiple connections 3 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/inet_aton.c: -------------------------------------------------------------------------------- 1 | #include "inet_aton.h" 2 | 3 | int inet_aton(const char *cp, struct in_addr *inp) 4 | { 5 | return inet_pton(AF_INET, cp, inp); 6 | } 7 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0001-52c58027.fio: -------------------------------------------------------------------------------- 1 | #Commit 52c580272d87d2b9b8a65d317bf7c2d432a30fec 2 | [foo] 3 | size=20000 4 | bsrange=1k-4k 5 | rw=randread 6 | ioengine=null 7 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_checkpoint.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { } /Log sequence number/ {st=$4 } /Last checkpoint at/ { ed=$4; print (st-ed)/1024/1024 } ' 2 | -------------------------------------------------------------------------------- /bench-tools/http_load/FILES: -------------------------------------------------------------------------------- 1 | Makefile 2 | README 3 | http_load.1 4 | http_load.c 5 | make_test_files 6 | port.h 7 | timers.c 8 | timers.h 9 | version.h 10 | FILES 11 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/null.fio: -------------------------------------------------------------------------------- 1 | [global] 2 | bs=4k 3 | gtod_reduce=1 4 | 5 | [null] 6 | ioengine=null 7 | size=100g 8 | rw=randread 9 | norandommap 10 | time_based=0 11 | -------------------------------------------------------------------------------- /bench-tools/script/wubx/tpcc_mysql/run.sh: -------------------------------------------------------------------------------- 1 | ./tpcc_load 192.168.143.171:5617 tpcc100 admin admin 100 >> 1.out 2 | sleep 120 3 | for i in `seq 1 3`; do ./thdp_run.sh;sleep 100; done 4 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/spt_proc.h: -------------------------------------------------------------------------------- 1 | int error(MYSQL *mysql, MYSQL_STMT *mysql_stmt); 2 | 3 | #define TIMESTAMP_LEN 80 4 | #define STRFTIME_FORMAT "%Y-%m-%d %H:%M:%S" 5 | 6 | -------------------------------------------------------------------------------- /bench-tools/fio/os/kcompat.h: -------------------------------------------------------------------------------- 1 | #ifndef _KCOMPAT_H_ 2 | #define _KCOMPAT_H_ 3 | 4 | #include 5 | 6 | #define u64 uint64_t 7 | #define u32 uint32_t 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/netinet/in.h: -------------------------------------------------------------------------------- 1 | #ifndef NETINET_IN_H 2 | #define NETINET_IN_H 3 | 4 | #include 5 | #include 6 | 7 | 8 | #endif /* NETINET_IN_H */ 9 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/flashcache_stat.sh: -------------------------------------------------------------------------------- 1 | sysctl -w dev.flashcache.zero_stats=1 2 | 3 | while [ true ] 4 | do 5 | 6 | dmsetup status flashcache 7 | sleep 10 8 | 9 | done 10 | 11 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/inet_aton.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_INET_ATON_LIB_H 2 | #define FIO_INET_ATON_LIB_H 3 | 4 | #include 5 | 6 | int inet_aton(const char *cp, struct in_addr *inp); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_evicted.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { df=0 ; dl=0; } /Innodb_buffer_pool_read_ahead_evicted/ { df=$4 } /Innodb_buffer_pool_pages_LRU_flushed/ { dl=$4; print df,dl } ' 2 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_flushed.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { df=0 ; dl=0; } /Innodb_buffer_pool_pages_flushed[\s]/ { df=$4 } /Innodb_buffer_pool_pages_LRU_flushed/ { dl=$4; print df,dl } ' 2 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/rdmaio-server.fio: -------------------------------------------------------------------------------- 1 | # Example rdma server job 2 | [global] 3 | ioengine=rdma 4 | filename=[ip_addr]/[port] 5 | bs=1m 6 | size=100g 7 | 8 | [receiver] 9 | rw=read 10 | iodepth=16 -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/rthist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rthist.h 3 | */ 4 | 5 | void hist_init(); 6 | void hist_inc( int transaction, double rtclk ); 7 | double hist_ckp( int transaction ); 8 | void hist_report(); 9 | -------------------------------------------------------------------------------- /bench-tools/fio/memalign.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_MEMALIGN_H 2 | #define FIO_MEMALIGN_H 3 | 4 | extern void *fio_memalign(size_t alignment, size_t size); 5 | extern void fio_memfree(void *ptr, size_t size); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /bench-tools/http_load/version.h: -------------------------------------------------------------------------------- 1 | /* version.h - version define for http_load */ 2 | 3 | #ifndef _VERSION_H_ 4 | #define _VERSION_H_ 5 | 6 | #define VERSION "http_load 12mar2006" 7 | 8 | #endif /* _VERSION_H_ */ 9 | -------------------------------------------------------------------------------- /bench-tools/fio/compiler/compiler-gcc4.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_COMPILER_GCC4_H 2 | #define FIO_COMPILER_GCC4_H 3 | 4 | #ifndef __must_check 5 | #define __must_check __attribute__((warn_unused_result)) 6 | #endif 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/innodb_stat.sh: -------------------------------------------------------------------------------- 1 | x=1 2 | end=$1 3 | 4 | while [ [ $x -le $end ] ] 5 | do 6 | 7 | mysql -e "SHOW ENGINE INNODB STATUS\G" 8 | sleep 10 9 | x=$(( $x + 10 )) 10 | 11 | done 12 | 13 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/getrusage.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_GETRUSAGE_H 2 | #define FIO_GETRUSAGE_H 3 | 4 | #include 5 | #include 6 | 7 | extern int fio_getrusage(struct rusage *ru); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /bench-tools/fio/goptions.h: -------------------------------------------------------------------------------- 1 | #ifndef GFIO_OPTIONS_H 2 | #define GFIO_OPTIONS_H 3 | 4 | void gopt_get_options_window(GtkWidget *window, struct gfio_client *gc); 5 | void gopt_init(void); 6 | void gopt_exit(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_checkpoint_xtradb1.sh: -------------------------------------------------------------------------------- 1 | #cat $1 | awk ' BEGIN { } /Log sequence number/ {st=$4 ; print (st)/1024/1024 } ' 2 | cat $1 | awk ' BEGIN { } /Last checkpoint at/ {st=$4 ; print (st)/1024/1024 } ' 3 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef ASM_TYPES_H 2 | #define ASM_TYPES_H 3 | 4 | typedef unsigned short __u16; 5 | typedef unsigned int __u32; 6 | typedef unsigned long long __u64; 7 | 8 | #endif /* ASM_TYPES_H */ 9 | -------------------------------------------------------------------------------- /bench-tools/fio/minmax.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_MIN_MAX_H 2 | #define FIO_MIN_MAX_H 3 | 4 | #ifndef min 5 | #define min(a, b) ((a) < (b) ? (a) : (b)) 6 | #endif 7 | #ifndef max 8 | #define max(a, b) ((a) > (b) ? (a) : (b)) 9 | #endif 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/hweight.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_HWEIGHT_H 2 | #define FIO_HWEIGHT_H 3 | 4 | #include 5 | 6 | unsigned int hweight8(uint8_t w); 7 | unsigned int hweight32(uint32_t w); 8 | unsigned int hweight64(uint64_t w); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/rdmaio-client.fio: -------------------------------------------------------------------------------- 1 | # Example rdma client job 2 | [global] 3 | ioengine=rdma 4 | filename=[ip_addr]/[port]/[RDMA_WRITE/RDMA_READ/SEND] 5 | bs=1m 6 | size=100g 7 | 8 | [sender] 9 | rw=write 10 | iodepth=1 11 | iodepth_batch_complete=1 -------------------------------------------------------------------------------- /bench-tools/fio/gerror.h: -------------------------------------------------------------------------------- 1 | #ifndef GFIO_ERROR_H 2 | #define GFIO_ERROR_H 3 | 4 | extern void gfio_report_error(struct gui_entry *ge, const char *format, ...); 5 | extern void gfio_report_info(struct gui *ui, const char *title, const char *message); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /bench-tools/fio/compiler/compiler-gcc3.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_COMPILER_GCC3_H 2 | #define FIO_COMPILER_GCC3_H 3 | 4 | #if __GNUC_MINOR__ >= 4 5 | #ifndef __must_check 6 | #define __must_check __attribute__((warn_unused_result)) 7 | #endif 8 | #endif 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0007-37cf9e3c.fio: -------------------------------------------------------------------------------- 1 | # Expected result: fio reads 87040KB of data 2 | # Buggy result: fio reads the full 128MB of data 3 | [foo] 4 | size=128mb 5 | rw=read:512k 6 | bs=1m 7 | time_based 8 | norandommap 9 | write_iolog=log 10 | direct=1 11 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/virident_stat.sh: -------------------------------------------------------------------------------- 1 | echo 0 > /proc/driver/virident/vgcdrivea0/bdev 2 | 3 | while [ true ] 4 | do 5 | 6 | cat /proc/driver/virident/vgcdrivea0/bdev 7 | cat /proc/driver/virident/vgcdrivea0/gc 8 | sleep 10 9 | 10 | done 11 | 12 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/strcasestr.h: -------------------------------------------------------------------------------- 1 | #ifdef CONFIG_STRCASESTR 2 | 3 | #include 4 | 5 | #else 6 | 7 | #ifndef FIO_STRCASESTR_H 8 | #define FIO_STRCASESTR_H 9 | 10 | char *strcasestr(const char *haystack, const char *needle); 11 | 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/fileio/crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC32_H 2 | 3 | #ifdef HAVE_CONFIG_H 4 | #include 5 | #endif 6 | 7 | #define CRC32_H 8 | 9 | extern unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned len); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0008-ae2fafc8.fio: -------------------------------------------------------------------------------- 1 | # Expected result: fio writes 16MB, reads 16+16MB 2 | # Buggy result: fio writes 16MB, reads ~21MB 3 | [global] 4 | bs=4k 5 | verify=crc32c 6 | rw=readwrite 7 | direct=1 8 | 9 | [foo] 10 | size=32m 11 | do_verify=1 12 | verify_backlog=1 13 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/fsx.fio: -------------------------------------------------------------------------------- 1 | ; This job file works pretty works similarly to running fsx-linux 2 | ; with -r 4096 -w 4096 -Z -N 500000 3 | [file] 4 | ioengine=libaio 5 | iodepth=1 6 | rw=randrw 7 | size=256k 8 | bs=4k 9 | norandommap 10 | direct=1 11 | loops=500000 12 | rwmixcycle=40 13 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/zipf.fio: -------------------------------------------------------------------------------- 1 | # Example job file for using a zipf distribution instead 2 | # of a purely random workload where each block is read 3 | # or written once. 4 | [job] 5 | ioengine=null 6 | rw=randread 7 | norandommap 8 | size=1280m 9 | bs=4k 10 | random_distribution=zipf:0.5 11 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0005-f7078f7b.fio: -------------------------------------------------------------------------------- 1 | # Expected result: fio reads and writes 100m 2 | # Buggy result: fio reads and writes ~100m/2 3 | [global] 4 | bs=4k 5 | ioengine=sync 6 | size=100m 7 | direct=1 8 | filename=xxx 9 | 10 | [write] 11 | verify=md5 12 | verify_backlog=32 13 | rw=write 14 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_min.sh: -------------------------------------------------------------------------------- 1 | cat $1 | grep -v HY000 | grep -v payment | grep -v neword | awk ' BEGIN { FS="[,(]"; s=0; cntr=0; aggr=0 } /MEASURING START/ { s=1} /STOPPING THREADS/ {s=0} /0/ { if (s==1) { cntr++; aggr+=$2; } if ( cntr==6 ) { printf ("%d\n",aggr) ; cntr=0; aggr=0 } } ' 2 | -------------------------------------------------------------------------------- /bench-tools/fio/flow.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_FLOW_H 2 | #define FIO_FLOW_H 3 | 4 | int flow_threshold_exceeded(struct thread_data *td); 5 | void flow_init_job(struct thread_data *td); 6 | void flow_exit_job(struct thread_data *td); 7 | 8 | void flow_exit(void); 9 | void flow_init(void); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /bench-tools/fio/tickmarks.h: -------------------------------------------------------------------------------- 1 | #ifndef TICKMARKS_H 2 | #define TICKMARKS_H 3 | 4 | struct tickmark { 5 | double value; 6 | char string[20]; 7 | }; 8 | 9 | int calc_tickmarks(double min, double max, int nticks, struct tickmark **tm, 10 | int *power_of_ten, int use_KMG_symbols, int base_off); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-generic.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_GENERIC_H 2 | #define ARCH_GENERIC_H 3 | 4 | #define FIO_ARCH (arch_generic) 5 | 6 | #define nop do { } while (0) 7 | #define read_barrier() __asm__ __volatile__("": : :"memory") 8 | #define write_barrier() __asm__ __volatile__("": : :"memory") 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/dlfcn.h: -------------------------------------------------------------------------------- 1 | #ifndef DLFCN_H 2 | #define DLFCN_H 3 | 4 | #define RTLD_LAZY 1 5 | 6 | void *dlopen(const char *file, int mode); 7 | int dlclose(void *handle); 8 | void *dlsym(void *restrict handle, const char *restrict name); 9 | char *dlerror(void); 10 | 11 | #endif /* DLFCN_H */ 12 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/poll.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_POLL_H 2 | #define SYS_POLL_H 3 | 4 | typedef int nfds_t; 5 | 6 | struct pollfd 7 | { 8 | int fd; 9 | short events; 10 | short revents; 11 | }; 12 | 13 | int poll(struct pollfd fds[], nfds_t nfds, int timeout); 14 | 15 | #endif /* SYS_POLL_H */ 16 | -------------------------------------------------------------------------------- /bench-tools/fio/smalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_SMALLOC_H 2 | #define FIO_SMALLOC_H 3 | 4 | extern void *smalloc(size_t); 5 | extern void sfree(void *); 6 | extern char *smalloc_strdup(const char *); 7 | extern void sinit(void); 8 | extern void scleanup(void); 9 | 10 | extern unsigned int smalloc_pool_size; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/un.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_UN_H 2 | #define SYS_UN_H 3 | 4 | typedef int sa_family_t; 5 | typedef int in_port_t; 6 | 7 | struct sockaddr_un 8 | { 9 | sa_family_t sun_family; /* Address family */ 10 | char sun_path[260]; /* Socket pathname */ 11 | }; 12 | 13 | #endif /* SYS_UN_H */ 14 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/aio-read.fio: -------------------------------------------------------------------------------- 1 | ; Read 4 files with aio at different depths 2 | [global] 3 | ioengine=libaio 4 | buffered=0 5 | rw=randread 6 | bs=128k 7 | size=512m 8 | directory=/data1 9 | 10 | [file1] 11 | iodepth=4 12 | 13 | [file2] 14 | iodepth=32 15 | 16 | [file3] 17 | iodepth=8 18 | 19 | [file4] 20 | iodepth=16 21 | -------------------------------------------------------------------------------- /bench-tools/fio/filelock.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_LOCK_FILE_H 2 | #define FIO_LOCK_FILE_H 3 | 4 | extern void fio_lock_file(const char *); 5 | extern int fio_trylock_file(const char *); 6 | extern void fio_unlock_file(const char *); 7 | 8 | extern int fio_filelock_init(void); 9 | extern void fio_filelock_exit(void); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_WAIT_H 2 | #define SYS_WAIT_H 3 | 4 | #define WIFSIGNALED(a) 0 5 | #define WIFEXITED(a) 0 6 | #define WTERMSIG(a) 0 7 | #define WEXITSTATUS(a) 0 8 | #define WNOHANG 1 9 | 10 | pid_t waitpid(pid_t, int *stat_loc, int options); 11 | 12 | #endif /* SYS_WAIT_H */ 13 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze_dirty.sh: -------------------------------------------------------------------------------- 1 | cat $1 | awk ' BEGIN { dt=-1;dr=-1;df=-1 } /Innodb_buffer_pool_pages_data/ { if (dt==-1) { dt=$4} else { dt+=$4 } } /Innodb_buffer_pool_pages_dirty/ { if (dr==-1) { dr=$4} else { dr+=$4 } } /Innodb_buffer_pool_pages_free/ { if (df==-1) { df=$4} else { df+=$4 } ; print (100*dr)/(1+dt+df) } ' 2 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/sha256.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_SHA256_H 2 | #define FIO_SHA256_H 3 | 4 | struct fio_sha256_ctx { 5 | uint32_t count[2]; 6 | uint32_t state[8]; 7 | uint8_t *buf; 8 | }; 9 | 10 | void fio_sha256_init(struct fio_sha256_ctx *); 11 | void fio_sha256_update(struct fio_sha256_ctx *, const uint8_t *, unsigned int); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/disk-zone-profile.fio: -------------------------------------------------------------------------------- 1 | ; Read disk in zones of 128m/2g, generating a plot of that afterwards 2 | ; should give a nice picture of the zoning of this drive 3 | 4 | [global] 5 | bs=64k 6 | direct=1 7 | rw=read 8 | ioengine=libaio 9 | iodepth=2 10 | zonesize=256m 11 | zoneskip=2g 12 | write_bw_log 13 | 14 | [/dev/sdb] 15 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_WINDOWS_POSIX_H 2 | #define FIO_WINDOWS_POSIX_H 3 | 4 | typedef off_t off64_t; 5 | typedef int clockid_t; 6 | 7 | extern int clock_gettime(clockid_t clock_id, struct timespec *tp); 8 | extern int inet_aton(const char *, struct in_addr *); 9 | extern int win_to_posix_error(DWORD winerr); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/sha512.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_SHA512_H 2 | #define FIO_SHA512_H 3 | 4 | struct fio_sha512_ctx { 5 | uint64_t state[8]; 6 | uint32_t count[4]; 7 | uint8_t *buf; 8 | uint64_t W[80]; 9 | }; 10 | 11 | void fio_sha512_init(struct fio_sha512_ctx *); 12 | void fio_sha512_update(struct fio_sha512_ctx *, const uint8_t *, unsigned int); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/getrusage.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "getrusage.h" 3 | 4 | int fio_getrusage(struct rusage *ru) 5 | { 6 | #ifdef CONFIG_RUSAGE_THREAD 7 | if (!getrusage(RUSAGE_THREAD, ru)) 8 | return 0; 9 | if (errno != EINVAL) 10 | return -1; 11 | /* Fall through to RUSAGE_SELF */ 12 | #endif 13 | return getrusage(RUSAGE_SELF, ru); 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MyDBAtools 2 | ========== 3 | 4 | MySQL DBA tools, include benchmark scripts, linux server performance monitor scripts, hardware monitor scripts and so on. 5 | 6 | 1. MySQL benchmark scripts 7 | 2. Hardware monitor scripts 8 | 3. Linux server performance monitor scripts 9 | 4. MySQL design specification 10 | 5. MySQL operation and maintenance specification 11 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/crc7.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC7_H 2 | #define CRC7_H 3 | 4 | extern const unsigned char crc7_syndrome_table[256]; 5 | 6 | static inline unsigned char crc7_byte(unsigned char crc, unsigned char data) 7 | { 8 | return crc7_syndrome_table[(crc << 1) ^ data]; 9 | } 10 | 11 | extern unsigned char fio_crc7(const unsigned char *buffer, unsigned int len); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2 2005/04/25 19:24:10 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/count.sql: -------------------------------------------------------------------------------- 1 | select count(w_id) from warehouse; 2 | select count(d_w_id) from district; 3 | select count(c_w_id) from customer; 4 | select count(h_c_id) from history; 5 | select count(no_w_id) from new_orders; 6 | select count(o_w_id) from orders; 7 | select count(ol_w_id) from order_line; 8 | select count(i_id) from item; 9 | select count(s_w_id) from stock; 10 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/schema2/count.sql: -------------------------------------------------------------------------------- 1 | select count(w_id) from warehouse; 2 | select count(d_w_id) from district; 3 | select count(c_w_id) from customer; 4 | select count(h_c_id) from history; 5 | select count(no_w_id) from new_orders; 6 | select count(o_w_id) from orders; 7 | select count(ol_w_id) from order_line; 8 | select count(i_id) from item; 9 | select count(s_w_id) from stock; 10 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0003-0ae2c6e1-pre.fio: -------------------------------------------------------------------------------- 1 | [global] 2 | ioengine=libaio 3 | direct=1 4 | filename=/tmp/foo 5 | iodepth=128 6 | size=10M 7 | loops=1 8 | group_reporting=1 9 | readwrite=write 10 | do_verify=0 11 | verify=md5 12 | numjobs=1 13 | thread 14 | verify_dump=1 15 | 16 | [small_writes] 17 | offset=0G 18 | blocksize=512 19 | 20 | [large_writes] 21 | offset=1G 22 | blocksize=1M 23 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0006-82af2a7c.fio: -------------------------------------------------------------------------------- 1 | # Expected results: workload runs and switches between 'm' and 'V' state 2 | # Buggy result: workload stays in 'm' mode, never doing actual verifies 3 | [global] 4 | rw=randrw 5 | bs=4k 6 | direct=1 7 | ioengine=libaio 8 | iodepth=32 9 | verify=meta 10 | verify_backlog=1024 11 | verify_fatal=1 12 | 13 | [ver-test] 14 | filename=foo 15 | size=4g 16 | verify_pattern=0xaaa 17 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0002-13af05ae-pre: -------------------------------------------------------------------------------- 1 | [global] 2 | ioengine=libaio 3 | direct=1 4 | filename=/dev/fioa 5 | iodepth=128 6 | size=1G 7 | loops=1 8 | group_reporting=1 9 | readwrite=write 10 | do_verify=0 11 | verify=md5 12 | numjobs=1 13 | thread 14 | bssplit=512/50:1M/50 15 | 16 | [thread0] 17 | offset=0G 18 | 19 | [thread-mix0] 20 | offset=4G 21 | readwrite=rw 22 | size=1G 23 | bsrange=512:1M 24 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/syslog.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSLOG_H 2 | #define SYSLOG_H 3 | 4 | int syslog(); 5 | 6 | #define LOG_INFO 0x1 7 | #define LOG_ERROR 0x2 8 | #define LOG_WARN 0x4 9 | 10 | #define LOG_NDELAY 0x1 11 | #define LOG_NOWAIT 0x2 12 | #define LOG_PID 0x4 13 | #define LOG_USER 0x8 14 | 15 | void closelog(void); 16 | void openlog(const char *ident, int logopt, int facility); 17 | 18 | #endif /* SYSLOG_H */ 19 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/tiobench-example.fio: -------------------------------------------------------------------------------- 1 | ; tiobench like setup, add more fX files between the stonewalls to 2 | ; create more threads 3 | 4 | [global] 5 | direct=1 6 | size=512m 7 | bsrange=4k-4k 8 | timeout=60 9 | numjobs=4 ; 4 simultaneous threads for each job 10 | 11 | [f1] 12 | rw=write 13 | 14 | [f2] 15 | stonewall 16 | rw=randwrite 17 | 18 | [f3] 19 | stonewall 20 | rw=read 21 | 22 | [f4] 23 | stonewall 24 | rw=randread 25 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_RESOURCE_H 2 | #define SYS_RESOURCE_H 3 | 4 | #define RUSAGE_SELF 0 5 | #define RUSAGE_THREAD 1 6 | 7 | struct rusage 8 | { 9 | struct timeval ru_utime; 10 | struct timeval ru_stime; 11 | int ru_nvcsw; 12 | int ru_minflt; 13 | int ru_majflt; 14 | int ru_nivcsw; 15 | }; 16 | 17 | int getrusage(int who, struct rusage *r_usage); 18 | 19 | #endif /* SYS_RESOURCE_H */ 20 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/delete.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | set_vars() 7 | end 8 | 9 | function event(thread_id) 10 | local table_name 11 | table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count) 12 | rs = db_query("DELETE FROM " .. table_name .. " WHERE id=" .. sb_rand(1, oltp_table_size)) 13 | end 14 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyze.sh: -------------------------------------------------------------------------------- 1 | TIMESLOT=1 2 | 3 | if [ -n "$2" ] 4 | then 5 | TIMESLOT=$2 6 | echo "Defined $2" 7 | fi 8 | 9 | cat $1 | grep -v HY000 | grep -v payment | grep -v neword | awk -v timeslot=$TIMESLOT ' BEGIN { FS="[,():]"; s=0; cntr=0; aggr=0 } /MEASURING START/ { s=1} /STOPPING THREADS/ {s=0} /0/ { if (s==1) { cntr++; aggr+=$2; } if ( cntr==timeslot ) { printf ("%d %3f\n",aggr,$5) ; cntr=0; aggr=0 } } ' 10 | 11 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0002-13af05ae-post: -------------------------------------------------------------------------------- 1 | [global] 2 | ioengine=libaio 3 | direct=1 4 | filename=/dev/fioa 5 | iodepth=128 6 | size=1G 7 | loops=1 8 | group_reporting=1 9 | readwrite=read 10 | do_verify=1 11 | verify=md5 12 | verify_fatal=1 13 | numjobs=1 14 | thread 15 | bssplit=512/50:1M/50 16 | 17 | [thread0] 18 | offset=0G 19 | 20 | [thread-mix0] 21 | offset=4G 22 | size=1G 23 | readwrite=rw 24 | bsrange=512:1M 25 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/select.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | set_vars() 7 | end 8 | 9 | function event(thread_id) 10 | local table_name 11 | table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count) 12 | rs = db_query("SELECT pad FROM ".. table_name .." WHERE id=" .. sb_rand(1, oltp_table_size)) 13 | end 14 | 15 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/update_index.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | set_vars() 7 | end 8 | 9 | function event(thread_id) 10 | local table_name 11 | table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count) 12 | rs = db_query("UPDATE ".. table_name .." SET k=k+1 WHERE id=" .. sb_rand(1, oltp_table_size)) 13 | end 14 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/oltp_simple.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | set_vars() 7 | 8 | end 9 | 10 | function event(thread_id) 11 | local table_name 12 | table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count) 13 | 14 | rs = db_query("SELECT c FROM ".. table_name .." WHERE id=" .. sb_rand(1, oltp_table_size)) 15 | end 16 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/flow.fio: -------------------------------------------------------------------------------- 1 | # Example usage of flows. The below will have roughly a 1:8 difference 2 | # between job2 and job1. 3 | [global] 4 | norandommap 5 | thread 6 | time_based 7 | runtime=30 8 | direct=1 9 | ioengine=libaio 10 | iodepth=256 11 | size=100g 12 | bs=8k 13 | filename=/tmp/testfile 14 | flow_watermark=100 15 | flow_sleep=1000 16 | 17 | [job2] 18 | numjobs=1 19 | rw=write 20 | flow=-8 21 | 22 | [job1] 23 | numjobs=1 24 | rw=randread 25 | flow=1 26 | -------------------------------------------------------------------------------- /bench-tools/fio/t/ieee754.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../lib/ieee754.h" 3 | 4 | static double values[] = { -17.23, 17.23, 123.4567, 98765.4321, 0.0 }; 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | uint64_t i; 9 | double f; 10 | int j; 11 | 12 | j = 0; 13 | do { 14 | i = fio_double_to_uint64(values[j]); 15 | f = fio_uint64_to_double(i); 16 | printf("%f -> %f\n", values[j], f); 17 | j++; 18 | } while (values[j] != 0.0); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/fusion-aw-sync.fio: -------------------------------------------------------------------------------- 1 | # Example Job File that randomly writes 8k worth of data atomically for 2 | # 60 seconds. 3 | [rw_aw_file_sync] 4 | rw=randwrite 5 | ioengine=fusion-aw-sync 6 | blocksize=8k 7 | blockalign=8k 8 | 9 | # if file system supports atomic write 10 | filename=/mnt/fs/file 11 | # or test on a direct block device instead 12 | #filename=/dev/fioa 13 | randrepeat=1 14 | fallocate=none 15 | direct=1 16 | invalidate=0 17 | runtime=60 18 | time_based 19 | -------------------------------------------------------------------------------- /bench-tools/fio/filehash.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_FILE_HASH_H 2 | #define FIO_FILE_HASH_H 3 | 4 | extern unsigned int file_hash_size; 5 | 6 | extern void file_hash_init(void *); 7 | extern void file_hash_exit(void); 8 | extern struct fio_file *lookup_file_hash(const char *); 9 | extern struct fio_file *add_file_hash(struct fio_file *); 10 | extern void remove_file_hash(struct fio_file *); 11 | extern void fio_file_hash_lock(void); 12 | extern void fio_file_hash_unlock(void); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /bench-tools/fio/gclient.h: -------------------------------------------------------------------------------- 1 | #ifndef GFIO_CLIENT_H 2 | #define GFIO_CLIENT_H 3 | 4 | extern struct client_ops gfio_client_ops; 5 | 6 | extern void gfio_display_end_results(struct gfio_client *); 7 | 8 | #define GFIO_READ_R 0.13 9 | #define GFIO_READ_G 0.54 10 | #define GFIO_READ_B 0.13 11 | #define GFIO_WRITE_R 1.00 12 | #define GFIO_WRITE_G 0.00 13 | #define GFIO_WRITE_B 0.00 14 | #define GFIO_TRIM_R 0.24 15 | #define GFIO_TRIM_G 0.18 16 | #define GFIO_TRIM_B 0.52 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0003-0ae2c6e1-post.fio: -------------------------------------------------------------------------------- 1 | # Expected result: verify fails. 2 | # Buggy result: fio segfaults 3 | [global] 4 | ioengine=libaio 5 | direct=1 6 | filename=/tmp/foo 7 | iodepth=128 8 | size=1M 9 | loops=1 10 | group_reporting=1 11 | readwrite=read 12 | do_verify=1 13 | verify=md5 14 | verify_fatal=1 15 | numjobs=1 16 | thread 17 | verify_dump=1 18 | bs=4k 19 | 20 | [large_reads] 21 | offset=0G 22 | blocksize=1M 23 | 24 | [small_reads] 25 | offset=1G 26 | blocksize=512 27 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/getopt.h: -------------------------------------------------------------------------------- 1 | #ifdef CONFIG_GETOPT_LONG_ONLY 2 | 3 | #include 4 | 5 | #else 6 | 7 | #ifndef _GETOPT_H 8 | #define _GETOPT_H 9 | 10 | struct option { 11 | const char *name; 12 | int has_arg; 13 | int *flag; 14 | int val; 15 | }; 16 | 17 | enum { 18 | no_argument = 0, 19 | required_argument = 1, 20 | optional_argument = 2, 21 | }; 22 | 23 | int getopt_long_only(int, char *const *, const char *, const struct option *, int *); 24 | 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/strcasestr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strcasestr(const char *s1, const char *s2) 5 | { 6 | const char *s = s1; 7 | const char *p = s2; 8 | 9 | do { 10 | if (!*p) 11 | return (char *) s1; 12 | if ((*p == *s) || 13 | (tolower(*p) == tolower(*s))) { 14 | ++p; 15 | ++s; 16 | } else { 17 | p = s2; 18 | if (!*s) 19 | return NULL; 20 | s = ++s1; 21 | } 22 | } while (1); 23 | 24 | return *p ? NULL : (char *) s1; 25 | } 26 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/netio.fio: -------------------------------------------------------------------------------- 1 | # Example network job, just defines two clients that send/recv data 2 | [global] 3 | ioengine=net 4 | #Use hostname=/tmp.fio.sock for local unix domain sockets 5 | port=8888 6 | #Use =udp for UDP, =unix for local unix domain socket 7 | protocol=tcp 8 | bs=4k 9 | size=100g 10 | #set the below option to enable end-to-end data integrity tests 11 | #verify=md5 12 | 13 | [receiver] 14 | listen 15 | rw=read 16 | 17 | [sender] 18 | hostname=localhost 19 | startdelay=1 20 | rw=write 21 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/uio.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_UIO_H 2 | #define SYS_UIO_H 3 | 4 | #include 5 | #include 6 | 7 | struct iovec 8 | { 9 | void *iov_base; /* Base address of a memory region for input or output */ 10 | size_t iov_len; /* The size of the memory pointed to by iov_base */ 11 | }; 12 | 13 | ssize_t readv(int fildes, const struct iovec *iov, int iovcnt); 14 | ssize_t writev(int fildes, const struct iovec *iov, int iovcnt); 15 | 16 | #endif /* SYS_UIO_H */ 17 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/netio_multicast.fio: -------------------------------------------------------------------------------- 1 | # netio UDP multicast example. Writers and readers can be run on separate hosts. 2 | [global] 3 | ioengine=net 4 | protocol=udp 5 | bs=64 6 | size=100m 7 | # Set interface IP to send/receive traffic through specific network interface 8 | #interface=10.8.16.22 9 | port=10000 10 | hostname=239.0.0.0 11 | ttl=1 12 | 13 | [pingpong_reader] 14 | pingpong=1 15 | rw=read 16 | 17 | [normal_reader] 18 | rw=read 19 | 20 | [pingpong_writer] 21 | startdelay=1 22 | pingpong=1 23 | rw=write 24 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/numa.fio: -------------------------------------------------------------------------------- 1 | ; setup numa policy for each thread 2 | ; 'numactl --show' to determine the maximum numa nodes 3 | [global] 4 | ioengine=libaio 5 | buffered=0 6 | rw=randread 7 | bs=512K 8 | iodepth=16 9 | size=512m 10 | filename=/dev/sdb1 11 | 12 | ; Fix memory blocks (512K * 16) in numa node 0 13 | [job1] 14 | numa_cpu_nodes=0 15 | numa_mem_policy=bind:0 16 | 17 | ; Interleave memory blocks (512K * 16) in numa node 0 and 1 18 | [job2] 19 | numa_cpu_nodes=0-1 20 | numa_mem_policy=interleave:0-1 21 | 22 | -------------------------------------------------------------------------------- /bench-tools/fio/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_HELPERS_H 2 | #define FIO_HELPERS_H 3 | 4 | #include "compiler/compiler.h" 5 | 6 | #include 7 | #include 8 | 9 | extern int fallocate(int fd, int mode, off_t offset, off_t len); 10 | extern int posix_fallocate(int fd, off_t offset, off_t len); 11 | extern int sync_file_range(int fd, off64_t offset, off64_t nbytes, 12 | unsigned int flags); 13 | extern int posix_fadvise(int fd, off_t offset, off_t len, int advice); 14 | 15 | #endif /* FIO_HELPERS_H_ */ 16 | -------------------------------------------------------------------------------- /bench-tools/fio/t/jobs/t0004-8a99fdf6.fio: -------------------------------------------------------------------------------- 1 | # Expected result: fio runs to completion 2 | # Buggy result: fio segfaults 3 | [global] 4 | ioengine=libaio 5 | direct=1 6 | filename=/tmp/foo 7 | iodepth=128 8 | size=10M 9 | loops=1 10 | group_reporting=1 11 | readwrite=write 12 | do_verify=0 13 | verify=md5 14 | numjobs=1 15 | thread 16 | verify_dump=1 17 | 18 | [small_writes] 19 | offset=0G 20 | blocksize=512 21 | verify_interval=1M 22 | 23 | [large_writes] 24 | stonewall 25 | offset=1G 26 | blocksize=1M 27 | verify_interval=512 28 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/strsep.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strsep(char **stringp, const char *delim) 4 | { 5 | char *s, *tok; 6 | const char *spanp; 7 | int c, sc; 8 | 9 | s = *stringp; 10 | if (!s) 11 | return NULL; 12 | 13 | tok = s; 14 | do { 15 | c = *s++; 16 | spanp = delim; 17 | do { 18 | sc = *spanp++; 19 | if (sc == c) { 20 | if (c == 0) 21 | s = NULL; 22 | else 23 | s[-1] = 0; 24 | *stringp = s; 25 | return tok; 26 | } 27 | } while (sc != 0); 28 | } while (1); 29 | } 30 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/surface-scan.fio: -------------------------------------------------------------------------------- 1 | ; writes 512 byte verification blocks until the disk is full, 2 | ; then verifies written data 3 | [global] 4 | thread=1 5 | bs=64k 6 | direct=1 7 | ioengine=sync 8 | verify=meta 9 | verify_pattern=0xaa555aa5 10 | verify_interval=512 11 | 12 | [write-phase] 13 | filename=datafile.tmp ; or use a full disk, for example /dev/sda 14 | rw=write 15 | fill_device=1 16 | do_verify=0 17 | 18 | [verify-phase] 19 | stonewall 20 | create_serialize=0 21 | filename=datafile.tmp 22 | rw=read 23 | do_verify=1 24 | -------------------------------------------------------------------------------- /bench-tools/fio/gettime.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_GETTIME_H 2 | #define FIO_GETTIME_H 3 | 4 | /* 5 | * Clock sources 6 | */ 7 | enum fio_cs { 8 | CS_GTOD = 1, 9 | CS_CGETTIME, 10 | CS_CPUCLOCK, 11 | CS_INVAL, 12 | }; 13 | 14 | extern void fio_gettime(struct timeval *, void *); 15 | extern void fio_gtod_init(void); 16 | extern void fio_clock_init(void); 17 | extern int fio_start_gtod_thread(void); 18 | extern int fio_monotonic_clocktest(void); 19 | extern void fio_local_clock_init(int); 20 | 21 | extern struct timeval *fio_tv; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/dirent.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRENT_H 2 | #define DIRENT_H 3 | 4 | #include 5 | 6 | struct dirent 7 | { 8 | ino_t d_ino; /* File serial number */ 9 | char d_name[MAX_PATH]; /* Name of entry */ 10 | }; 11 | 12 | struct dirent_ctx 13 | { 14 | HANDLE find_handle; 15 | char dirname[MAX_PATH]; 16 | }; 17 | 18 | typedef struct dirent_ctx DIR; 19 | 20 | DIR *opendir(const char *dirname); 21 | struct dirent *readdir(DIR *dirp); 22 | int closedir(DIR *dirp); 23 | 24 | #endif /* DIRENT_H */ 25 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/analyzeR.sh: -------------------------------------------------------------------------------- 1 | TIMESLOT=1 2 | 3 | if [ -n "$2" ] 4 | then 5 | TIMESLOT=$2 6 | echo "Defined $2" 7 | fi 8 | 9 | 10 | for i in 1 2 4 8 16 32 64 11 | do 12 | cat tpcc.par$i.log4G.trx2..out | grep -v HY000 | grep -v payment | grep -v neword | awk -v timeslot=$TIMESLOT -v thr=$i ' BEGIN { FS="[,():]"; s=0; cntr=0; aggr=0 } /MEASURING START/ { s=1} /STOPPING THREADS/ {s=0} /0/ { if (s==1) { cntr++; aggr+=$2; } if ( cntr==timeslot ) { printf ("%d %d %d %3f innodb\n",thr,$1,aggr,$5) ; cntr=0; aggr=0 } } ' 13 | done 14 | 15 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/ieee754.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_IEEE754_H 2 | #define FIO_IEEE754_H 3 | 4 | #include 5 | 6 | extern uint64_t pack754(long double f, unsigned bits, unsigned expbits); 7 | extern long double unpack754(uint64_t i, unsigned bits, unsigned expbits); 8 | 9 | #define fio_double_to_uint64(val) pack754((val), 64, 11) 10 | #define fio_uint64_to_double(val) unpack754((val), 64, 11) 11 | 12 | typedef struct fio_fp64 { 13 | union { 14 | uint64_t i; 15 | double f; 16 | uint8_t filler[16]; 17 | } u; 18 | } fio_fp64_t; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/iometer-file-access-server.fio: -------------------------------------------------------------------------------- 1 | # This job file tries to mimic the Intel IOMeter File Server Access Pattern 2 | [global] 3 | description=Emulation of Intel IOmeter File Server Access Pattern 4 | 5 | [iometer] 6 | bssplit=512/10:1k/5:2k/5:4k/60:8k/2:16k/4:32k/4:64k/10 7 | rw=randrw 8 | rwmixread=80 9 | direct=1 10 | size=4g 11 | ioengine=libaio 12 | # IOMeter defines the server loads as the following: 13 | # iodepth=1 Linear 14 | # iodepth=4 Very Light 15 | # iodepth=8 Light 16 | # iodepth=64 Moderate 17 | # iodepth=256 Heavy 18 | iodepth=64 19 | -------------------------------------------------------------------------------- /bench-tools/sysbench/doc/xsl/xhtml.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/load.sh: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql/ 2 | DBNAME=$1 3 | WH=$2 4 | HOST=localhost 5 | STEP=100 6 | 7 | ./tpcc_load $HOST $DBNAME root "" $WH 1 1 $WH >> 1.out & 8 | 9 | x=1 10 | 11 | while [ $x -le $WH ] 12 | do 13 | echo $x $(( $x + $STEP - 1 )) 14 | ./tpcc_load $HOST $DBNAME root "" $WH 2 $x $(( $x + $STEP - 1 )) >> 2_$x.out & 15 | ./tpcc_load $HOST $DBNAME root "" $WH 3 $x $(( $x + $STEP - 1 )) >> 3_$x.out & 16 | ./tpcc_load $HOST $DBNAME root "" $WH 4 $x $(( $x + $STEP - 1 )) >> 4_$x.out & 17 | x=$(( $x + $STEP )) 18 | done 19 | 20 | -------------------------------------------------------------------------------- /bench-tools/fio/REPORTING-BUGS: -------------------------------------------------------------------------------- 1 | Reporting a bug 2 | --------------- 3 | 4 | If you notice anything that seems like a fio bug, please do send email 5 | to the list (fio@vger.kernel.org, see README) about it. You'll need 6 | to report at least: 7 | 8 | 1) A description of what you think the bug is 9 | 2) Environment (Linux distro version, kernel version). This is mostly 10 | needed if it's a build bug. 11 | 3) The output from fio --version. 12 | 4) How to reproduce. Please include a full list of the parameters 13 | passed to fio and the job file used (if any). 14 | 15 | That's it! 16 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/arpa/inet.h: -------------------------------------------------------------------------------- 1 | #ifndef ARPA_INET_H 2 | #define ARPA_INET_H 3 | 4 | #include 5 | #include 6 | 7 | typedef int socklen_t; 8 | typedef int in_addr_t; 9 | 10 | /* EAI_SYSTEM isn't used on Windows, so map it to EAI_FAIL */ 11 | #define EAI_SYSTEM EAI_FAIL 12 | 13 | in_addr_t inet_network(const char *cp); 14 | 15 | const char *inet_ntop(int af, const void *restrict src, 16 | char *restrict dst, socklen_t size); 17 | int inet_pton(int af, const char *restrict src, void *restrict dst); 18 | 19 | #endif /* ARPA_INET_H */ 20 | -------------------------------------------------------------------------------- /bench-tools/fio/debug.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "debug.h" 5 | 6 | #ifdef FIO_INC_DEBUG 7 | void __dprint(int type, const char *str, ...) 8 | { 9 | va_list args; 10 | pid_t pid; 11 | 12 | assert(type < FD_DEBUG_MAX); 13 | 14 | pid = getpid(); 15 | if (fio_debug_jobp && *fio_debug_jobp != -1U 16 | && pid != *fio_debug_jobp) 17 | return; 18 | 19 | log_info("%-8s ", debug_levels[type].name); 20 | log_info("%-5u ", (int) pid); 21 | 22 | va_start(args, str); 23 | log_valist(str, args); 24 | va_end(args); 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/parallel_prepare.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | local index_name 7 | local i 8 | set_vars() 9 | 10 | print("thread prepare"..thread_id) 11 | 12 | if (oltp_secondary) then 13 | index_name = "KEY xid" 14 | else 15 | index_name = "PRIMARY KEY" 16 | end 17 | 18 | for i=thread_id+1, oltp_tables_count, num_threads do 19 | create_insert(i) 20 | end 21 | 22 | end 23 | 24 | function event(thread_id) 25 | 26 | end 27 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_SHA1 2 | #define FIO_SHA1 3 | 4 | /* 5 | * Based on the Mozilla SHA1 (see mozilla-sha1/sha1.h), 6 | * optimized to do word accesses rather than byte accesses, 7 | * and to avoid unnecessary copies into the context array. 8 | */ 9 | 10 | struct fio_sha1_ctx { 11 | uint32_t *H; 12 | unsigned int W[16]; 13 | unsigned long long size; 14 | }; 15 | 16 | void fio_sha1_init(struct fio_sha1_ctx *); 17 | void fio_sha1_update(struct fio_sha1_ctx *, const void *dataIn, unsigned long len); 18 | void fio_sha1_final(unsigned char hashout[20], struct fio_sha1_ctx *); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/latency-profile.fio: -------------------------------------------------------------------------------- 1 | # Test job that demonstrates how to use the latency target 2 | # profiling. Fio will find the queue depth between 1..128 3 | # that fits within the latency constraints of this 4k random 4 | # read workload. 5 | 6 | [global] 7 | bs=4k 8 | rw=randread 9 | random_generator=lfsr 10 | direct=1 11 | ioengine=libaio 12 | iodepth=128 13 | # Set max acceptable latency to 500msec 14 | latency_target=500000 15 | # profile over a 5s window 16 | latency_window=5000000 17 | # 99.9% of IOs must be below the target 18 | latency_percentile=99.9 19 | 20 | [device] 21 | filename=/dev/sda 22 | -------------------------------------------------------------------------------- /bench-tools/fio/tools/plot/samples/Makefile: -------------------------------------------------------------------------------- 1 | all: clean m2sw1-128k-sdb-randwrite-para.results_bw.log io bandwidth 2 | 3 | m2sw1-128k-sdb-randwrite-para.results_bw.log: 4 | tar -xf fio-logs.tar.gz 5 | 6 | io: setup 7 | ./fio2gnuplot.py -p 'm2sw1-128k-*-read-para*iops.log' -g 8 | 9 | bandwidth: setup 10 | ./fio2gnuplot.py -p 'm2sw1-128k-*-read-para*bw.log' -g 11 | 12 | setup: 13 | ln -sf ../*py ../*gpm . 14 | 15 | clean: 16 | rm -rf *png mygraph mymath *py *gpm gnuplot_temp_file* *~ 17 | rm -rf *.average *.stddev *.min *.max *.global 18 | rm -rf m2sw1-128k-read-para-bw m2sw1-128k-read-para-iops 19 | rm -rf *log 20 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-alpha.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_ALPHA_H 2 | #define ARCH_ALPHA_H 3 | 4 | #define FIO_ARCH (arch_alpha) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 442 8 | #define __NR_ioprio_get 443 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 413 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 468 17 | #define __NR_sys_tee 470 18 | #define __NR_sys_vmsplice 471 19 | #endif 20 | 21 | #define nop do { } while (0) 22 | #define read_barrier() __asm__ __volatile__("mb": : :"memory") 23 | #define write_barrier() __asm__ __volatile__("wmb": : :"memory") 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-hppa.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_HPPA_H 2 | #define ARCH_HPPA_H 3 | 4 | #define FIO_ARCH (arch_hppa) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 267 8 | #define __NR_ioprio_get 268 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 236 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 291 17 | #define __NR_sys_tee 293 18 | #define __NR_sys_vmsplice 294 19 | #endif 20 | 21 | #define nop do { } while (0) 22 | 23 | #define read_barrier() __asm__ __volatile__ ("" : : : "memory") 24 | #define write_barrier() __asm__ __volatile__ ("" : : : "memory") 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-sparc.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_SPARC_H 2 | #define ARCH_SPARC_H 3 | 4 | #define FIO_ARCH (arch_sparc) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 196 8 | #define __NR_ioprio_get 218 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 209 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 232 17 | #define __NR_sys_tee 280 18 | #define __NR_sys_vmsplice 25 19 | #endif 20 | 21 | #define nop do { } while (0) 22 | 23 | #define read_barrier() __asm__ __volatile__ ("" : : : "memory") 24 | #define write_barrier() __asm__ __volatile__ ("" : : : "memory") 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/zipf.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_ZIPF_H 2 | #define FIO_ZIPF_H 3 | 4 | #include 5 | #include "rand.h" 6 | 7 | struct zipf_state { 8 | uint64_t nranges; 9 | double theta; 10 | double zeta2; 11 | double zetan; 12 | double pareto_pow; 13 | struct frand_state rand; 14 | uint64_t rand_off; 15 | }; 16 | 17 | void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta, unsigned int seed); 18 | unsigned long long zipf_next(struct zipf_state *zs); 19 | 20 | void pareto_init(struct zipf_state *zs, unsigned long nranges, double h, unsigned int seed); 21 | unsigned long long pareto_next(struct zipf_state *zs); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-mips.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_MIPS64_H 2 | #define ARCH_MIPS64_H 3 | 4 | #define FIO_ARCH (arch_mips) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 314 8 | #define __NR_ioprio_get 315 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 215 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 263 17 | #define __NR_sys_tee 265 18 | #define __NR_sys_vmsplice 266 19 | #endif 20 | 21 | #define read_barrier() __asm__ __volatile__("": : :"memory") 22 | #define write_barrier() __asm__ __volatile__("": : :"memory") 23 | #define nop __asm__ __volatile__("": : :"memory") 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/spt_proc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spt_proc.pc 3 | * support routines for the proc tpcc implementation 4 | */ 5 | 6 | #include 7 | 8 | #include 9 | 10 | /* 11 | * report error 12 | */ 13 | int error( 14 | MYSQL *mysql, 15 | MYSQL_STMT *mysql_stmt 16 | ) 17 | { 18 | /* 19 | if(mysql_stmt) { 20 | printf("\n%d, %s, %s", mysql_stmt_errno(mysql_stmt), 21 | mysql_stmt_sqlstate(mysql_stmt), mysql_stmt_error(mysql_stmt) ); 22 | } 23 | */ 24 | if(mysql){ 25 | fprintf(stderr, "%d, %s, %s\n", mysql_errno(mysql), mysql_sqlstate(mysql), mysql_error(mysql) ); 26 | } 27 | return (0); 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/axmap.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_BITMAP_H 2 | #define FIO_BITMAP_H 3 | 4 | #include 5 | 6 | struct axmap; 7 | struct axmap *axmap_new(unsigned long nr_bits); 8 | void axmap_free(struct axmap *bm); 9 | 10 | void axmap_clear(struct axmap *axmap, uint64_t bit_nr); 11 | void axmap_set(struct axmap *axmap, uint64_t bit_nr); 12 | unsigned int axmap_set_nr(struct axmap *axmap, uint64_t bit_nr, unsigned int nr_bits); 13 | int axmap_isset(struct axmap *axmap, uint64_t bit_nr); 14 | uint64_t axmap_first_free(struct axmap *axmap); 15 | uint64_t axmap_next_free(struct axmap *axmap, uint64_t bit_nr); 16 | void axmap_reset(struct axmap *axmap); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /bench-tools/fio/cairo_text_helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef CAIRO_TEXT_HELPERS_H 2 | #define CAIRO_TEXT_HELPERS_H 3 | 4 | void draw_centered_text(cairo_t *cr, const char *font, double x, double y, 5 | double fontsize, const char *text); 6 | 7 | void draw_right_justified_text(cairo_t *cr, const char *font, 8 | double x, double y, 9 | double fontsize, const char *text); 10 | 11 | void draw_left_justified_text(cairo_t *cr, const char *font, 12 | double x, double y, 13 | double fontsize, const char *text); 14 | 15 | void draw_vertical_centered_text(cairo_t *cr, const char *font, double x, 16 | double y, double fontsize, 17 | const char *text); 18 | #endif 19 | -------------------------------------------------------------------------------- /bench-tools/fio/compiler/compiler.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_COMPILER_H 2 | #define FIO_COMPILER_H 3 | 4 | #if __GNUC__ >= 4 5 | #include "compiler-gcc4.h" 6 | #elif __GNUC__ == 3 7 | #include "compiler-gcc3.h" 8 | #else 9 | #error Compiler too old, need gcc at least gcc 3.x 10 | #endif 11 | 12 | #ifndef __must_check 13 | #define __must_check 14 | #endif 15 | 16 | /* 17 | * Mark unused variables passed to ops functions as unused, to silence gcc 18 | */ 19 | #define fio_unused __attribute__((__unused__)) 20 | #define fio_init __attribute__((constructor)) 21 | #define fio_exit __attribute__((destructor)) 22 | 23 | #define fio_unlikely(x) __builtin_expect(!!(x), 0) 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/update_non_index.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | set_vars() 7 | end 8 | 9 | function event(thread_id) 10 | local table_name 11 | local c_val 12 | local query 13 | table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count) 14 | c_val = sb_rand_str("###########-###########-###########-###########-###########-###########-###########-###########-###########-###########") 15 | query = "UPDATE " .. table_name .. " SET c='" .. c_val .. "' WHERE id=" .. sb_rand(1, oltp_table_size) 16 | rs = db_query(query) 17 | end 18 | -------------------------------------------------------------------------------- /bench-tools/fio/engines/gfapi.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../fio.h" 3 | 4 | struct gf_options { 5 | struct thread_data *td; 6 | char *gf_vol; 7 | char *gf_brick; 8 | }; 9 | 10 | struct gf_data { 11 | glfs_t *fs; 12 | glfs_fd_t *fd; 13 | struct io_u **aio_events; 14 | }; 15 | 16 | extern struct fio_option gfapi_options[]; 17 | extern int fio_gf_setup(struct thread_data *td); 18 | extern void fio_gf_cleanup(struct thread_data *td); 19 | extern int fio_gf_get_file_size(struct thread_data *td, struct fio_file *f); 20 | extern int fio_gf_open_file(struct thread_data *td, struct fio_file *f); 21 | extern int fio_gf_close_file(struct thread_data *td, struct fio_file *f); 22 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/rbd.fio: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Example test for the RBD engine. 3 | # 4 | # Runs a 4k random write test agains a RBD via librbd 5 | # 6 | # NOTE: Make sure you have either a RBD named 'fio_test' or change 7 | # the rbdname parameter. 8 | ###################################################################### 9 | [global] 10 | #logging 11 | #write_iops_log=write_iops_log 12 | #write_bw_log=write_bw_log 13 | #write_lat_log=write_lat_log 14 | ioengine=rbd 15 | clientname=admin 16 | pool=rbd 17 | rbdname=fio_test 18 | invalidate=0 # mandatory 19 | rw=randwrite 20 | bs=4k 21 | 22 | [rbd_iodepth32] 23 | iodepth=32 24 | -------------------------------------------------------------------------------- /bench-tools/fio/cgroup.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_CGROUP_H 2 | #define FIO_CGROUP_H 3 | 4 | #ifdef FIO_HAVE_CGROUPS 5 | 6 | int cgroup_setup(struct thread_data *, struct flist_head *, char **); 7 | void cgroup_shutdown(struct thread_data *, char **); 8 | 9 | void cgroup_kill(struct flist_head *list); 10 | 11 | #else 12 | 13 | static inline int cgroup_setup(struct thread_data *td, struct flist_head *list, 14 | char **mnt) 15 | { 16 | td_verror(td, EINVAL, "cgroup_setup"); 17 | return 1; 18 | } 19 | 20 | static inline void cgroup_shutdown(struct thread_data *td, char **mnt) 21 | { 22 | } 23 | 24 | static inline void cgroup_kill(struct flist_head *list) 25 | { 26 | } 27 | 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /bench-tools/fio/log.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_LOG_H 2 | #define FIO_LOG_H 3 | 4 | #include 5 | #include 6 | 7 | extern FILE *f_out; 8 | extern FILE *f_err; 9 | 10 | extern int log_err(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 11 | extern int log_info(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 12 | extern int log_valist(const char *str, va_list); 13 | extern int log_local_buf(const char *buf, size_t); 14 | extern int log_info_flush(void); 15 | 16 | enum { 17 | FIO_LOG_DEBUG = 1, 18 | FIO_LOG_INFO = 2, 19 | FIO_LOG_ERR = 3, 20 | FIO_LOG_NR = 4, 21 | }; 22 | 23 | extern const char *log_get_level(int level); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/lfsr.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_LFSR_H 2 | #define FIO_LFSR_H 3 | 4 | #include 5 | 6 | #define FIO_MAX_TAPS 6 7 | 8 | struct lfsr_taps { 9 | unsigned int length; 10 | unsigned int taps[FIO_MAX_TAPS]; 11 | }; 12 | 13 | 14 | struct fio_lfsr { 15 | uint64_t xormask; 16 | uint64_t last_val; 17 | uint64_t cached_bit; 18 | uint64_t max_val; 19 | uint64_t num_vals; 20 | uint64_t cycle_length; 21 | uint64_t cached_cycle_length; 22 | unsigned int spin; 23 | }; 24 | 25 | int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t); 26 | int lfsr_init(struct fio_lfsr *fl, uint64_t size, 27 | unsigned long seed, unsigned int spin); 28 | int lfsr_reset(struct fio_lfsr *fl, unsigned long seed); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/e4defrag.fio: -------------------------------------------------------------------------------- 1 | [global] 2 | ioengine=e4defrag 3 | directory=/scratch 4 | nrfiles=1 5 | filesize=100M 6 | size=100M 7 | bs=32k 8 | #group_reporting 9 | 10 | [isolated-e4defrag] 11 | # It is important to disable buffered io 12 | buffered=0 13 | donorname=file.def 14 | filename=file1 15 | inplace=0 16 | rw=write 17 | 18 | # Run e4defrag and aio-dio workers in parallel 19 | [e4defrag] 20 | stonewall 21 | time_based=30 22 | runtime=30 23 | ioengine=e4defrag 24 | buffered=0 25 | donorname=file.def 26 | filename=file1 27 | inplace=0 28 | rw=write 29 | 30 | [random-aio-32k] 31 | ioengine=libaio 32 | runtime=30 33 | verify=md5 34 | direct=1 35 | bs=64k 36 | iodepth=128 37 | filename=file1 38 | rw=randrw 39 | numjobs=4 40 | 41 | 42 | -------------------------------------------------------------------------------- /bench-tools/fio/t/log.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../minmax.h" 4 | 5 | int log_err(const char *format, ...) 6 | { 7 | char buffer[1024]; 8 | va_list args; 9 | size_t len; 10 | 11 | va_start(args, format); 12 | len = vsnprintf(buffer, sizeof(buffer), format, args); 13 | va_end(args); 14 | len = min(len, sizeof(buffer) - 1); 15 | 16 | return fwrite(buffer, len, 1, stderr); 17 | } 18 | 19 | int log_info(const char *format, ...) 20 | { 21 | char buffer[1024]; 22 | va_list args; 23 | size_t len; 24 | 25 | va_start(args, format); 26 | len = vsnprintf(buffer, sizeof(buffer), format, args); 27 | va_end(args); 28 | len = min(len, sizeof(buffer) - 1); 29 | 30 | return fwrite(buffer, len, 1, stdout); 31 | } 32 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/ffz.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_FFZ_H 2 | #define FIO_FFZ_H 3 | 4 | static inline int __ffs(unsigned long word) 5 | { 6 | int r = 0; 7 | 8 | #if BITS_PER_LONG == 64 9 | if ((word & 0xffffffff) == 0) { 10 | r += 32; 11 | word >>= 32; 12 | } 13 | #endif 14 | if (!(word & 0xffff)) { 15 | word >>= 16; 16 | r += 16; 17 | } 18 | if (!(word & 0xff)) { 19 | word >>= 8; 20 | r += 8; 21 | } 22 | if (!(word & 0xf)) { 23 | word >>= 4; 24 | r += 4; 25 | } 26 | if (!(word & 3)) { 27 | word >>= 2; 28 | r += 2; 29 | } 30 | if (!(word & 1)) { 31 | word >>= 1; 32 | r += 1; 33 | } 34 | 35 | return r; 36 | } 37 | 38 | static inline int ffz(unsigned long bitmask) 39 | { 40 | return __ffs(~bitmask); 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # "make all" to build necessary executables. 3 | # 4 | 5 | 6 | 7 | LIBS= `mysql_config --libs_r` -lrt 8 | 9 | INC= -I. `mysql_config --include` 10 | 11 | #DEFS= -DDEBUG 12 | 13 | CFLAGS= -w -O2 -g 14 | 15 | TRANSACTIONS= neword.o payment.o ordstat.o delivery.o slev.o 16 | OBJS= main.o spt_proc.o driver.o support.o sequence.o rthist.o $(TRANSACTIONS) 17 | 18 | .SUFFIXES: 19 | .SUFFIXES: .o .c 20 | 21 | .c.o: 22 | $(CC) $(CFLAGS) $(INC) $(DEFS) -c $*.c 23 | 24 | all: ../tpcc_load ../tpcc_start 25 | 26 | ../tpcc_load : load.o support.o 27 | $(CC) load.o support.o $(LIBS) -o ../tpcc_load 28 | 29 | ../tpcc_start : $(OBJS) 30 | $(CC) $(OBJS) $(LIBS) -o ../tpcc_start 31 | 32 | clean : 33 | rm -f *.o 34 | -------------------------------------------------------------------------------- /bench-tools/sysbench/doc/xsl/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef MD5_H 2 | #define MD5_H 3 | 4 | #include 5 | 6 | #define MD5_DIGEST_SIZE 16 7 | #define MD5_HMAC_BLOCK_SIZE 64 8 | #define MD5_BLOCK_WORDS 16 9 | #define MD5_HASH_WORDS 4 10 | 11 | #define F1(x, y, z) (z ^ (x & (y ^ z))) 12 | #define F2(x, y, z) F1(z, x, y) 13 | #define F3(x, y, z) (x ^ y ^ z) 14 | #define F4(x, y, z) (y ^ (x | ~z)) 15 | 16 | #define MD5STEP(f, w, x, y, z, in, s) \ 17 | (w += f(x, y, z) + in, w = (w<>(32-s)) + x) 18 | 19 | struct fio_md5_ctx { 20 | uint32_t *hash; 21 | uint32_t block[MD5_BLOCK_WORDS]; 22 | uint64_t byte_count; 23 | }; 24 | 25 | extern void fio_md5_update(struct fio_md5_ctx *, const uint8_t *, unsigned int); 26 | extern void fio_md5_init(struct fio_md5_ctx *); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/parse_port.h: -------------------------------------------------------------------------------- 1 | inline void parse_host(char* host, const char* from) 2 | { 3 | const char* port= rindex(from,':'); 4 | size_t length; 5 | if(NULL == port) 6 | length= strlen(from); 7 | else 8 | length= (port - from); 9 | memcpy(host,from, length); 10 | host[length] = '\0'; 11 | } 12 | inline int parse_port(const char* from) 13 | { 14 | const char* port= rindex(from,':'); 15 | if(NULL == port) 16 | return 3306; 17 | else 18 | { 19 | const char* end= NULL; 20 | int result= strtol(port+1,&end,10); 21 | if( (0 == *end) && (0 <= result) && (result <= 0xFFFF) ) 22 | return result; 23 | else 24 | { 25 | printf(stderr,"Incorrect port value: %s\n",end); 26 | exit(-1); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bench-tools/sysbench/m4/ac_lua_devel.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: AC_LUA_DEVEL 3 | dnl --------------------------------------------------------------------------- 4 | AC_DEFUN([AC_LUA_DEVEL],[ 5 | 6 | AC_ARG_WITH(lua, 7 | AC_HELP_STRING([--with-lua],[Compile with Lua scripting support (default is enabled)]), 8 | [ac_cv_use_lua="$with_lua"], [ac_cv_use_lua="yes"]) 9 | AC_CACHE_CHECK([whether to compile with Lua support], [ac_cv_use_lua], [ac_cv_use_lua=no]) 10 | 11 | if test "x$ac_cv_use_lua" != "xno"; then 12 | 13 | AC_DEFINE(HAVE_LUA, 1, [Define to 1 if you have Lua headers and libraries]) 14 | 15 | fi 16 | 17 | AM_CONDITIONAL(USE_LUA, test "x$ac_cv_use_lua" != "xno") 18 | ]) 19 | 20 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/crc16.h: -------------------------------------------------------------------------------- 1 | /* 2 | * crc16.h - CRC-16 routine 3 | * 4 | * Implements the standard CRC-16: 5 | * Width 16 6 | * Poly 0x8005 (x^16 + x^15 + x^2 + 1) 7 | * Init 0 8 | * 9 | * Copyright (c) 2005 Ben Gardner 10 | * 11 | * This source code is licensed under the GNU General Public License, 12 | * Version 2. See the file COPYING for more details. 13 | */ 14 | 15 | #ifndef __CRC16_H 16 | #define __CRC16_H 17 | 18 | extern unsigned short const crc16_table[256]; 19 | 20 | extern unsigned short fio_crc16(const void *buffer, unsigned int len); 21 | 22 | static inline unsigned short crc16_byte(unsigned short crc, 23 | const unsigned char data) 24 | { 25 | return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff]; 26 | } 27 | 28 | #endif /* __CRC16_H */ 29 | -------------------------------------------------------------------------------- /bench-tools/script/wubx/tpcc_mysql/run1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DBIP="192.168.143.171" 3 | DBPORT="5617" 4 | DBNAME="tpcc2000" 5 | DBUSER="admin" 6 | DBPASS="admin" 7 | WIREHOUSE=2000 8 | WARMUP=180 9 | DURUNING=3600 10 | 11 | for THREADS in 8 16 32 64 128 256 512 12 | do 13 | NOW=`date +'%Y%m%d%H%M'` 14 | ./tpcc_start -h $DBIP -P $DBPORT -d $DBNAME -u $DBUSER -p"${DBPASS}" -w $WIREHOUSE -c $THREADS -r $WARMUP -l $DURUNING -f ./logs/tpcc_${NOW}_${THREADS}_THREADS.res >>./logs/tpcc_runlog_${NOW}_${THREADS}_THREADS 2>&1 15 | sleep 60 16 | #mysql -h192.168.143.171 -P5617 -uadmin -padmin -e "set global innodb_max_dirty_pages_pct=0;set global innodb_max_dirty_pages_pct=90;" 17 | #ssh $DBIP mysqladmin -S /tmp/mysql.socket shutdown;/u1/mysql/start.sh 18 | sleep 60 19 | done 20 | -------------------------------------------------------------------------------- /bench-tools/script/wubx/fio/daosen-mysql-test: -------------------------------------------------------------------------------- 1 | [global] 2 | runtime=172800 3 | time_based 4 | group_reporting 5 | directory=/data 6 | ioscheduler=deadline 7 | refill_buffers 8 | 9 | [binlog] 10 | filename=daosen-mysql-bin.log 11 | bsrange=512-1024 12 | ioengine=sync 13 | rw=write 14 | size=30G 15 | sync=1 16 | rw=write 17 | overwrite=1 18 | fsync=100 19 | rate_iops=64 20 | invalidate=1 21 | numjobs=64 22 | 23 | [innodb-data] 24 | filename=daosen-innodb.dat 25 | bs=16K 26 | ioengine=psync 27 | rw=randrw 28 | size=200G 29 | direct=1 30 | rwmixread=80 31 | numjobs=32 32 | 33 | thinktime=600 34 | thinktime_spin=200 35 | thinktime_blocks=2 36 | 37 | [innodb-log] 38 | filename=daosen-innodb.log 39 | bs=512 40 | ioengine=sync 41 | rw=write 42 | size=2G 43 | fsync=1 44 | overwrite=1 45 | invalidate=1 46 | numjobs=64 47 | -------------------------------------------------------------------------------- /bench-tools/fio/fio_time.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_TIME_H 2 | #define FIO_TIME_H 3 | 4 | extern uint64_t utime_since(struct timeval *, struct timeval *); 5 | extern uint64_t utime_since_now(struct timeval *); 6 | extern uint64_t mtime_since(struct timeval *, struct timeval *); 7 | extern uint64_t mtime_since_now(struct timeval *); 8 | extern uint64_t time_since_now(struct timeval *); 9 | extern uint64_t mtime_since_genesis(void); 10 | extern uint64_t utime_since_genesis(void); 11 | extern void usec_spin(unsigned int); 12 | extern void usec_sleep(struct thread_data *, unsigned long); 13 | extern void fill_start_time(struct timeval *); 14 | extern void set_genesis_time(void); 15 | extern int ramp_time_over(struct thread_data *); 16 | extern int in_ramp_time(struct thread_data *); 17 | extern void fio_time_init(void); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-sparc64.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_SPARC64_H 2 | #define ARCH_SPARC64_H 3 | 4 | #define FIO_ARCH (arch_sparc64) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 196 8 | #define __NR_ioprio_get 218 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 209 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 232 17 | #define __NR_sys_tee 280 18 | #define __NR_sys_vmsplice 25 19 | #endif 20 | 21 | #define nop do { } while (0) 22 | 23 | #define membar_safe(type) \ 24 | do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ 25 | " membar " type "\n" \ 26 | "1:\n" \ 27 | : : : "memory"); \ 28 | } while (0) 29 | 30 | #define read_barrier() membar_safe("#LoadLoad") 31 | #define write_barrier() membar_safe("#StoreStore") 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/dobuild.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | set /a counter=1 4 | for /f "tokens=3" %%i in (..\..\FIO-VERSION-FILE) do ( 5 | if "!counter!"=="1" set FIO_VERSION=%%i 6 | set /a counter+=1 7 | ) 8 | 9 | if "%1"=="x86" set FIO_ARCH=x86 10 | if "%1"=="x64" set FIO_ARCH=x64 11 | 12 | if not defined FIO_ARCH ( 13 | echo Error: must specify the architecture. 14 | echo Usage: dobuild x86 15 | echo Usage: dobuild x64 16 | goto end 17 | ) 18 | 19 | "%WIX%bin\candle" -nologo -arch %FIO_ARCH% install.wxs 20 | @if ERRORLEVEL 1 goto end 21 | "%WIX%bin\candle" -nologo -arch %FIO_ARCH% examples.wxs 22 | @if ERRORLEVEL 1 goto end 23 | "%WIX%bin\light" -nologo -sice:ICE61 install.wixobj examples.wixobj -ext WixUIExtension -out %FIO_VERSION%-%FIO_ARCH%.msi 24 | :end 25 | -------------------------------------------------------------------------------- /bench-tools/fio/tools/plot/math.gpm: -------------------------------------------------------------------------------- 1 | # This Gnuplot file has been generated by eNovance 2 | 3 | set title '$0' 4 | 5 | set terminal png size 1280,1024 6 | set output '$3.png' 7 | 8 | set palette rgbformulae 7,5,15 9 | set style line 100 lt 7 lw 0.5 10 | set style fill transparent solid 0.9 noborder 11 | set auto x 12 | set ylabel '$4' 13 | set xlabel "Disk" 14 | set yrange [0:] 15 | set style data histogram 16 | set style histogram cluster gap 1 17 | set style fill solid border -1 18 | set boxwidth 2 19 | #set xtic rotate by -10 scale 10 font ",8" 20 | set bmargin 3 21 | set xtics axis out 22 | set xtic rotate by 45 scale 0 font ",8" autojustify 23 | set xtics offset 0,-1 border -5,1,5 24 | set style line 1 lt 1 lw 3 pt 3 linecolor rgb "green" 25 | plot '$1' using 2:xtic(1) ti col, $5 w l ls 1 ti 'Global average value ($5)' 26 | -------------------------------------------------------------------------------- /bench-tools/sysbench/doc/xsl/catalog.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | @CAT_ENTRY_START@ 9 | 11 | 13 | @CAT_ENTRY_END@ 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/trans_if.h: -------------------------------------------------------------------------------- 1 | /* 2 | * trans_if.h 3 | * 4 | * prototypes for the transaction interface calls 5 | */ 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | int driver (int t_num); 12 | int neword (int t_num, int w_id_arg, int d_id_arg, int c_id_arg, 13 | int o_ol_cnt_arg, int o_all_local_arg, int itemid[], 14 | int supware[], int qty[]); 15 | int payment (int t_num, int w_id_arg, int d_id_arg, int byname, 16 | int c_w_id_arg, int c_d_id_arg, 17 | int c_id_arg, char c_last_arg[], float h_amount_arg); 18 | int ordstat (int t_num, int w_id, int d_id, int byname, int c_id, 19 | char c_last[]); 20 | int slev (int t_num, int w_id, int d_id, int level); 21 | int delivery (int t_num, int w_id_arg, int o_carrier_id_arg); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | -------------------------------------------------------------------------------- /bench-tools/sysbench/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # Generated from ltversion.in. 11 | 12 | # serial 3017 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.2.6b]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3017]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.2.6b' 20 | macro_revision='1.3017' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/fls.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_GENERIC_BITOPS_FLS_H_ 2 | #define _ASM_GENERIC_BITOPS_FLS_H_ 3 | 4 | /** 5 | * fls - find last (most-significant) bit set 6 | * @x: the word to search 7 | * 8 | * This is defined the same way as ffs. 9 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. 10 | */ 11 | 12 | static inline int __fls(int x) 13 | { 14 | int r = 32; 15 | 16 | if (!x) 17 | return 0; 18 | if (!(x & 0xffff0000u)) { 19 | x <<= 16; 20 | r -= 16; 21 | } 22 | if (!(x & 0xff000000u)) { 23 | x <<= 8; 24 | r -= 8; 25 | } 26 | if (!(x & 0xf0000000u)) { 27 | x <<= 4; 28 | r -= 4; 29 | } 30 | if (!(x & 0xc0000000u)) { 31 | x <<= 2; 32 | r -= 2; 33 | } 34 | if (!(x & 0x80000000u)) { 35 | x <<= 1; 36 | r -= 1; 37 | } 38 | return r; 39 | } 40 | 41 | #endif /* _ASM_GENERIC_BITOPS_FLS_H_ */ 42 | -------------------------------------------------------------------------------- /bench-tools/fio/memalign.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "memalign.h" 6 | 7 | struct align_footer { 8 | unsigned int offset; 9 | }; 10 | 11 | #define PTR_ALIGN(ptr, mask) \ 12 | (char *) (((uintptr_t) ((ptr) + (mask)) & ~(mask))) 13 | 14 | void *fio_memalign(size_t alignment, size_t size) 15 | { 16 | struct align_footer *f; 17 | void *ptr, *ret = NULL; 18 | 19 | assert(!(alignment & (alignment - 1))); 20 | 21 | ptr = malloc(size + alignment + size + sizeof(*f) - 1); 22 | if (ptr) { 23 | ret = PTR_ALIGN(ptr, alignment); 24 | f = ret + size; 25 | f->offset = (uintptr_t) ret - (uintptr_t) ptr; 26 | } 27 | 28 | return ret; 29 | } 30 | 31 | void fio_memfree(void *ptr, size_t size) 32 | { 33 | struct align_footer *f = ptr + size; 34 | 35 | free(ptr - f->offset); 36 | } 37 | -------------------------------------------------------------------------------- /bench-tools/fio/td_error.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_TD_ERROR_H 2 | #define FIO_TD_ERROR_H 3 | 4 | /* 5 | * What type of errors to continue on when continue_on_error is used 6 | */ 7 | enum error_type_bit { 8 | ERROR_TYPE_READ_BIT = 0, 9 | ERROR_TYPE_WRITE_BIT = 1, 10 | ERROR_TYPE_VERIFY_BIT = 2, 11 | ERROR_TYPE_CNT = 3, 12 | }; 13 | 14 | enum error_type { 15 | ERROR_TYPE_NONE = 0, 16 | ERROR_TYPE_READ = 1 << ERROR_TYPE_READ_BIT, 17 | ERROR_TYPE_WRITE = 1 << ERROR_TYPE_WRITE_BIT, 18 | ERROR_TYPE_VERIFY = 1 << ERROR_TYPE_VERIFY_BIT, 19 | ERROR_TYPE_ANY = 0xffff, 20 | }; 21 | 22 | enum error_type_bit td_error_type(enum fio_ddir ddir, int err); 23 | int td_non_fatal_error(struct thread_data *td, enum error_type_bit etype, 24 | int err); 25 | void update_error_count(struct thread_data *td, int err); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /bench-tools/sysbench/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | XSLTPROC=xsltproc 2 | XSLTPROC_FLAGS=@XSLTPROC_FLAGS@ 3 | XHTML_STYLESHEET=$(srcdir)/xsl/xhtml.xsl 4 | CHUNK_XHTML_STYLESHEET=$(srcdir)/xsl/xhtml-chunk.xsl 5 | XML_CATALOG_FILES=$(srcdir)/xsl/catalog.xml 6 | 7 | htmldir = $(prefix)/share/doc/sysbench 8 | dist_html_DATA = manual.html 9 | 10 | EXTRA_DIST=manual.xml 11 | 12 | SUBDIRS = xsl 13 | 14 | if have_xsltproc 15 | 16 | manual.html: ${top_srcdir}/doc/manual.xml 17 | XML_CATALOG_FILES=$(XML_CATALOG_FILES) $(XSLTPROC) $(XSLTPROC_FLAGS) -o $@ $(XHTML_STYLESHEET) $< 18 | 19 | chunk: ${top_srcdir}/doc/manual.xml 20 | $(XSLTPROC) $(XSLTPROC_FLAGS) $(CHUNK_XHTML_STYLESHEET) $< 21 | 22 | else 23 | 24 | chunk: 25 | 26 | manual.html: 27 | touch $@ 28 | 29 | endif 30 | 31 | clean-local: 32 | $(RM) -f *.html 33 | 34 | distclean-local: 35 | $(RM) -f xsl/catalog.xml 36 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/drop_cons.sql: -------------------------------------------------------------------------------- 1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; 2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; 3 | 4 | ALTER TABLE district DROP FOREIGN KEY fkey_district_1; 5 | ALTER TABLE customer DROP FOREIGN KEY fkey_customer_1; 6 | ALTER TABLE history DROP FOREIGN KEY fkey_history_1; 7 | ALTER TABLE history DROP FOREIGN KEY fkey_history_2; 8 | ALTER TABLE new_orders DROP FOREIGN KEY fkey_new_orders_1; 9 | ALTER TABLE orders DROP FOREIGN KEY fkey_orders_1; 10 | ALTER TABLE order_line DROP FOREIGN KEY fkey_order_line_1; 11 | ALTER TABLE order_line DROP FOREIGN KEY fkey_order_line_2; 12 | ALTER TABLE stock DROP FOREIGN KEY fkey_stock_1; 13 | ALTER TABLE stock DROP FOREIGN KEY fkey_stock_2; 14 | 15 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; 16 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; 17 | 18 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/schema2/drop_cons.sql: -------------------------------------------------------------------------------- 1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; 2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; 3 | 4 | ALTER TABLE district DROP FOREIGN KEY fkey_district_1; 5 | ALTER TABLE customer DROP FOREIGN KEY fkey_customer_1; 6 | ALTER TABLE history DROP FOREIGN KEY fkey_history_1; 7 | ALTER TABLE history DROP FOREIGN KEY fkey_history_2; 8 | ALTER TABLE new_orders DROP FOREIGN KEY fkey_new_orders_1; 9 | ALTER TABLE orders DROP FOREIGN KEY fkey_orders_1; 10 | ALTER TABLE order_line DROP FOREIGN KEY fkey_order_line_1; 11 | ALTER TABLE order_line DROP FOREIGN KEY fkey_order_line_2; 12 | ALTER TABLE stock DROP FOREIGN KEY fkey_stock_1; 13 | ALTER TABLE stock DROP FOREIGN KEY fkey_stock_2; 14 | 15 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; 16 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; 17 | 18 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | SUBDIRS = cpu fileio memory threads mutex db 18 | -------------------------------------------------------------------------------- /bench-tools/fio/helpers.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "compiler/compiler.h" 9 | #include "arch/arch.h" 10 | #include "os/os.h" 11 | 12 | #ifndef CONFIG_LINUX_FALLOCATE 13 | int fallocate(int fd, int mode, off_t offset, off_t len) 14 | { 15 | errno = ENOSYS; 16 | return -1; 17 | } 18 | #endif 19 | 20 | #ifndef CONFIG_POSIX_FALLOCATE 21 | int posix_fallocate(int fd, off_t offset, off_t len) 22 | { 23 | return 0; 24 | } 25 | #endif 26 | 27 | #ifndef CONFIG_SYNC_FILE_RANGE 28 | int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags) 29 | { 30 | errno = ENOSYS; 31 | return -1; 32 | } 33 | #endif 34 | 35 | #ifndef CONFIG_POSIX_FADVISE 36 | int posix_fadvise(int fd, off_t offset, off_t len, int advice) 37 | { 38 | return 0; 39 | } 40 | #endif 41 | -------------------------------------------------------------------------------- /bench-tools/sysbench/doc/xsl/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | EXTRA_DIST=catalog.xml.in xhtml-chunk.xsl xhtml-common.xsl xhtml.xsl 18 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | SUBDIRS = src 18 | 19 | EXTRA_DIST = COPYRIGHT README 20 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/scripts/memlock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char * 7 | alloc_workbuf(size_t size) 8 | { 9 | char *ptr; 10 | 11 | /* allocate some memory */ 12 | ptr = malloc(size); 13 | 14 | /* return NULL on failure */ 15 | if (ptr == NULL) 16 | return NULL; 17 | 18 | /* lock this buffer into RAM */ 19 | if (mlock(ptr, size)) { 20 | free(ptr); 21 | return NULL; 22 | } 23 | return ptr; 24 | } 25 | 26 | void 27 | free_workbuf(char *ptr, size_t size) 28 | { 29 | /* unlock the address range */ 30 | munlock(ptr, size); 31 | 32 | /* free the memory */ 33 | free(ptr); 34 | } 35 | 36 | int main() 37 | { 38 | 39 | char *area; 40 | size_t allocz=306535006208LLU; 41 | 42 | area=alloc_workbuf(allocz); 43 | 44 | while(1) 45 | { 46 | sleep(10); 47 | } 48 | 49 | free_workbuf(area,allocz); 50 | 51 | return 0; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /bench-tools/fio/FIO-VERSION-GEN: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | GVF=FIO-VERSION-FILE 4 | DEF_VER=fio-2.1.10 5 | 6 | LF=' 7 | ' 8 | 9 | # First see if there is a version file (included in release tarballs), 10 | # then try git-describe, then default. 11 | if test -f version 12 | then 13 | VN=`cat version` || VN="$DEF_VER" 14 | elif test -d .git -o -f .git && 15 | VN=`git describe --match "fio-[0-9]*" --abbrev=4 HEAD 2>/dev/null` && 16 | case "$VN" in 17 | *$LF*) (exit 1) ;; 18 | v[0-9]*) 19 | git update-index -q --refresh 20 | test -z "`git diff-index --name-only HEAD --`" || 21 | VN="$VN-dirty" ;; 22 | esac 23 | then 24 | VN=$VN 25 | else 26 | VN="$DEF_VER" 27 | fi 28 | 29 | VN=`expr "$VN" : v*'\(.*\)'` 30 | 31 | if test -r $GVF 32 | then 33 | VC=`sed -e 's/^FIO_VERSION = //' <$GVF` 34 | else 35 | VC=unset 36 | fi 37 | test "$VN" = "$VC" || { 38 | echo >&2 "FIO_VERSION = $VN" 39 | echo "FIO_VERSION = $VN" >$GVF 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /bench-tools/sysbench/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | ACLOCAL_AMFLAGS = -I m4 18 | 19 | SUBDIRS = doc sysbench 20 | 21 | EXTRA_DIST = autogen.sh README README-WIN.txt ChangeLog 22 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/drizzle/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Sun Microsystems, Inc. 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbdrizzle.a 18 | 19 | libsbdrizzle_a_SOURCES = drv_drizzle.c 20 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/cpu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tests) 18 | ADD_LIBRARY(sbcpu sb_cpu.c) 19 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/mutex/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tests) 18 | add_library(sbmutex sb_mutex.c) 19 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/memory/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tests) 18 | add_library(sbmemory sb_memory.c) 19 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/threads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tests) 18 | add_library(sbthreads sb_threads.c) 19 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/fileio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tests) 18 | ADD_LIBRARY(sbfileio sb_fileio.c crc32.c) 19 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/sb_cpu.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef SB_CPU_H 19 | #define SB_CPU_H 20 | 21 | int register_test_cpu(sb_list_t *tests); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-aarch64.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_AARCH64_H 2 | #define ARCH_AARCH64_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define FIO_ARCH (arch_aarch64) 10 | 11 | #ifndef __NR_ioprio_set 12 | #define __NR_ioprio_set 30 13 | #define __NR_ioprio_get 31 14 | #endif 15 | 16 | #define nop do { __asm__ __volatile__ ("yield"); } while (0) 17 | #define read_barrier() do { __sync_synchronize(); } while (0) 18 | #define write_barrier() do { __sync_synchronize(); } while (0) 19 | 20 | static inline int arch_ffz(unsigned long bitmask) 21 | { 22 | unsigned long count, reversed_bits; 23 | if (~bitmask == 0) /* ffz() in lib/ffz.h does this. */ 24 | return 63; 25 | 26 | __asm__ __volatile__ ("rbit %1, %2\n" 27 | "clz %0, %1\n" : 28 | "=r"(count), "=&r"(reversed_bits) : 29 | "r"(~bitmask)); 30 | return count; 31 | } 32 | 33 | #define ARCH_HAVE_FFZ 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/README: -------------------------------------------------------------------------------- 1 | 1. Build binaries 2 | * cd scr ; make 3 | ( you should have mysql_config available in $PATH) 4 | 5 | 2. Load data 6 | * create database 7 | mysqladmin create tpcc1000 8 | * create tables 9 | mysql tpcc1000 < create_table.sql 10 | * create indexes and FK ( this step can be done after loading data) 11 | mysql tpcc1000 < add_fkey_idx.sql 12 | * populate data 13 | - simple step 14 | tpcc_load 127.0.0.1:33000 tpcc1000 root "" 1000 15 | |hostname:port| |dbname| |user| |password| |WAREHOUSES| 16 | ref. tpcc_load --help for all options 17 | - load data in parallel 18 | check load.sh script 19 | 20 | 3. start benchmark 21 | * ./tpcc_start -h127.0.0.1 -P33000 -dtpcc1000 -uroot -w1000 -c32 -r10 -l10800 22 | |hostname| |port| |dbname| |user| |WAREHOUSES| |CONNECTIONS| |WARMUP TIME| |BENCHMARK TIME| 23 | * ref. tpcc_start --help for all options 24 | -------------------------------------------------------------------------------- /bench-tools/fio/trim.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_TRIM_H 2 | #define FIO_TRIM_H 3 | 4 | #include "fio.h" 5 | 6 | #ifdef FIO_HAVE_TRIM 7 | extern int __must_check get_next_trim(struct thread_data *td, struct io_u *io_u); 8 | extern int io_u_should_trim(struct thread_data *td, struct io_u *io_u); 9 | 10 | /* 11 | * Determine whether a given io_u should be logged for verify or 12 | * for discard 13 | */ 14 | static inline void remove_trim_entry(struct thread_data *td, struct io_piece *ipo) 15 | { 16 | if (!flist_empty(&ipo->trim_list)) { 17 | flist_del_init(&ipo->trim_list); 18 | td->trim_entries--; 19 | } 20 | } 21 | 22 | #else 23 | static inline int get_next_trim(struct thread_data *td, struct io_u *io_u) 24 | { 25 | return 1; 26 | } 27 | static inline int io_u_should_trim(struct thread_data *td, struct io_u *io_u) 28 | { 29 | return 0; 30 | } 31 | static inline void remove_trim_entry(struct thread_data *td, struct io_piece *ipo) 32 | { 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/cpu/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbcpu.a 18 | 19 | libsbcpu_a_SOURCES = sb_cpu.c ../sb_cpu.h 20 | 21 | libsbcpu_a_CPPFLAGS = $(AM_CPPFLAGS) 22 | -------------------------------------------------------------------------------- /bench-tools/fio/io_u_queue.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "io_u_queue.h" 3 | 4 | int io_u_qinit(struct io_u_queue *q, unsigned int nr) 5 | { 6 | q->io_us = calloc(nr, sizeof(struct io_u *)); 7 | if (!q->io_us) 8 | return 1; 9 | 10 | q->nr = 0; 11 | return 0; 12 | } 13 | 14 | void io_u_qexit(struct io_u_queue *q) 15 | { 16 | free(q->io_us); 17 | } 18 | 19 | int io_u_rinit(struct io_u_ring *ring, unsigned int nr) 20 | { 21 | ring->max = nr + 1; 22 | if (ring->max & (ring->max - 1)) { 23 | ring->max--; 24 | ring->max |= ring->max >> 1; 25 | ring->max |= ring->max >> 2; 26 | ring->max |= ring->max >> 4; 27 | ring->max |= ring->max >> 8; 28 | ring->max |= ring->max >> 16; 29 | ring->max++; 30 | } 31 | 32 | ring->ring = calloc(ring->max, sizeof(struct io_u *)); 33 | if (!ring->ring) 34 | return 1; 35 | 36 | ring->head = ring->tail = 0; 37 | return 0; 38 | } 39 | 40 | void io_u_rexit(struct io_u_ring *ring) 41 | { 42 | free(ring->ring); 43 | } 44 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.14 2005/12/29 15:32:11 roberto Exp $ 3 | ** Initialization of libraries for lua.c 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | #include "lua.h" 12 | 13 | #include "lualib.h" 14 | #include "lauxlib.h" 15 | 16 | 17 | static const luaL_Reg lualibs[] = { 18 | {"", luaopen_base}, 19 | {LUA_LOADLIBNAME, luaopen_package}, 20 | {LUA_TABLIBNAME, luaopen_table}, 21 | {LUA_IOLIBNAME, luaopen_io}, 22 | {LUA_OSLIBNAME, luaopen_os}, 23 | {LUA_STRLIBNAME, luaopen_string}, 24 | {LUA_MATHLIBNAME, luaopen_math}, 25 | {LUA_DBLIBNAME, luaopen_debug}, 26 | {NULL, NULL} 27 | }; 28 | 29 | 30 | LUALIB_API void luaL_openlibs (lua_State *L) { 31 | const luaL_Reg *lib = lualibs; 32 | for (; lib->func; lib++) { 33 | lua_pushcfunction(L, lib->func); 34 | lua_pushstring(L, lib->name); 35 | lua_call(L, 1, 0); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/mutex/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbmutex.a 18 | 19 | libsbmutex_a_SOURCES = sb_mutex.c ../sb_mutex.h 20 | 21 | libsbmutex_a_CPPFLAGS = $(AM_CPPFLAGS) -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/mysql/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbmysql.a 18 | 19 | libsbmysql_a_SOURCES = drv_mysql.c 20 | libsbmysql_a_CPPFLAGS = $(MYSQL_CFLAGS) $(AM_CPPFLAGS) 21 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/oracle/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2005 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsboracle.a 18 | 19 | libsboracle_a_SOURCES = drv_oracle.c 20 | libsboracle_a_CPPFLAGS = $(ORA_CFLAGS) $(AM_CPPFLAGS) 21 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/pgsql/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2005 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbpgsql.a 18 | 19 | libsbpgsql_a_SOURCES = drv_pgsql.c 20 | libsbpgsql_a_CPPFLAGS = $(PGSQL_CFLAGS) $(AM_CPPFLAGS) 21 | -------------------------------------------------------------------------------- /bench-tools/fio/LICENSE: -------------------------------------------------------------------------------- 1 | As specified by the COPYING file, fio is free software published under version 2 | 2 of the GPL license. That covers the copying part of the license. By using fio, 3 | you are also promising to uphold the following moral obligations: 4 | 5 | - If you publish results that are done using fio, it must be clearly stated 6 | that fio was used. The specific version should also be listed. 7 | 8 | - If you develop features or bug fixes for fio, they should be sent upstream 9 | for inclusion into the main repository. This isn't specific to fio, that 10 | is a general rule for any open source project. It's just the Right Thing 11 | to do. Plus it means that you don't have to maintain the feature or change 12 | internally. In the long run, this is saving you a lot of time. 13 | 14 | I would consider the above to fall under "common courtesy", but since 15 | people tend to have differing opinions of that, it doesn't hurt to spell out 16 | my expectations clearly. 17 | 18 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | include_directories(lua/src ..) 18 | add_subdirectory(lua/src) 19 | add_library(sbscript sb_script.c sb_script.h script_lua.c script_lua.h) 20 | 21 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43 2005/04/25 19:24:10 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/memory/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbmemory.a 18 | 19 | libsbmemory_a_SOURCES = sb_memory.c ../sb_memory.h 20 | 21 | libsbmemory_a_CPPFLAGS = $(AM_CPPFLAGS) 22 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/threads/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbthreads.a 18 | 19 | libsbthreads_a_SOURCES = sb_threads.c ../sb_threads.h 20 | 21 | libsbthreads_a_CPPFLAGS = $(AM_CPPFLAGS) -------------------------------------------------------------------------------- /bench-tools/fio/tools/plot/graph2D.gpm: -------------------------------------------------------------------------------- 1 | # This Gnuplot file has been generated by eNovance 2 | 3 | set title '$0' 4 | 5 | set terminal png size 1280,1024 6 | set output '$3.png' 7 | #set terminal x11 8 | 9 | #Preparing Axes 10 | #set logscale x 11 | set ytics axis out auto 12 | #set data style lines 13 | set key top left reverse 14 | set xlabel "Time (Seconds)" 15 | set ylabel '$4' 16 | set xrange [0:] 17 | set yrange [0:] 18 | 19 | #Set Color style 20 | #set palette rgbformulae 22,9,23 21 | #set palette rgbformulae 7,5,15 22 | set style line 100 lt 7 lw 0.5 23 | set style line 1 lt 1 lw 3 pt 3 linecolor rgb "green" 24 | 25 | plot '$1' using 2:3 with linespoints title '$2', $7 w l ls 1 ti 'Global average value ($7)' 26 | 27 | set output '$5.png' 28 | plot '$1' using 2:3 smooth csplines title '$2', $7 w l ls 1 ti 'Global average value ($7)' 29 | 30 | set output '$6.png' 31 | plot '$1' using 2:3 smooth bezier title '$2', $7 w l ls 1 ti 'Global average value ($7)' 32 | 33 | #pause -1 34 | #The End 35 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/insert.lua: -------------------------------------------------------------------------------- 1 | pathtest = string.match(test, "(.*/)") or "" 2 | 3 | dofile(pathtest .. "common.lua") 4 | 5 | function thread_init(thread_id) 6 | set_vars() 7 | end 8 | 9 | function event(thread_id) 10 | local table_name 11 | local i 12 | local c_val 13 | local k_val 14 | local pad_val 15 | 16 | table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count) 17 | 18 | if (oltp_auto_inc) then 19 | i = 0 20 | else 21 | i = sb_rand_uniq(1, oltp_table_size) 22 | end 23 | k_val = sb_rand(1, oltp_table_size) 24 | c_val = sb_rand_str([[ 25 | ###########-###########-###########-###########-###########-###########-###########-###########-###########-###########]]) 26 | pad_val = sb_rand_str([[ 27 | ###########-###########-###########-###########-###########]]) 28 | 29 | rs = db_query("INSERT INTO " .. table_name .. " (id, k, c, pad) VALUES " .. string.format("(%d, %d, '%s', '%s')",i, k_val, c_val, pad_val)) 30 | end 31 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/fileio/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = libsbfileio.a 18 | 19 | libsbfileio_a_SOURCES = sb_fileio.c ../sb_fileio.h crc32.c crc32.h crc32tbl.h 20 | 21 | libsbfileio_a_CPPFLAGS = $(AM_CPPFLAGS) 22 | -------------------------------------------------------------------------------- /bench-tools/fio/crc/crc32.h: -------------------------------------------------------------------------------- 1 | /* crc32 -- calculate and POSIX.2 checksum 2 | Copyright (C) 92, 1995-1999 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software Foundation, 16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 17 | 18 | #ifndef CRC32_H 19 | #define CRC32_H 20 | 21 | extern uint32_t fio_crc32(const void * const, unsigned long); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/falloc.fio: -------------------------------------------------------------------------------- 1 | [global] 2 | ioengine=falloc 3 | iodepth=1 4 | direct=0 5 | buffered=0 6 | directory=/scratch 7 | nrfiles=1 8 | size=100M 9 | filesize=100M 10 | group_reporting 11 | 12 | 13 | # Run falloc and punch_hole threads in parallel 14 | # After activity file will be highly fragmented 15 | [falloc-fuzzer] 16 | stonewall 17 | runtime=10 18 | time_based=10 19 | bssplit=4k/10:64k/50:32k/40 20 | rw=randwrite 21 | numjobs=1 22 | filename=fragmented_file 23 | 24 | [punch hole-fuzzer] 25 | bs=4k 26 | runtime=10 27 | time_based=10 28 | rw=randtrim 29 | numjobs=2 30 | filename=fragmented_file 31 | 32 | ## Mesure IO performance on fragmented file 33 | [sequential aio-dio write] 34 | stonewall 35 | ioengine=libaio 36 | numjobs=1 37 | iodepth=128 38 | buffered=0 39 | direct=1 40 | rw=write 41 | bs=64k 42 | filename=fragmented_file 43 | 44 | [sequential buffered read] 45 | stonewall 46 | ioengine=sync 47 | numjobs=1 48 | iodepth=1 49 | buffered=1 50 | direct=0 51 | rw=read 52 | bs=64k 53 | filename=fragmented_file 54 | 55 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/hweight.c: -------------------------------------------------------------------------------- 1 | #include "hweight.h" 2 | 3 | unsigned int hweight8(uint8_t w) 4 | { 5 | unsigned int res = w - ((w >> 1) & 0x55); 6 | 7 | res = (res & 0x33) + ((res >> 2) & 0x33); 8 | return (res + (res >> 4)) & 0x0F; 9 | } 10 | 11 | unsigned int hweight32(uint32_t w) 12 | { 13 | unsigned int res = w - ((w >> 1) & 0x55555555); 14 | 15 | res = (res & 0x33333333) + ((res >> 2) & 0x33333333); 16 | res = (res + (res >> 4)) & 0x0F0F0F0F; 17 | res = res + (res >> 8); 18 | return (res + (res >> 16)) & 0x000000FF; 19 | } 20 | 21 | unsigned int hweight64(uint64_t w) 22 | { 23 | #if BITS_PER_LONG == 32 24 | return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w); 25 | #else 26 | uint64_t res = w - ((w >> 1) & 0x5555555555555555ULL); 27 | res = (res & 0x3333333333333333ULL) + ((res >> 2) & 0x3333333333333333ULL); 28 | res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0FULL; 29 | res = res + (res >> 8); 30 | res = res + (res >> 16); 31 | return (res + (res >> 32)) & 0x00000000000000FFULL; 32 | #endif 33 | } 34 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/ssd-test.fio: -------------------------------------------------------------------------------- 1 | # Do some important numbers on SSD drives, to gauge what kind of 2 | # performance you might get out of them. 3 | # 4 | # Sequential read and write speeds are tested, these are expected to be 5 | # high. Random reads should also be fast, random writes are where crap 6 | # drives are usually separated from the good drives. 7 | # 8 | # This uses a queue depth of 4. New SATA SSD's will support up to 32 9 | # in flight commands, so it may also be interesting to increase the queue 10 | # depth and compare. Note that most real-life usage will not see that 11 | # large of a queue depth, so 4 is more representative of normal use. 12 | # 13 | [global] 14 | bs=4k 15 | ioengine=libaio 16 | iodepth=4 17 | size=1g 18 | direct=1 19 | runtime=60 20 | directory=/mount-point-of-ssd 21 | filename=ssd.test.file 22 | 23 | [seq-read] 24 | rw=read 25 | stonewall 26 | 27 | [rand-read] 28 | rw=randread 29 | stonewall 30 | 31 | [seq-write] 32 | rw=write 33 | stonewall 34 | 35 | [rand-write] 36 | rw=randwrite 37 | stonewall 38 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/rand.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_RAND_H 2 | #define FIO_RAND_H 3 | 4 | #define FRAND_MAX (-1U) 5 | 6 | struct frand_state { 7 | unsigned int s1, s2, s3; 8 | }; 9 | 10 | static inline unsigned int __rand(struct frand_state *state) 11 | { 12 | #define TAUSWORTHE(s,a,b,c,d) ((s&c)<>b) 13 | 14 | state->s1 = TAUSWORTHE(state->s1, 13, 19, 4294967294UL, 12); 15 | state->s2 = TAUSWORTHE(state->s2, 2, 25, 4294967288UL, 4); 16 | state->s3 = TAUSWORTHE(state->s3, 3, 11, 4294967280UL, 17); 17 | 18 | return (state->s1 ^ state->s2 ^ state->s3); 19 | } 20 | 21 | extern void init_rand(struct frand_state *); 22 | extern void init_rand_seed(struct frand_state *, unsigned int seed); 23 | extern void __fill_random_buf(void *buf, unsigned int len, unsigned long seed); 24 | extern unsigned long fill_random_buf(struct frand_state *, void *buf, unsigned int len); 25 | extern unsigned long fill_random_buf_percentage(struct frand_state *, void *buf, unsigned int percentage, unsigned int segment, unsigned int len); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/mman.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_MMAN_H 2 | #define SYS_MMAN_H 3 | 4 | #include 5 | 6 | #define PROT_NONE 0x1 7 | #define PROT_READ 0x2 8 | #define PROT_WRITE 0x4 9 | 10 | #define MAP_ANON 0x1 11 | #define MAP_ANONYMOUS MAP_ANON 12 | #define MAP_FIXED 0x2 13 | #define MAP_HASSEMAPHORE 0x4 14 | #define MAP_INHERIT 0x8 15 | #define MAP_NOCORE 0x10 16 | #define MAP_NOSYNC 0x20 17 | #define MAP_PREFAULT_READ 0x40 18 | #define MAP_PRIVATE 0x80 19 | #define MAP_SHARED 0x100 20 | #define MAP_STACK 0x200 21 | 22 | #define MAP_FAILED NULL 23 | 24 | #define MS_ASYNC 0x1 25 | #define MS_SYNC 0x2 26 | #define MS_INVALIDATE 0x3 27 | 28 | int posix_madvise(void *addr, size_t len, int advice); 29 | void *mmap(void *addr, size_t len, int prot, int flags, 30 | int fildes, off_t off); 31 | int munmap(void *addr, size_t len); 32 | int msync(void *addr, size_t len, int flags); 33 | int munlock(const void * addr, size_t len); 34 | int mlock(const void *addr, size_t len); 35 | 36 | #endif /* SYS_MMAN_H */ 37 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/script_lua.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include "config.h" 20 | #endif 21 | 22 | #include "sysbench.h" 23 | 24 | /* Load a specified Lua script */ 25 | 26 | int script_load_lua(const char *testname, sb_test_t *test); 27 | -------------------------------------------------------------------------------- /bench-tools/fio/err.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_ERR_H 2 | #define FIO_ERR_H 3 | 4 | /* 5 | * Kernel pointers have redundant information, so we can use a 6 | * scheme where we can return either an error code or a dentry 7 | * pointer with the same return value. 8 | * 9 | * This should be a per-architecture thing, to allow different 10 | * error and pointer decisions. 11 | */ 12 | #define MAX_ERRNO 4095 13 | 14 | #define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO) 15 | 16 | static inline void *ERR_PTR(uintptr_t error) 17 | { 18 | return (void *) error; 19 | } 20 | 21 | static inline uintptr_t PTR_ERR(const void *ptr) 22 | { 23 | return (uintptr_t) ptr; 24 | } 25 | 26 | static inline uintptr_t IS_ERR(const void *ptr) 27 | { 28 | return IS_ERR_VALUE((uintptr_t)ptr); 29 | } 30 | 31 | static inline uintptr_t IS_ERR_OR_NULL(const void *ptr) 32 | { 33 | return !ptr || IS_ERR_VALUE((uintptr_t)ptr); 34 | } 35 | 36 | static inline int PTR_ERR_OR_ZERO(const void *ptr) 37 | { 38 | if (IS_ERR(ptr)) 39 | return PTR_ERR(ptr); 40 | else 41 | return 0; 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /bench-tools/sysbench/README-WIN.txt: -------------------------------------------------------------------------------- 1 | How to build on Windows 2 | 3 | 4 | You need CMake (download from http://www.cmake.org/) and Visual Studio 2005 or 5 | later (free Express edition should work ok) 6 | 7 | 1.Open Visual Studio command line prompt 8 | 2.To build with MySQL support, you will need mysql.h header file and client 9 | library libmysqld.lib 10 | One can get them e.g by downloading and unpacking the "zip" distribution of mysql 11 | 12 | - Append directory where libmysql.lib is located to environment variable LIB, e.g 13 | set LIB=%LIB%;G:\mysql-noinstall-6.0.6-alpha-win32\mysql-6.0.6-alpha-win32\lib\opt 14 | 15 | - Append directory where mysql.h is located to environment variable INCLUDE, e.g 16 | set INCLUDE=%INCLUDE%;G:\mysql-noinstall-6.0.6-alpha-win32\mysql-6.0.6-alpha-win32\include 17 | 3.In the sysbench directory, execute cmake -G "Visual Studio 9 2008" 18 | 4.Open sysbench.sln in Explorer and build Relwithdebinfo target. 19 | Alternatively, from the command line, issue 20 | vcbuild /useenv sysbench.sln "Relwithdebinfo|Win32" 21 | -------------------------------------------------------------------------------- /bench-tools/fio/lib/bswap.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_BSWAP_H 2 | #define FIO_BSWAP_H 3 | 4 | #include 5 | 6 | #ifdef CONFIG_LITTLE_ENDIAN 7 | static inline uint32_t __be32_to_cpu(uint32_t val) 8 | { 9 | uint32_t c1, c2, c3, c4; 10 | 11 | c1 = (val >> 24) & 0xff; 12 | c2 = (val >> 16) & 0xff; 13 | c3 = (val >> 8) & 0xff; 14 | c4 = val & 0xff; 15 | 16 | return c1 | c2 << 8 | c3 << 16 | c4 << 24; 17 | } 18 | 19 | static inline uint64_t __be64_to_cpu(uint64_t val) 20 | { 21 | uint64_t c1, c2, c3, c4, c5, c6, c7, c8; 22 | 23 | c1 = (val >> 56) & 0xff; 24 | c2 = (val >> 48) & 0xff; 25 | c3 = (val >> 40) & 0xff; 26 | c4 = (val >> 32) & 0xff; 27 | c5 = (val >> 24) & 0xff; 28 | c6 = (val >> 16) & 0xff; 29 | c7 = (val >> 8) & 0xff; 30 | c8 = val & 0xff; 31 | 32 | return c1 | c2 << 8 | c3 << 16 | c4 << 24 | c5 << 32 | c6 << 40 | c7 << 48 | c8 << 56; 33 | } 34 | #else 35 | static inline uint64_t __be64_to_cpu(uint64_t val) 36 | { 37 | return val; 38 | } 39 | 40 | static inline uint32_t __be32_to_cpu(uint32_t val) 41 | { 42 | return val; 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.40 2005/11/11 14:03:13 lhf Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /bench-tools/fio/td_error.c: -------------------------------------------------------------------------------- 1 | #include "fio.h" 2 | #include "io_ddir.h" 3 | #include "td_error.h" 4 | 5 | static int __NON_FATAL_ERR[] = { EIO, EILSEQ }; 6 | 7 | enum error_type_bit td_error_type(enum fio_ddir ddir, int err) 8 | { 9 | if (err == EILSEQ) 10 | return ERROR_TYPE_VERIFY_BIT; 11 | if (ddir == DDIR_READ) 12 | return ERROR_TYPE_READ_BIT; 13 | return ERROR_TYPE_WRITE_BIT; 14 | } 15 | 16 | int td_non_fatal_error(struct thread_data *td, enum error_type_bit etype, 17 | int err) 18 | { 19 | unsigned int i; 20 | 21 | if (!td->o.ignore_error[etype]) { 22 | td->o.ignore_error[etype] = __NON_FATAL_ERR; 23 | td->o.ignore_error_nr[etype] = sizeof(__NON_FATAL_ERR) 24 | / sizeof(int); 25 | } 26 | 27 | if (!(td->o.continue_on_error & (1 << etype))) 28 | return 0; 29 | for (i = 0; i < td->o.ignore_error_nr[etype]; i++) 30 | if (td->o.ignore_error[etype][i] == err) 31 | return 1; 32 | 33 | return 0; 34 | } 35 | 36 | void update_error_count(struct thread_data *td, int err) 37 | { 38 | td->total_err_count++; 39 | if (td->total_err_count == 1) 40 | td->first_error = err; 41 | } 42 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/sb_threads.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef SB_THREADS_H 19 | #define SB_THREADS_H 20 | 21 | /* Threads request definition */ 22 | 23 | typedef struct 24 | { 25 | unsigned int lock_num; 26 | } sb_threads_request_t; 27 | 28 | int register_test_threads(sb_list_t *tests); 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/eula.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fcharset0 Helvetica;}} 2 | {\colortbl ;\red0\green0\blue255;} 3 | {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\lang9\f0\fs20 FIO - Flexible IO Tester\par 4 | Copyright (C) 2010-2013\par 5 | \par 6 | 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 (at your option) any later version.\par 7 | \par 8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\par 9 | \par 10 | You should have received a copy of the GNU General Public License along with this program. If not, see {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/"}}{\fldrslt{\ul\cf1 http://www.gnu.org/licenses/}}}\f0\fs20 .\par 11 | } 12 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/sb_mutex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef SB_MUTEX_H 19 | #define SB_MUTEX_H 20 | 21 | /* Threads request definition */ 22 | 23 | typedef struct 24 | { 25 | unsigned int nlocks; 26 | unsigned int nloops; 27 | } sb_mutex_request_t; 28 | 29 | int register_test_mutex(sb_list_t *tests); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /bench-tools/fio/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_DEBUG_H 2 | #define FIO_DEBUG_H 3 | 4 | #include 5 | #include "log.h" 6 | 7 | enum { 8 | FD_PROCESS = 0, 9 | FD_FILE, 10 | FD_IO, 11 | FD_MEM, 12 | FD_BLKTRACE, 13 | FD_VERIFY, 14 | FD_RANDOM, 15 | FD_PARSE, 16 | FD_DISKUTIL, 17 | FD_JOB, 18 | FD_MUTEX, 19 | FD_PROFILE, 20 | FD_TIME, 21 | FD_NET, 22 | FD_RATE, 23 | FD_DEBUG_MAX, 24 | }; 25 | 26 | extern unsigned int fio_debug_jobno, *fio_debug_jobp; 27 | 28 | #ifdef FIO_INC_DEBUG 29 | struct debug_level { 30 | const char *name; 31 | const char *help; 32 | unsigned long shift; 33 | unsigned int jobno; 34 | }; 35 | extern struct debug_level debug_levels[]; 36 | 37 | extern unsigned long fio_debug; 38 | 39 | void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, 3))); 40 | 41 | #define dprint(type, str, args...) \ 42 | do { \ 43 | if ((((1 << type)) & fio_debug) == 0) \ 44 | break; \ 45 | __dprint((type), (str), ##args); \ 46 | } while (0) \ 47 | 48 | #else 49 | 50 | static inline void dprint(int type, const char *str, ...) 51 | { 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/drivers/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | if USE_MYSQL 18 | MYSQL_DIR = mysql 19 | endif 20 | 21 | if USE_DRIZZLE 22 | DRIZZLE_DIR = drizzle 23 | endif 24 | 25 | if USE_ORACLE 26 | ORACLE_DIR = oracle 27 | endif 28 | 29 | if USE_PGSQL 30 | PGSQL_DIR = pgsql 31 | endif 32 | 33 | SUBDIRS = $(MYSQL_DIR) $(ORACLE_DIR) $(PGSQL_DIR) $(DRIZZLE_DIR) 34 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | if USE_LUA 18 | SUBDIRS = lua . 19 | lua_sources = script_lua.c script_lua.h 20 | AM_CPPFLAGS += -I$(srcdir)/lua/src 21 | endif 22 | 23 | noinst_LIBRARIES = libsbscript.a 24 | 25 | libsbscript_a_SOURCES = sb_script.c sb_script.h $(lua_sources) 26 | 27 | libsbscript_a_CPPFLAGS = $(AM_CPPFLAGS) 28 | 29 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/sb_script.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef SB_SCRIPT_H 19 | #define SB_SCRIPT_H 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "sysbench.h" 26 | 27 | /* Initialize interpreter with a given script name */ 28 | 29 | sb_test_t *script_load(const char *testname); 30 | 31 | #endif /* SB_SCRIPT_H */ 32 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/db/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | EXTRA_DIST = delete.lua insert.lua oltp.lua \ 18 | oltp_simple.lua \ 19 | parallel_prepare.lua \ 20 | select_random_points.lua \ 21 | select_random_ranges.lua \ 22 | select.lua \ 23 | update_index.lua \ 24 | update_non_index.lua 25 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-arm.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_ARM_H 2 | #define ARCH_ARM_H 3 | 4 | #define FIO_ARCH (arch_arm) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 314 8 | #define __NR_ioprio_get 315 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 270 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 340 17 | #define __NR_sys_tee 342 18 | #define __NR_sys_vmsplice 343 19 | #endif 20 | 21 | #if defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__) \ 22 | || defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__) \ 23 | || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) 24 | #define nop __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t") 25 | #define read_barrier() __asm__ __volatile__ ("" : : : "memory") 26 | #define write_barrier() __asm__ __volatile__ ("" : : : "memory") 27 | #elif defined(__ARM_ARCH_7A__) 28 | #define nop __asm__ __volatile__ ("nop") 29 | #define read_barrier() __sync_synchronize() 30 | #define write_barrier() __sync_synchronize() 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /bench-tools/fio/os/os-aix.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_OS_AIX_H 2 | #define FIO_OS_AIX_H 3 | 4 | #define FIO_OS os_aix 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "../file.h" 12 | 13 | #define FIO_HAVE_ODIRECT 14 | #define FIO_USE_GENERIC_RAND 15 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE 16 | 17 | #define FIO_HAVE_PSHARED_MUTEX 18 | 19 | #define OS_MAP_ANON MAP_ANON 20 | #define OS_MSG_DONTWAIT 0 21 | 22 | #define FIO_USE_GENERIC_SWAP 23 | 24 | static inline int blockdev_invalidate_cache(struct fio_file *f) 25 | { 26 | return EINVAL; 27 | } 28 | 29 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) 30 | { 31 | struct devinfo info; 32 | 33 | if (!ioctl(f->fd, IOCINFO, &info)) { 34 | *bytes = (unsigned long long)info.un.scdk.numblks * 35 | info.un.scdk.blksize; 36 | return 0; 37 | } 38 | 39 | return errno; 40 | } 41 | 42 | static inline unsigned long long os_phys_mem(void) 43 | { 44 | long mem = sysconf(_SC_AIX_REALMEM); 45 | 46 | if (mem == -1) 47 | return 0; 48 | 49 | return (unsigned long long) mem * 1024; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /bench-tools/http_load/README: -------------------------------------------------------------------------------- 1 | http_load - multiprocessing http test client 2 | version of 12mar2006 3 | 4 | http_load runs multiple http fetches in parallel, to test the 5 | throughput of a web server. However unlike most such test clients, 6 | it runs in a single process, so it doesn't bog down the client 7 | machine. It can be configured to do https fetches as well. 8 | 9 | See the manual entry for more details. 10 | 11 | Files in this distribution: 12 | 13 | README this 14 | Makefile guess 15 | http_load.c source file 16 | http_load.1 manual entry 17 | timers.c timers package 18 | timers.h headers for timers package 19 | make_test_files simple script to create a set of test files 20 | 21 | To build: If you're on a SysV-like machine (which includes old Linux systems 22 | but not new Linux systems), edit the Makefile and uncomment the SYSV_LIBS 23 | line. If you're doing SSL, uncomment those lines too. Otherwise, just do 24 | a make. 25 | 26 | Feedback is welcome - send bug reports, enhancements, checks, money 27 | orders, etc. to the addresses below. 28 | 29 | Jef Poskanzer jef@mail.acme.com http://www.acme.com/jef/ 30 | -------------------------------------------------------------------------------- /bench-tools/fio/mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_MUTEX_H 2 | #define FIO_MUTEX_H 3 | 4 | #include 5 | 6 | #define FIO_MUTEX_MAGIC 0x4d555445U 7 | #define FIO_RWLOCK_MAGIC 0x52574c4fU 8 | 9 | struct fio_mutex { 10 | pthread_mutex_t lock; 11 | pthread_cond_t cond; 12 | int value; 13 | int waiters; 14 | int magic; 15 | }; 16 | 17 | struct fio_rwlock { 18 | pthread_rwlock_t lock; 19 | int magic; 20 | }; 21 | 22 | enum { 23 | FIO_MUTEX_LOCKED = 0, 24 | FIO_MUTEX_UNLOCKED = 1, 25 | }; 26 | 27 | extern int __fio_mutex_init(struct fio_mutex *, int); 28 | extern struct fio_mutex *fio_mutex_init(int); 29 | extern void fio_mutex_remove(struct fio_mutex *); 30 | extern void fio_mutex_up(struct fio_mutex *); 31 | extern void fio_mutex_down(struct fio_mutex *); 32 | extern int fio_mutex_down_trylock(struct fio_mutex *); 33 | extern int fio_mutex_down_timeout(struct fio_mutex *, unsigned int); 34 | 35 | extern void fio_rwlock_read(struct fio_rwlock *); 36 | extern void fio_rwlock_write(struct fio_rwlock *); 37 | extern void fio_rwlock_unlock(struct fio_rwlock *); 38 | extern struct fio_rwlock *fio_rwlock_init(void); 39 | extern void fio_rwlock_remove(struct fio_rwlock *); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.3 2005/04/25 19:24:10 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 24 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 25 | const TValue *p2); 26 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 29 | LUAI_FUNC void luaG_errormsg (lua_State *L); 30 | LUAI_FUNC int luaG_checkcode (const Proto *pt); 31 | LUAI_FUNC int luaG_checkopenop (Instruction i); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /bench-tools/sysbench/m4/extensions.m4: -------------------------------------------------------------------------------- 1 | dnl Provide AC_USE_SYSTEM_EXTENSIONS for old autoconf machines. 2 | AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],[ 3 | ifdef([AC_USE_SYSTEM_EXTENSIONS],[ 4 | AC_USE_SYSTEM_EXTENSIONS 5 | ],[ 6 | AC_BEFORE([$0], [AC_COMPILE_IFELSE]) 7 | AC_BEFORE([$0], [AC_RUN_IFELSE]) 8 | 9 | AC_REQUIRE([AC_GNU_SOURCE]) 10 | AC_REQUIRE([AC_AIX]) 11 | AC_REQUIRE([AC_MINIX]) 12 | 13 | AH_VERBATIM([__EXTENSIONS__], 14 | [/* Enable extensions on Solaris. */ 15 | #ifndef __EXTENSIONS__ 16 | # undef __EXTENSIONS__ 17 | #endif 18 | #ifndef _POSIX_PTHREAD_SEMANTICS 19 | # undef _POSIX_PTHREAD_SEMANTICS 20 | #endif 21 | #ifndef _TANDEM_SOURCE 22 | # undef _TANDEM_SOURCE 23 | #endif]) 24 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 25 | [ac_cv_safe_to_define___extensions__], 26 | [AC_COMPILE_IFELSE( 27 | [AC_LANG_PROGRAM([ 28 | # define __EXTENSIONS__ 1 29 | AC_INCLUDES_DEFAULT])], 30 | [ac_cv_safe_to_define___extensions__=yes], 31 | [ac_cv_safe_to_define___extensions__=no])]) 32 | test $ac_cv_safe_to_define___extensions__ = yes && 33 | AC_DEFINE([__EXTENSIONS__]) 34 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 35 | AC_DEFINE([_TANDEM_SOURCE]) 36 | ]) 37 | ]) 38 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6 2005/06/06 13:30:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.4 2005/04/25 19:24:10 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 28 | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 29 | LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 30 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 31 | int pc); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36 2005/12/27 17:12:00 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | 47 | 48 | #ifndef lua_assert 49 | #define lua_assert(x) ((void)0) 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/enospc-pressure.fio: -------------------------------------------------------------------------------- 1 | # 2 | # Test for race-condition DIO-write vs punch_hole 3 | # If race exist dio may rewrite punched block after 4 | # it was allocated to another file, we will catch that 5 | # by verifying blocks content 6 | # 7 | [global] 8 | ioengine=libaio 9 | directory=/scratch 10 | # File size is reasonably huge to provoke ENOSPC 11 | filesize=128G 12 | size=999G 13 | iodepth=128 14 | 15 | # Expect write failure due to ENOSPC, skip error dump 16 | continue_on_error=write 17 | ignore_error=,ENOSPC 18 | error_dump=0 19 | fallocate=none 20 | exitall 21 | 22 | # Two threads (dio and punch_hole) operate on single file:'raicer', 23 | # We do not care about data content here 24 | [dio-raicer] 25 | bs=128k 26 | direct=1 27 | buffered=0 28 | rw=randwrite 29 | runtime=100 30 | filename=raicer 31 | time_based 32 | 33 | [punch_hole-raicer] 34 | bs=4k 35 | rw=randtrim 36 | filename=raicer 37 | 38 | # Verifier thread continiously write to newly allcated blocks 39 | # and veryfy written content 40 | [aio-dio-verifier] 41 | create_on_open=1 42 | verify=crc32c-intel 43 | verify_fatal=1 44 | verify_dump=1 45 | verify_backlog=1024 46 | verify_async=4 47 | direct=1 48 | # block size should be equals to fs block size to prevent short writes 49 | bs=4k 50 | rw=randrw 51 | filename=aio-dio-verifier 52 | -------------------------------------------------------------------------------- /bench-tools/ibench/run.sh: -------------------------------------------------------------------------------- 1 | nr=$1 2 | engine=$2 3 | mysql=$3 4 | maxdop=$4 5 | myu=$5 6 | myp=$6 7 | myd=$7 8 | tn=$8 9 | mysock=$9 10 | tag=${10} 11 | 12 | if [[ ${11} == "yes" ]]; then 13 | setup="--setup" 14 | else 15 | setup="" 16 | fi 17 | 18 | if [[ ${12} == "yes" ]]; then 19 | insert_only="--insert_only" 20 | else 21 | insert_only="" 22 | fi 23 | 24 | run_mysql="$mysql -u$myu -p$myp -S$mysock $myd -A" 25 | 26 | dop=1 27 | rm -f ${tag}.* 28 | TIMEFORMAT='%R' 29 | while [[ $dop -le $maxdop ]]; do 30 | 31 | # Perform the load 32 | i=1 33 | while [[ $i -le $dop ]]; do 34 | if [[ ${11} == "yes" ]]; then 35 | $run_mysql -e "drop table if exists $tn$i" 36 | fi 37 | python ../ibench/iibench.py --engine=$engine --db_name=$myd --db_user=$myu --db_password=$myp --db_sock=$mysock \ 38 | $setup $insert_only --max_rows=$nr --rows_per_report=10000 --table_name=$tn$i \ 39 | >& ${tag}.${i}_of_${dop} & 40 | p[$i]=$! 41 | i=$(( $i + 1)) 42 | done 43 | i=1 44 | while [[ $i -le $dop ]]; do 45 | wait ${p[ $i ]} 46 | i=$(( $i + 1)) 47 | done 48 | grep "^$nr " ${tag}.*_of_${dop} | awk '{ print $3 }' | sort -n | tail -1 | awk '{ print "maxloadtime", $1 }' 49 | $run_mysql -e "show table status like 'tn%'" 50 | 51 | dop=$(( $dop * 2 )) 52 | 53 | done 54 | 55 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/fileio/.deps/libsbfileio_a-crc32.Po: -------------------------------------------------------------------------------- 1 | libsbfileio_a-crc32.o: crc32.c crc32.h ../../../config/config.h \ 2 | /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/limits.h \ 3 | /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/syslimits.h \ 4 | /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ 5 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 6 | /usr/include/gnu/stubs-64.h /usr/include/bits/posix1_lim.h \ 7 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 8 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 9 | /usr/include/bits/stdio_lim.h crc32tbl.h 10 | 11 | crc32.h: 12 | 13 | ../../../config/config.h: 14 | 15 | /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/limits.h: 16 | 17 | /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/syslimits.h: 18 | 19 | /usr/include/limits.h: 20 | 21 | /usr/include/features.h: 22 | 23 | /usr/include/sys/cdefs.h: 24 | 25 | /usr/include/bits/wordsize.h: 26 | 27 | /usr/include/gnu/stubs.h: 28 | 29 | /usr/include/gnu/stubs-64.h: 30 | 31 | /usr/include/bits/posix1_lim.h: 32 | 33 | /usr/include/bits/local_lim.h: 34 | 35 | /usr/include/linux/limits.h: 36 | 37 | /usr/include/bits/posix2_lim.h: 38 | 39 | /usr/include/bits/xopen_lim.h: 40 | 41 | /usr/include/bits/stdio_lim.h: 42 | 43 | crc32tbl.h: 44 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.5 2005/08/22 18:54:49 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 17 | 18 | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ 19 | (((o) = luaV_tonumber(o,n)) != NULL)) 20 | 21 | #define equalobj(L,o1,o2) \ 22 | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 23 | 24 | 25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 26 | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); 27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); 28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); 29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 30 | StkId val); 31 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 32 | StkId val); 33 | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); 34 | LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/sb_script.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include "config.h" 20 | #endif 21 | 22 | #include "sb_script.h" 23 | 24 | #ifdef HAVE_LUA 25 | # include "script_lua.h" 26 | #endif 27 | 28 | static sb_test_t test; 29 | 30 | /* Initialize interpreter with a given script name */ 31 | 32 | sb_test_t *script_load(const char *testname) 33 | { 34 | test.sname = strdup(testname); 35 | 36 | #ifdef HAVE_LUA 37 | if (!script_load_lua(testname, &test)) 38 | return &test; 39 | #endif 40 | 41 | return NULL; 42 | } 43 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-s390.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_S390_H 2 | #define ARCH_S390_H 3 | 4 | #define FIO_ARCH (arch_s390) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 282 8 | #define __NR_ioprio_get 283 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 253 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 306 17 | #define __NR_sys_tee 308 18 | #define __NR_sys_vmsplice 309 19 | #endif 20 | 21 | #define nop asm volatile("nop" : : : "memory") 22 | #define read_barrier() asm volatile("bcr 15,0" : : : "memory") 23 | #define write_barrier() asm volatile("bcr 15,0" : : : "memory") 24 | 25 | static inline unsigned long long get_cpu_clock(void) 26 | { 27 | unsigned long long clk; 28 | 29 | #ifdef CONFIG_S390_Z196_FACILITIES 30 | /* 31 | * Fio needs monotonic (never lower), but not strict monotonic (never 32 | * the same) so store clock fast is enough. 33 | */ 34 | __asm__ __volatile__("stckf %0" : "=Q" (clk) : : "cc"); 35 | #else 36 | __asm__ __volatile__("stck %0" : "=Q" (clk) : : "cc"); 37 | #endif 38 | return clk>>12; 39 | } 40 | 41 | #define ARCH_CPU_CLOCK_CYCLES_PER_USEC 1 42 | #define ARCH_HAVE_CPU_CLOCK 43 | 44 | #define ARCH_HAVE_INIT 45 | extern int tsc_reliable; 46 | static inline int arch_init(char *envp[]) 47 | { 48 | tsc_reliable = 1; 49 | return 0; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /bench-tools/fio/examples/ssd-steadystate.fio: -------------------------------------------------------------------------------- 1 | # Get a decent idea about the steady state performance of an SSD. 2 | # 3 | # First we sequentially write the drive. Then we completely 4 | # overwrite the device again, this time randomly at 4K. The former gives 5 | # us a good idea of the ideal write performance, you should see flat graph 6 | # of steady write performance. The latter we would expect to start out at 7 | # approximately the same rate as the sequential fill, but at some point 8 | # hit a write cliff and hit steady state. The latency numbers of the steady 9 | # state also provide a good idea of what kind of latencies to expect when 10 | # the device is pushed to steady state instead of peak benchmark-like 11 | # numbers that are usually reported. 12 | # 13 | # Note that this is a DESTRUCTIVE test. It operates on the device itself. 14 | # It's not destructive in the sense that it will ruin the device, but 15 | # whatever data you have on there will be gone. 16 | # 17 | [global] 18 | ioengine=libaio 19 | direct=1 20 | group_reporting 21 | filename=/dev/fioa 22 | 23 | [sequential-fill] 24 | description=Sequential fill phase 25 | rw=write 26 | iodepth=16 27 | bs=1M 28 | 29 | [random-write-steady] 30 | stonewall 31 | description=Random write steady state phase 32 | rw=randwrite 33 | bs=4K 34 | iodepth=32 35 | numjobs=4 36 | write_bw_log=fioa-steady-state 37 | -------------------------------------------------------------------------------- /bench-tools/fio/os/windows/posix/include/sys/shm.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_SHM_H 2 | #define SYS_SHM_H 3 | 4 | #define IPC_RMID 0x1 5 | #define IPC_CREAT 0x2 6 | #define IPC_PRIVATE 0x4 7 | 8 | typedef int uid_t; 9 | typedef int gid_t; 10 | 11 | typedef int shmatt_t; 12 | typedef int key_t; 13 | 14 | struct ipc_perm 15 | { 16 | uid_t uid; /* owner's user ID */ 17 | gid_t gid; /* owner's group ID */ 18 | uid_t cuid; /* creator's user ID */ 19 | gid_t cgid; /* creator's group ID */ 20 | mode_t mode; /* read/write permission */ 21 | }; 22 | 23 | 24 | struct shmid_ds 25 | { 26 | struct ipc_perm shm_perm; /* operation permission structure */ 27 | size_t shm_segsz; /* size of segment in bytes */ 28 | pid_t shm_lpid; /* process ID of last shared memory operation */ 29 | pid_t shm_cpid; /* process ID of creator */ 30 | shmatt_t shm_nattch; /* number of current attaches */ 31 | time_t shm_atime; /* time of last shmat() */ 32 | time_t shm_dtime; /* time of last shmdt() */ 33 | time_t shm_ctime; /* time of last change by shmctl() */ 34 | }; 35 | 36 | int shmctl(int shmid, int cmd, struct shmid_ds *buf); 37 | int shmget(key_t key, size_t size, int shmflg); 38 | void *shmat(int shmid, const void *shmaddr, int shmflg); 39 | int shmdt(const void *shmaddr); 40 | 41 | #endif /* SYS_SHM_H */ 42 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.10 2006/01/10 13:13:06 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gkey(n) (&(n)->i_key.nk) 15 | #define gval(n) (&(n)->i_val) 16 | #define gnext(n) ((n)->i_key.nk.next) 17 | 18 | #define key2tval(n) (&(n)->i_key.tvk) 19 | 20 | 21 | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); 22 | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); 23 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 24 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); 25 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 26 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 27 | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); 28 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); 29 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 30 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 31 | LUAI_FUNC int luaH_getn (Table *t); 32 | 33 | 34 | #if defined(LUA_DEBUG) 35 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 36 | LUAI_FUNC int luaH_isdummy (Node *n); 37 | #endif 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /bench-tools/fio/os/os-openbsd.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_OS_OPENBSD_H 2 | #define FIO_OS_OPENBSD_H 3 | 4 | #define FIO_OS os_openbsd 5 | 6 | #include 7 | #include 8 | /* XXX hack to avoid conflicts between rbtree.h and */ 9 | #include 10 | #undef RB_BLACK 11 | #undef RB_RED 12 | #undef RB_ROOT 13 | 14 | #include "../file.h" 15 | 16 | #undef FIO_HAVE_ODIRECT 17 | #define FIO_USE_GENERIC_BDEV_SIZE 18 | #define FIO_USE_GENERIC_RAND 19 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE 20 | #define FIO_HAVE_GETTID 21 | 22 | #undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */ 23 | 24 | #define OS_MAP_ANON MAP_ANON 25 | 26 | #ifndef PTHREAD_STACK_MIN 27 | #define PTHREAD_STACK_MIN 4096 28 | #endif 29 | 30 | #define fio_swap16(x) bswap16(x) 31 | #define fio_swap32(x) bswap32(x) 32 | #define fio_swap64(x) bswap64(x) 33 | 34 | typedef off_t off64_t; 35 | 36 | static inline int blockdev_invalidate_cache(struct fio_file *f) 37 | { 38 | return EINVAL; 39 | } 40 | 41 | static inline unsigned long long os_phys_mem(void) 42 | { 43 | int mib[2] = { CTL_HW, HW_PHYSMEM64 }; 44 | uint64_t mem; 45 | size_t len = sizeof(mem); 46 | 47 | sysctl(mib, 2, &mem, &len, NULL, 0); 48 | return mem; 49 | } 50 | 51 | static inline int gettid(void) 52 | { 53 | return (int) pthread_self(); 54 | } 55 | 56 | #ifdef MADV_FREE 57 | #define FIO_MADV_FREE MADV_FREE 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /bench-tools/fio/ghelpers.h: -------------------------------------------------------------------------------- 1 | #ifndef GFIO_HELPERS_H 2 | #define GFIO_HELPERS_H 3 | 4 | GtkWidget *new_combo_entry_in_frame(GtkWidget *box, const char *label); 5 | GtkWidget *new_info_entry_in_frame(GtkWidget *box, const char *label); 6 | GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label); 7 | GtkWidget *new_info_entry_in_frame_rgb(GtkWidget *box, const char *label, 8 | gfloat r, gfloat g, gfloat b); 9 | GtkWidget *create_spinbutton(GtkWidget *hbox, double min, double max, double defval); 10 | void label_set_int_value(GtkWidget *entry, unsigned int val); 11 | void entry_set_int_value(GtkWidget *entry, unsigned int val); 12 | 13 | GtkWidget *get_scrolled_window(gint border_width); 14 | 15 | struct multitext_widget { 16 | GtkWidget *entry; 17 | char **text; 18 | unsigned int cur_text; 19 | unsigned int max_text; 20 | }; 21 | 22 | void multitext_add_entry(struct multitext_widget *mt, const char *text); 23 | void multitext_set_entry(struct multitext_widget *mt, unsigned int index); 24 | void multitext_update_entry(struct multitext_widget *mt, unsigned int index, 25 | const char *text); 26 | void multitext_free(struct multitext_widget *mt); 27 | 28 | #define ALIGN_LEFT 1 29 | #define ALIGN_RIGHT 2 30 | #define INVISIBLE 4 31 | #define UNSORTABLE 8 32 | 33 | GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title, unsigned int flags); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /bench-tools/http_load/make_test_files: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # make_test_files - create a set of files for use with http_load 4 | # 5 | # This creates a specified number of files that are either a kilobyte 6 | # or a megabyte in length. The files are named kNNN and mNNN. 7 | 8 | if [ $# -ne 2 ] ; then 9 | echo "usage: $0 #kfiles #mfiles" >&2 10 | exit 1 11 | fi 12 | 13 | kfiles="$1" 14 | mfiles="$2" 15 | 16 | tmp=mtf.$$ 17 | ktmp=ktmp.$$ 18 | mtmp=mtmp.$$ 19 | rm -f $tmp $ktmp $mtmp 20 | 21 | if [ "$kfiles" -gt 0 ] ; then 22 | echo "123456789012345678901234567890123456789012345678901234567890123" > $ktmp 23 | cat $ktmp $ktmp $ktmp $ktmp > $tmp 24 | cat $tmp $tmp $tmp $tmp > $ktmp 25 | i=1 26 | while [ $i -le "$kfiles" ] ; do 27 | cp $ktmp "k$i" 28 | i=`expr "$i" + 1` 29 | done 30 | fi 31 | 32 | if [ "$mfiles" -gt 0 ] ; then 33 | echo "123456789012345678901234567890123456789012345678901234567890123" > $mtmp 34 | cat $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp > $tmp 35 | cat $tmp $tmp $tmp $tmp $tmp $tmp $tmp $tmp > $mtmp 36 | cat $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp > $tmp 37 | cat $tmp $tmp $tmp $tmp $tmp $tmp $tmp $tmp > $mtmp 38 | cat $mtmp $mtmp > $tmp 39 | cat $tmp $tmp > $mtmp 40 | i=1 41 | while [ $i -le "$mfiles" ] ; do 42 | cp $mtmp "m$i" 43 | i=`expr "$i" + 1` 44 | done 45 | fi 46 | 47 | rm -f $tmp $ktmp $mtmp 48 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-ia64.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_IA64_H 2 | #define ARCH_IA64_H 3 | 4 | #define FIO_ARCH (arch_ia64) 5 | 6 | #ifndef __NR_ioprio_set 7 | #define __NR_ioprio_set 1274 8 | #define __NR_ioprio_get 1275 9 | #endif 10 | 11 | #ifndef __NR_fadvise64 12 | #define __NR_fadvise64 1234 13 | #endif 14 | 15 | #ifndef __NR_sys_splice 16 | #define __NR_sys_splice 1297 17 | #define __NR_sys_tee 1301 18 | #define __NR_sys_vmsplice 1302 19 | #endif 20 | 21 | #define nop asm volatile ("hint @pause" ::: "memory"); 22 | #define read_barrier() asm volatile ("mf" ::: "memory") 23 | #define write_barrier() asm volatile ("mf" ::: "memory") 24 | 25 | #define ia64_popcnt(x) \ 26 | ({ \ 27 | unsigned long ia64_intri_res; \ 28 | asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \ 29 | ia64_intri_res; \ 30 | }) 31 | 32 | static inline unsigned long arch_ffz(unsigned long bitmask) 33 | { 34 | return ia64_popcnt(bitmask & (~bitmask - 1)); 35 | } 36 | 37 | static inline unsigned long long get_cpu_clock(void) 38 | { 39 | unsigned long long ret; 40 | 41 | __asm__ __volatile__("mov %0=ar.itc" : "=r" (ret) : : "memory"); 42 | return ret; 43 | } 44 | 45 | #define ARCH_HAVE_INIT 46 | extern int tsc_reliable; 47 | static inline int arch_init(char *envp[]) 48 | { 49 | tsc_reliable = 1; 50 | return 0; 51 | } 52 | 53 | #define ARCH_HAVE_FFZ 54 | #define ARCH_HAVE_CPU_CLOCK 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /bench-tools/fio/profile.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_PROFILE_H 2 | #define FIO_PROFILE_H 3 | 4 | #include "flist.h" 5 | 6 | /* 7 | * Functions for overriding internal fio io_u functions 8 | */ 9 | struct prof_io_ops { 10 | int (*td_init)(struct thread_data *); 11 | void (*td_exit)(struct thread_data *); 12 | 13 | int (*fill_io_u_off)(struct thread_data *, struct io_u *, unsigned int *); 14 | int (*fill_io_u_size)(struct thread_data *, struct io_u *, unsigned int); 15 | struct fio_file *(*get_next_file)(struct thread_data *); 16 | 17 | int (*io_u_lat)(struct thread_data *, uint64_t); 18 | }; 19 | 20 | struct profile_ops { 21 | struct flist_head list; 22 | char name[32]; 23 | char desc[64]; 24 | int flags; 25 | 26 | /* 27 | * Profile specific options 28 | */ 29 | struct fio_option *options; 30 | void *opt_data; 31 | 32 | /* 33 | * Called after parsing options, to prepare 'cmdline' 34 | */ 35 | int (*prep_cmd)(void); 36 | 37 | /* 38 | * The complete command line 39 | */ 40 | const char **cmdline; 41 | 42 | struct prof_io_ops *io_ops; 43 | }; 44 | 45 | int register_profile(struct profile_ops *); 46 | void unregister_profile(struct profile_ops *); 47 | int load_profile(const char *); 48 | struct profile_ops *find_profile(const char *); 49 | void profile_add_hooks(struct thread_data *); 50 | 51 | int profile_td_init(struct thread_data *); 52 | void profile_td_exit(struct thread_data *); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-sh.h: -------------------------------------------------------------------------------- 1 | /* Renesas SH (32bit) only */ 2 | 3 | #ifndef ARCH_SH_H 4 | #define ARCH_SH_H 5 | 6 | #define FIO_ARCH (arch_sh) 7 | 8 | #ifndef __NR_ioprio_set 9 | #define __NR_ioprio_set 288 10 | #define __NR_ioprio_get 289 11 | #endif 12 | 13 | #ifndef __NR_fadvise64 14 | #define __NR_fadvise64 250 15 | #endif 16 | 17 | #ifndef __NR_sys_splice 18 | #define __NR_sys_splice 313 19 | #define __NR_sys_tee 315 20 | #define __NR_sys_vmsplice 316 21 | #endif 22 | 23 | #define nop __asm__ __volatile__ ("nop": : :"memory") 24 | 25 | #define mb() \ 26 | do { \ 27 | if (arch_flags & ARCH_FLAG_1) \ 28 | __asm__ __volatile__ ("synco": : :"memory"); \ 29 | else \ 30 | __asm__ __volatile__ (" " : : : "memory"); \ 31 | } while (0) 32 | 33 | #define read_barrier() mb() 34 | #define write_barrier() mb() 35 | 36 | #include 37 | #include 38 | 39 | extern unsigned long arch_flags; 40 | 41 | #define CPU_HAS_LLSC 0x0040 42 | 43 | static inline int arch_init(char *envp[]) 44 | { 45 | Elf32_auxv_t *auxv; 46 | 47 | while (*envp++ != NULL) 48 | ; 49 | 50 | for (auxv = (Elf32_auxv_t *) envp; auxv->a_type != AT_NULL; auxv++) { 51 | if (auxv->a_type == AT_HWCAP) { 52 | if (auxv->a_un.a_val & CPU_HAS_LLSC) { 53 | arch_flags |= ARCH_FLAG_1; 54 | break; 55 | } 56 | } 57 | } 58 | 59 | return 0; 60 | } 61 | 62 | #define ARCH_HAVE_INIT 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-x86.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_X86_H 2 | #define ARCH_X86_H 3 | 4 | static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, 5 | unsigned int *ecx, unsigned int *edx) 6 | { 7 | asm volatile("xchgl %%ebx, %1\ncpuid\nxchgl %%ebx, %1" 8 | : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx) 9 | : "0" (*eax) 10 | : "memory"); 11 | } 12 | 13 | #include "arch-x86-common.h" 14 | 15 | #define FIO_ARCH (arch_i386) 16 | 17 | #ifndef __NR_ioprio_set 18 | #define __NR_ioprio_set 289 19 | #define __NR_ioprio_get 290 20 | #endif 21 | 22 | #ifndef __NR_fadvise64 23 | #define __NR_fadvise64 250 24 | #endif 25 | 26 | #ifndef __NR_sys_splice 27 | #define __NR_sys_splice 313 28 | #define __NR_sys_tee 315 29 | #define __NR_sys_vmsplice 316 30 | #endif 31 | 32 | #define FIO_HUGE_PAGE 4194304 33 | 34 | #define nop __asm__ __volatile__("rep;nop": : :"memory") 35 | #define read_barrier() __asm__ __volatile__("": : :"memory") 36 | #define write_barrier() __asm__ __volatile__("": : :"memory") 37 | 38 | static inline unsigned long arch_ffz(unsigned long bitmask) 39 | { 40 | __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask)); 41 | return bitmask; 42 | } 43 | 44 | static inline unsigned long long get_cpu_clock(void) 45 | { 46 | unsigned long long ret; 47 | 48 | __asm__ __volatile__("rdtsc" : "=A" (ret)); 49 | return ret; 50 | } 51 | 52 | #define ARCH_HAVE_FFZ 53 | #define ARCH_HAVE_CPU_CLOCK 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /bench-tools/sysbench/m4/ac_check_aio.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: AC_CHECK_AIO 3 | dnl Check for Linux AIO availability on the target system 4 | dnl Also, check the version of libaio library (at the moment, there are two 5 | dnl versions with incompatible interfaces). 6 | dnl --------------------------------------------------------------------------- 7 | 8 | AC_DEFUN([AC_CHECK_AIO],[ 9 | if test x$enable_aio = xyes; then 10 | AC_CHECK_HEADER([libaio.h], 11 | [AC_DEFINE(HAVE_LIBAIO_H,1,[Define to 1 if your system has header file])], 12 | [enable_aio=no]) 13 | fi 14 | if test x$enable_aio = xyes; then 15 | AC_CHECK_LIB([aio], [io_queue_init], , [enable_aio=no]) 16 | fi 17 | if test x$enable_aio = xyes; then 18 | AC_MSG_CHECKING(if io_getevents() has an old interface) 19 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 20 | [[ 21 | #ifdef HAVE_LIBAIO_H 22 | # include 23 | #endif 24 | struct io_event event; 25 | io_context_t ctxt; 26 | ]], 27 | [[ 28 | (void)io_getevents(ctxt, 1, &event, NULL); 29 | ]] ) 30 | ], [ 31 | AC_DEFINE([HAVE_OLD_GETEVENTS], 1, [Define to 1 if libaio has older getevents() interface]) 32 | AC_MSG_RESULT(yes) 33 | ], 34 | [AC_MSG_RESULT(no)] 35 | ) 36 | fi 37 | ]) 38 | 39 | -------------------------------------------------------------------------------- /bench-tools/fio/idletime.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_IDLETIME_H 2 | #define FIO_IDLETIME_H 3 | 4 | #include "fio.h" 5 | 6 | #define CALIBRATE_RUNS 10 7 | #define CALIBRATE_SCALE 1000 8 | #define MAX_CPU_STR_LEN 32 9 | 10 | enum { 11 | IDLE_PROF_OPT_NONE, 12 | IDLE_PROF_OPT_CALI, /* calibration only */ 13 | IDLE_PROF_OPT_SYSTEM, 14 | IDLE_PROF_OPT_PERCPU 15 | }; 16 | 17 | enum { 18 | IDLE_PROF_STATUS_OK, 19 | IDLE_PROF_STATUS_CALI_STOP, 20 | IDLE_PROF_STATUS_PROF_STOP, 21 | IDLE_PROF_STATUS_ABORT 22 | }; 23 | 24 | struct idle_prof_thread { 25 | pthread_t thread; 26 | int cpu; 27 | int state; 28 | struct timeval tps; 29 | struct timeval tpe; 30 | double cali_time; /* microseconds to finish a unit work */ 31 | double loops; 32 | double idleness; 33 | unsigned char *data; /* bytes to be touched */ 34 | pthread_cond_t cond; 35 | pthread_mutex_t init_lock; 36 | pthread_mutex_t start_lock; 37 | }; 38 | 39 | struct idle_prof_common { 40 | struct idle_prof_thread *ipts; 41 | int nr_cpus; 42 | int status; 43 | int opt; 44 | double cali_mean; 45 | double cali_stddev; 46 | void *buf; /* single data allocation for all threads */ 47 | }; 48 | 49 | extern int fio_idle_prof_parse_opt(const char *); 50 | 51 | extern void fio_idle_prof_init(void); 52 | extern void fio_idle_prof_start(void); 53 | extern void fio_idle_prof_stop(void); 54 | 55 | extern void show_idle_prof_stats(int, struct json_object *); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/sb_fileio.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef SB_FILEIO_H 19 | #define SB_FILEIO_H 20 | 21 | #ifdef _WIN32 22 | #include "sb_win.h" /* ssize_t defined*/ 23 | #endif 24 | 25 | /* File operation types */ 26 | typedef enum 27 | { 28 | FILE_OP_TYPE_NULL, 29 | FILE_OP_TYPE_READ, 30 | FILE_OP_TYPE_WRITE, 31 | FILE_OP_TYPE_FSYNC 32 | } sb_file_op_t; 33 | 34 | /* File IO request definition */ 35 | 36 | typedef struct 37 | { 38 | unsigned int file_id; 39 | long long pos; 40 | ssize_t size; 41 | sb_file_op_t operation; 42 | } sb_file_request_t; 43 | 44 | int register_test_fileio(sb_list_t *tests); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/tests/sb_memory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef SB_MEMORY_H 19 | #define SB_MEMORY_H 20 | 21 | /* Memory request type definition */ 22 | typedef enum 23 | { 24 | SB_MEM_OP_NONE, 25 | SB_MEM_OP_READ, 26 | SB_MEM_OP_WRITE 27 | } sb_mem_op_t; 28 | 29 | 30 | /* Memory scope type definition */ 31 | typedef enum 32 | { 33 | SB_MEM_SCOPE_GLOBAL, 34 | SB_MEM_SCOPE_LOCAL 35 | } sb_mem_scope_t; 36 | 37 | 38 | /* Memory IO request definition */ 39 | 40 | typedef struct 41 | { 42 | sb_mem_op_t type; 43 | size_t block_size; 44 | sb_mem_scope_t scope; 45 | } sb_mem_request_t; 46 | 47 | int register_test_memory(sb_list_t *tests); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | if(MSVC) 18 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLUA_WIN") 19 | endif(MSVC) 20 | add_library(lua lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c 21 | lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c 22 | lundump.c lvm.c lzio.c 23 | lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c 24 | lstrlib.c loadlib.c linit.c 25 | lapi.h lcode.h ldo.h lgc.h llimits.h lobject.h lparser.h lstring.h ltm.h 26 | luaconf.h lundump.h lzio.h lauxlib.h ldebug.h lfunc.h llex.h lmem.h lopcodes.h 27 | lstate.h ltable.h lua.h lualib.h lvm.h) -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 MySQL AB 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | noinst_LIBRARIES = liblua.a 18 | 19 | liblua_a_SOURCES = lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c \ 20 | lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c \ 21 | lundump.c lvm.c lzio.c \ 22 | lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c \ 23 | lstrlib.c loadlib.c linit.c \ 24 | lapi.h lcode.h ldo.h lgc.h llimits.h lobject.h lparser.h lstring.h ltm.h \ 25 | luaconf.h lundump.h lzio.h lauxlib.h ldebug.h lfunc.h llex.h lmem.h lopcodes.h \ 26 | lstate.h ltable.h lua.h lualib.h lvm.h 27 | 28 | AM_CFLAGS += -Wno-bad-function-cast -------------------------------------------------------------------------------- /bench-tools/fio/examples/1mbs_clients.fio: -------------------------------------------------------------------------------- 1 | ; Keep adding 1024kb/s reading clients at 4 seconds 2 | [global] 3 | size=32m 4 | rw=read 5 | directory=tmp 6 | rate=1250 7 | ratemin=1024 8 | 9 | [file1] 10 | startdelay=0 11 | 12 | [file2] 13 | startdelay=4 14 | 15 | [file3] 16 | startdelay=8 17 | 18 | [file4] 19 | startdelay=12 20 | 21 | [file5] 22 | startdelay=16 23 | 24 | [file6] 25 | startdelay=20 26 | 27 | [file7] 28 | startdelay=24 29 | 30 | [file8] 31 | startdelay=28 32 | 33 | [file9] 34 | startdelay=32 35 | 36 | [file10] 37 | startdelay=36 38 | 39 | [file11] 40 | startdelay=40 41 | 42 | [file12] 43 | startdelay=44 44 | 45 | [file13] 46 | startdelay=48 47 | 48 | [file14] 49 | startdelay=52 50 | 51 | [file15] 52 | startdelay=56 53 | 54 | [file16] 55 | startdelay=60 56 | 57 | [file17] 58 | startdelay=64 59 | 60 | [file18] 61 | startdelay=68 62 | 63 | [file19] 64 | startdelay=72 65 | 66 | [file20] 67 | startdelay=76 68 | 69 | [file21] 70 | startdelay=80 71 | 72 | [file22] 73 | startdelay=84 74 | 75 | [file23] 76 | startdelay=88 77 | 78 | [file24] 79 | startdelay=92 80 | 81 | [file25] 82 | startdelay=96 83 | 84 | [file26] 85 | startdelay=100 86 | 87 | [file27] 88 | startdelay=104 89 | 90 | [file28] 91 | startdelay=108 92 | 93 | [file29] 94 | startdelay=112 95 | 96 | [file30] 97 | startdelay=116 98 | 99 | [file31] 100 | startdelay=120 101 | 102 | [file32] 103 | startdelay=124 104 | 105 | -------------------------------------------------------------------------------- /bench-tools/fio/os/os-netbsd.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_OS_NETBSD_H 2 | #define FIO_OS_NETBSD_H 3 | 4 | #define FIO_OS os_netbsd 5 | 6 | #include 7 | #include 8 | #include 9 | /* XXX hack to avoid confilcts between rbtree.h and */ 10 | #define rb_node _rb_node 11 | #include 12 | #undef rb_node 13 | #undef rb_left 14 | #undef rb_right 15 | 16 | #include "../file.h" 17 | 18 | #define FIO_HAVE_ODIRECT 19 | #define FIO_USE_GENERIC_BDEV_SIZE 20 | #define FIO_USE_GENERIC_RAND 21 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE 22 | #define FIO_HAVE_GETTID 23 | 24 | #undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */ 25 | 26 | #define OS_MAP_ANON MAP_ANON 27 | 28 | #ifndef PTHREAD_STACK_MIN 29 | #define PTHREAD_STACK_MIN 4096 30 | #endif 31 | 32 | #define fio_swap16(x) bswap16(x) 33 | #define fio_swap32(x) bswap32(x) 34 | #define fio_swap64(x) bswap64(x) 35 | 36 | typedef off_t off64_t; 37 | 38 | static inline int blockdev_invalidate_cache(struct fio_file *f) 39 | { 40 | return EINVAL; 41 | } 42 | 43 | static inline unsigned long long os_phys_mem(void) 44 | { 45 | int mib[2] = { CTL_HW, HW_PHYSMEM64 }; 46 | uint64_t mem; 47 | size_t len = sizeof(mem); 48 | 49 | sysctl(mib, 2, &mem, &len, NULL, 0); 50 | return mem; 51 | } 52 | 53 | static inline int gettid(void) 54 | { 55 | return (int) _lwp_self(); 56 | } 57 | 58 | #ifdef MADV_FREE 59 | #define FIO_MADV_FREE MADV_FREE 60 | #endif 61 | 62 | /* XXX NetBSD doesn't have getopt_long_only */ 63 | #define getopt_long_only getopt_long 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /bench-tools/script/wubx/sysbench-scripts/fileio/analyze.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings FATAL => 'all'; 4 | 5 | my @cols = qw( 6 | size type num_threads bytes_sec req_sec pct_95 maxt); 7 | 8 | my @results; 9 | my %hash; 10 | 11 | while ( <> ) { 12 | /PARAMS (\S+) (\S+) (\d+)/ && do { 13 | if ( %hash ) { 14 | push @results, {%hash}; 15 | %hash = (); 16 | } 17 | $hash{size} = $1; 18 | $hash{type} = $2; 19 | $hash{num_threads} = $3; 20 | next; 21 | }; 22 | /Total transferred/ && do { 23 | ($hash{bytes_sec}) = m{\(([^/]+)}; 24 | next; 25 | }; 26 | /approx. 95 percentile:\D+(\d.+)ms/ && do { 27 | $hash{pct_95} = $1; 28 | next; 29 | }; 30 | /max:\D+(\d.+)ms/ && do { 31 | $hash{maxt} = $1; 32 | next; 33 | }; 34 | /([0-9.]+)\s+Requests.sec executed/ && do { 35 | $hash{req_sec} = $1; 36 | next; 37 | }; 38 | } 39 | 40 | $hash{pct_95} ||= '0.0000'; # Sometimes sysbench has errors... 41 | push @results, {%hash} if %hash; 42 | 43 | printf("^%5s^%3s^%9s^%8s^%6s^\n", 44 | qw(size type thr bytes/sec req/sec 95pct max_time)); 45 | 46 | # sort the results by type, threads, size 47 | @results = sort { 48 | ($a->{type} cmp $b->{type}) 49 | || ($a->{size} cmp $b->{size}) 50 | || ($a->{num_threads} <=> $b->{num_threads}) 51 | } @results; 52 | 53 | foreach my $hash ( @results ) { 54 | printf("| %5s | %5s | %3d| %9s| %1.2f| %1.2f| %1.2f|\n", 55 | @{$hash}{@cols}); 56 | } 57 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/README: -------------------------------------------------------------------------------- 1 | README for Lua 5.1 2 | 3 | See INSTALL for installation instructions. 4 | See HISTORY for a summary of changes since the last released version. 5 | 6 | * What is Lua? 7 | ------------ 8 | Lua is a powerful, light-weight programming language designed for extending 9 | applications. Lua is also frequently used as a general-purpose, stand-alone 10 | language. Lua is free software. 11 | 12 | For complete information, visit Lua's web site at http://www.lua.org/ . 13 | For an executive summary, see http://www.lua.org/about.html . 14 | 15 | Lua has been used in many different projects around the world. 16 | For a short list, see http://www.lua.org/uses.html . 17 | 18 | * Availability 19 | ------------ 20 | Lua is freely available for both academic and commercial purposes. 21 | See COPYRIGHT and http://www.lua.org/license.html for details. 22 | Lua can be downloaded at http://www.lua.org/download.html . 23 | 24 | * Installation 25 | ------------ 26 | Lua is implemented in pure ANSI C, and compiles unmodified in all known 27 | platforms that have an ANSI C compiler. Under Unix, simply typing "make" 28 | should work. See INSTALL for detailed instructions. 29 | 30 | * Origin 31 | ------ 32 | Lua is developed at Lua.org, a laboratory of the Department of Computer 33 | Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro 34 | in Brazil). 35 | For more information about the authors, see http://www.lua.org/authors.html . 36 | 37 | (end of README) 38 | -------------------------------------------------------------------------------- /bench-tools/fio/gcompat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "gcompat.h" 4 | 5 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 24 6 | 7 | GtkWidget *gtk_combo_box_text_new(void) 8 | { 9 | return gtk_combo_box_new(); 10 | } 11 | 12 | void gtk_combo_box_text_append_text(GtkComboBoxText *combo_box, 13 | const gchar *text) 14 | { 15 | gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text); 16 | } 17 | 18 | void gtk_combo_box_text_insert_text(GtkComboBoxText *combo_box, gint position, 19 | const gchar *text) 20 | { 21 | gtk_combo_box_insert_text(GTK_COMBO_BOX(combo_box), position, text); 22 | } 23 | 24 | void gtk_combo_box_text_prepend_text(GtkComboBoxText *combo_box, 25 | const gchar *text) 26 | { 27 | gtk_combo_box_prepend_text(GTK_COMBO_BOX(combo_box), text); 28 | } 29 | 30 | gchar *gtk_combo_box_text_get_active_text(GtkComboBoxText *combo_box) 31 | { 32 | return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box)); 33 | } 34 | 35 | #endif 36 | 37 | #if GTK_MAJOR_VERSION < 3 38 | 39 | guint gtk_widget_get_allocated_width(GtkWidget *w) 40 | { 41 | return w->allocation.width; 42 | } 43 | 44 | guint gtk_widget_get_allocated_height(GtkWidget *w) 45 | { 46 | return w->allocation.height; 47 | } 48 | 49 | #endif 50 | 51 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 18 52 | void gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus) 53 | { 54 | if (can_focus) 55 | GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); 56 | else 57 | GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS); 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, yejr 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the {organization} nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /bench-tools/fio/crc/crc32c.h: -------------------------------------------------------------------------------- 1 | /* crc32c -- calculate and POSIX.2 checksum 2 | Copyright (C) 92, 1995-1999 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software Foundation, 16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 17 | 18 | #ifndef CRC32C_H 19 | #define CRC32C_H 20 | 21 | #include "../arch/arch.h" 22 | 23 | extern uint32_t crc32c_sw(unsigned char const *, unsigned long); 24 | extern int crc32c_intel_available; 25 | 26 | #ifdef ARCH_HAVE_SSE4_2 27 | extern uint32_t crc32c_intel(unsigned char const *, unsigned long); 28 | extern void crc32c_intel_probe(void); 29 | #else 30 | #define crc32c_intel crc32c_sw 31 | static inline void crc32c_intel_probe(void) 32 | { 33 | } 34 | #endif 35 | 36 | static inline uint32_t fio_crc32c(unsigned char const *buf, unsigned long len) 37 | { 38 | if (crc32c_intel_available) 39 | return crc32c_intel(buf, len); 40 | 41 | return crc32c_sw(buf, len); 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /bench-tools/script/wubx/sysbench-scripts/fileio/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -u 3 | set -x 4 | set -e 5 | 6 | CURD=`pwd` 7 | 8 | cd /disk1 9 | 10 | sysbench --test=fileio --file-num=64 --file-total-size=350G --file-extra-flags=direct prepare 11 | # pre-run to get card in steady state 12 | sysbench --test=fileio --file-total-size=350G --file-test-mode=rndwr --max-time=3600 --max-requests=100000000 --num-threads=16 --init-rng=on --file-num=64 --file-extra-flags=direct --file-fsync-freq=0 --file-block-size=16384 run 13 | sysbench --test=fileio --file-num=64 --file-total-size=350G cleanup 14 | 15 | for sizei in 100 250 300; do 16 | size=${sizei}G 17 | cd /disk1 18 | sysbench --test=fileio --file-num=64 --file-total-size=$size --file-extra-flags=direct prepare 19 | for mode in rndrd rndwr rndrw; do 20 | for blksize in 16384 ; do 21 | for threads in 1 2 4 8 16 32 64; do 22 | echo "====== testing $blksize in $threads threads" 23 | echo PARAMS $size $mode $threads $blksize > $CURD/sysbench-size-$size-mode-$mode-threads-$threads-blksz-$blksize 24 | sysbench --test=fileio --file-total-size=$size --file-test-mode=$mode\ 25 | --max-time=120 --max-requests=100000000 --num-threads=$threads --init-rng=on \ 26 | --file-num=64 --file-extra-flags=direct --file-fsync-freq=0 --file-block-size=$blksize run \ 27 | | tee -a $CURD/sysbench-size-$size-mode-$mode-threads-$threads-blksz-$blksize 2>&1 28 | done 29 | done 30 | done 31 | sysbench --test=fileio --file-total-size=$size cleanup 32 | cd $CURD 33 | done 34 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/src/sequence.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sequence.c 3 | * manage sequence shared by threads 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | /* weight */ 11 | static int no; 12 | static int py; 13 | static int os; 14 | static int dl; 15 | static int sl; 16 | static int total; 17 | 18 | static pthread_mutex_t mutex; 19 | static int *seq; 20 | static int next_num; 21 | 22 | static void shuffle() 23 | { 24 | int i,j,rnd,tmp; 25 | 26 | for( i=0, j=0; i < no ; i++, j++ ){ 27 | seq[j]=0; 28 | } 29 | for( i=0; i < py ; i++, j++){ 30 | seq[j]=1; 31 | } 32 | for( i=0; i < os ; i++, j++){ 33 | seq[j]=2; 34 | } 35 | for( i=0; i < dl ; i++, j++){ 36 | seq[j]=3; 37 | } 38 | for( i=0; i < sl ; i++, j++){ 39 | seq[j]=4; 40 | } 41 | for( i=0, j = total - 1; j>0; i++, j--){ 42 | rnd = rand()%(j+1); 43 | tmp = seq[rnd+i]; 44 | seq[rnd+i] = seq[i]; 45 | seq[i] = tmp; 46 | } 47 | } 48 | 49 | void seq_init( int n, int p, int o, int d, int s ) 50 | { 51 | pthread_mutex_init( &mutex, NULL ); 52 | no = n; 53 | py = p; 54 | os = o; 55 | dl = d; 56 | sl = s; 57 | total = n + p + o + d + s; 58 | seq = malloc( sizeof(int) * total ); 59 | shuffle(); 60 | next_num = 0; 61 | } 62 | 63 | 64 | int seq_get() 65 | { 66 | int retval; 67 | 68 | pthread_mutex_lock( &mutex ); 69 | 70 | if(next_num >= total){ 71 | shuffle(); 72 | next_num = 0; 73 | } 74 | 75 | retval = seq[next_num]; 76 | ++next_num; 77 | 78 | pthread_mutex_unlock( &mutex ); 79 | 80 | return(retval); 81 | } 82 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/schema2/add_fkey_idx.sql: -------------------------------------------------------------------------------- 1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; 2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; 3 | 4 | 5 | ALTER TABLE district ADD CONSTRAINT fkey_district_1 FOREIGN KEY(d_w_id) REFERENCES warehouse(w_id); 6 | ALTER TABLE customer ADD CONSTRAINT fkey_customer_1 FOREIGN KEY(c_d_id, c_w_id) REFERENCES district(d_id, d_w_id); 7 | ALTER TABLE history ADD CONSTRAINT fkey_history_1 FOREIGN KEY(h_c_id, h_c_d_id, h_c_w_id) REFERENCES customer(c_id, c_d_id, c_w_id); 8 | ALTER TABLE history ADD CONSTRAINT fkey_history_2 FOREIGN KEY(h_d_id, h_w_id) REFERENCES district(d_id, d_w_id); 9 | ALTER TABLE new_orders ADD CONSTRAINT fkey_new_orders_1 FOREIGN KEY(no_o_id,no_d_id,no_w_id) REFERENCES orders(o_id, o_d_id, o_w_id); 10 | ALTER TABLE orders ADD CONSTRAINT fkey_orders_1 FOREIGN KEY(o_c_id,o_d_id,o_w_id) REFERENCES customer(c_id,c_d_id,c_w_id); 11 | ALTER TABLE order_line ADD CONSTRAINT fkey_order_line_1 FOREIGN KEY(ol_o_id,ol_d_id,ol_w_id) REFERENCES orders(o_id, o_d_id, o_w_id); 12 | ALTER TABLE order_line ADD CONSTRAINT fkey_order_line_2 FOREIGN KEY(ol_i_id,ol_supply_w_id) REFERENCES stock(s_i_id,s_w_id); 13 | ALTER TABLE stock ADD CONSTRAINT fkey_stock_1 FOREIGN KEY(s_w_id) REFERENCES warehouse(w_id); 14 | ALTER TABLE stock ADD CONSTRAINT fkey_stock_2 FOREIGN KEY(s_i_id) REFERENCES item(i_id); 15 | 16 | 17 | CREATE INDEX idx_customer ON customer (c_w_id,c_d_id,c_last,c_first); 18 | CREATE INDEX idx_orders ON orders (o_w_id,o_d_id,o_c_id,o_id); 19 | 20 | 21 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; 22 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; 23 | 24 | -------------------------------------------------------------------------------- /bench-tools/fio/fio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fio - the flexible io tester 3 | * 4 | * Copyright (C) 2005 Jens Axboe 5 | * Copyright (C) 2006-2012 Jens Axboe 6 | * 7 | * The license below covers all files distributed with fio unless otherwise 8 | * noted in the file itself. 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | */ 24 | #include 25 | #include 26 | #include 27 | 28 | #include "fio.h" 29 | #include "smalloc.h" 30 | 31 | int main(int argc, char *argv[], char *envp[]) 32 | { 33 | if (initialize_fio(envp)) 34 | return 1; 35 | 36 | #if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME) 37 | #error "No available clock source!" 38 | #endif 39 | 40 | if (parse_options(argc, argv)) 41 | return 1; 42 | 43 | fio_time_init(); 44 | 45 | if (nr_clients) { 46 | if (fio_start_all_clients()) 47 | return 1; 48 | return fio_handle_clients(&fio_client_ops); 49 | } else 50 | return fio_backend(); 51 | } 52 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-x86-common.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_ARCH_X86_COMMON 2 | #define FIO_ARCH_X86_COMMON 3 | 4 | #include 5 | 6 | static inline void cpuid(unsigned int op, 7 | unsigned int *eax, unsigned int *ebx, 8 | unsigned int *ecx, unsigned int *edx) 9 | { 10 | *eax = op; 11 | *ecx = 0; 12 | do_cpuid(eax, ebx, ecx, edx); 13 | } 14 | 15 | #define ARCH_HAVE_INIT 16 | 17 | extern int tsc_reliable; 18 | 19 | static inline int arch_init_intel(unsigned int level) 20 | { 21 | unsigned int eax, ebx, ecx = 0, edx; 22 | 23 | /* 24 | * Check for TSC 25 | */ 26 | eax = 1; 27 | do_cpuid(&eax, &ebx, &ecx, &edx); 28 | if (!(edx & (1U << 4))) 29 | return 0; 30 | 31 | /* 32 | * Check for constant rate and synced (across cores) TSC 33 | */ 34 | eax = 0x80000007; 35 | do_cpuid(&eax, &ebx, &ecx, &edx); 36 | return edx & (1U << 8); 37 | } 38 | 39 | static inline int arch_init_amd(unsigned int level) 40 | { 41 | unsigned int eax, ebx, ecx, edx; 42 | 43 | cpuid(0x80000000, &eax, &ebx, &ecx, &edx); 44 | if (eax < 0x80000007) 45 | return 0; 46 | 47 | cpuid(0x80000007, &eax, &ebx, &ecx, &edx); 48 | if (edx & (1 << 8)) 49 | return 1; 50 | 51 | return 0; 52 | } 53 | 54 | static inline int arch_init(char *envp[]) 55 | { 56 | unsigned int level; 57 | char str[13]; 58 | 59 | cpuid(0, &level, (unsigned int *) &str[0], 60 | (unsigned int *) &str[8], 61 | (unsigned int *) &str[4]); 62 | 63 | str[12] = '\0'; 64 | if (!strcmp(str, "GenuineIntel")) 65 | tsc_reliable = arch_init_intel(level); 66 | else if (!strcmp(str, "AuthenticAMD")) 67 | tsc_reliable = arch_init_amd(level); 68 | 69 | return 0; 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /bench-tools/fio/arch/arch-x86_64.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCH_X86_64_h 2 | #define ARCH_X86_64_h 3 | 4 | static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, 5 | unsigned int *ecx, unsigned int *edx) 6 | { 7 | asm volatile("cpuid" 8 | : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) 9 | : "0" (*eax), "2" (*ecx) 10 | : "memory"); 11 | } 12 | 13 | #include "arch-x86-common.h" 14 | 15 | #define FIO_ARCH (arch_x86_64) 16 | 17 | #ifndef __NR_ioprio_set 18 | #define __NR_ioprio_set 251 19 | #define __NR_ioprio_get 252 20 | #endif 21 | 22 | #ifndef __NR_fadvise64 23 | #define __NR_fadvise64 221 24 | #endif 25 | 26 | #ifndef __NR_sys_splice 27 | #define __NR_sys_splice 275 28 | #define __NR_sys_tee 276 29 | #define __NR_sys_vmsplice 278 30 | #endif 31 | 32 | #ifndef __NR_shmget 33 | #define __NR_shmget 29 34 | #define __NR_shmat 30 35 | #define __NR_shmctl 31 36 | #define __NR_shmdt 67 37 | #endif 38 | 39 | #define FIO_HUGE_PAGE 2097152 40 | 41 | #define nop __asm__ __volatile__("rep;nop": : :"memory") 42 | #define read_barrier() __asm__ __volatile__("lfence":::"memory") 43 | #define write_barrier() __asm__ __volatile__("sfence":::"memory") 44 | 45 | static inline unsigned long arch_ffz(unsigned long bitmask) 46 | { 47 | __asm__("bsf %1,%0" :"=r" (bitmask) :"r" (~bitmask)); 48 | return bitmask; 49 | } 50 | 51 | static inline unsigned long long get_cpu_clock(void) 52 | { 53 | unsigned int lo, hi; 54 | 55 | __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi)); 56 | return ((unsigned long long) hi << 32ULL) | lo; 57 | } 58 | 59 | #define ARCH_HAVE_FFZ 60 | #define ARCH_HAVE_SSE4_2 61 | #define ARCH_HAVE_CPU_CLOCK 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /bench-tools/fio/gcompat.h: -------------------------------------------------------------------------------- 1 | #ifndef GFIO_GTK_COMPAT 2 | #define GFIO_GTK_COMPAT 3 | 4 | #include 5 | 6 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 24 7 | struct GtkComboBoxText; 8 | typedef GtkComboBox GtkComboBoxText; 9 | GtkWidget *gtk_combo_box_text_new(void); 10 | GtkWidget *gtk_combo_box_text_new_with_entry(void); 11 | void gtk_combo_box_text_append_text(GtkComboBoxText *combo_box, const gchar *text); 12 | void gtk_combo_box_text_insert_text(GtkComboBoxText *combo_box, gint position, const gchar *text); 13 | void gtk_combo_box_text_prepend_text(GtkComboBoxText *combo_box, const gchar *text); 14 | void gtk_combo_box_text_remove(GtkComboBoxText *combo_box, gint position); 15 | gchar *gtk_combo_box_text_get_active_text(GtkComboBoxText *combo_box); 16 | 17 | #define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX 18 | #endif /* GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 24 */ 19 | 20 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 14 21 | static inline GtkWidget *gtk_dialog_get_content_area(GtkDialog *dialog) 22 | { 23 | return dialog->vbox; 24 | } 25 | static inline GdkWindow *gtk_widget_get_window(GtkWidget *w) 26 | { 27 | return w->window; 28 | } 29 | #endif 30 | 31 | #if GTK_MAJOR_VERSION < 3 32 | guint gtk_widget_get_allocated_width(GtkWidget *w); 33 | guint gtk_widget_get_allocated_height(GtkWidget *w); 34 | #endif 35 | 36 | #if GTK_MAJOR_VERSION == 3 37 | #define GFIO_DRAW_EVENT "draw" 38 | #elif GTK_MAJOR_VERSION == 2 39 | #define GFIO_DRAW_EVENT "expose_event" 40 | #endif 41 | 42 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 18 43 | void gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus); 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /bench-tools/fio/io_u_queue.h: -------------------------------------------------------------------------------- 1 | #ifndef FIO_IO_U_QUEUE 2 | #define FIO_IO_U_QUEUE 3 | 4 | #include 5 | 6 | struct io_u; 7 | 8 | struct io_u_queue { 9 | struct io_u **io_us; 10 | unsigned int nr; 11 | }; 12 | 13 | static inline struct io_u *io_u_qpop(struct io_u_queue *q) 14 | { 15 | if (q->nr) 16 | return q->io_us[--q->nr]; 17 | 18 | return NULL; 19 | } 20 | 21 | static inline void io_u_qpush(struct io_u_queue *q, struct io_u *io_u) 22 | { 23 | q->io_us[q->nr++] = io_u; 24 | } 25 | 26 | static inline int io_u_qempty(struct io_u_queue *q) 27 | { 28 | return !q->nr; 29 | } 30 | 31 | #define io_u_qiter(q, io_u, i) \ 32 | for (i = 0; i < (q)->nr && (io_u = (q)->io_us[i]); i++) 33 | 34 | int io_u_qinit(struct io_u_queue *q, unsigned int nr); 35 | void io_u_qexit(struct io_u_queue *q); 36 | 37 | struct io_u_ring { 38 | unsigned int head; 39 | unsigned int tail; 40 | unsigned int max; 41 | struct io_u **ring; 42 | }; 43 | 44 | int io_u_rinit(struct io_u_ring *ring, unsigned int nr); 45 | void io_u_rexit(struct io_u_ring *ring); 46 | 47 | static inline void io_u_rpush(struct io_u_ring *r, struct io_u *io_u) 48 | { 49 | if (r->head + 1 != r->tail) { 50 | r->ring[r->head] = io_u; 51 | r->head = (r->head + 1) & (r->max - 1); 52 | return; 53 | } 54 | 55 | assert(0); 56 | } 57 | 58 | static inline struct io_u *io_u_rpop(struct io_u_ring *r) 59 | { 60 | if (r->head != r->tail) { 61 | struct io_u *io_u = r->ring[r->tail]; 62 | 63 | r->tail = (r->tail + 1) & (r->max - 1); 64 | return io_u; 65 | } 66 | 67 | return NULL; 68 | } 69 | 70 | static inline int io_u_rempty(struct io_u_ring *ring) 71 | { 72 | return ring->head == ring->tail; 73 | } 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Lua License 2 | ----------- 3 | 4 | Lua is licensed under the terms of the MIT license reproduced below. 5 | This means that Lua is free software and can be used for both academic 6 | and commercial purposes at absolutely no cost. 7 | 8 | For details and rationale, see http://www.lua.org/license.html . 9 | 10 | =============================================================================== 11 | 12 | Copyright (C) 1994-2006 Lua.org, PUC-Rio. 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the "Software"), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | =============================================================================== 33 | 34 | (end of COPYRIGHT) 35 | -------------------------------------------------------------------------------- /bench-tools/tpcc_mysql/add_fkey_idx.sql: -------------------------------------------------------------------------------- 1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; 2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; 3 | 4 | 5 | CREATE INDEX idx_customer ON customer (c_w_id,c_d_id,c_last,c_first); 6 | CREATE INDEX idx_orders ON orders (o_w_id,o_d_id,o_c_id,o_id); 7 | CREATE INDEX fkey_stock_2 ON stock (s_i_id); 8 | CREATE INDEX fkey_order_line_2 ON order_line (ol_supply_w_id,ol_i_id); 9 | 10 | ALTER TABLE district ADD CONSTRAINT fkey_district_1 FOREIGN KEY(d_w_id) REFERENCES warehouse(w_id); 11 | ALTER TABLE customer ADD CONSTRAINT fkey_customer_1 FOREIGN KEY(c_w_id,c_d_id) REFERENCES district(d_w_id,d_id); 12 | ALTER TABLE history ADD CONSTRAINT fkey_history_1 FOREIGN KEY(h_c_w_id,h_c_d_id,h_c_id) REFERENCES customer(c_w_id,c_d_id,c_id); 13 | ALTER TABLE history ADD CONSTRAINT fkey_history_2 FOREIGN KEY(h_w_id,h_d_id) REFERENCES district(d_w_id,d_id); 14 | ALTER TABLE new_orders ADD CONSTRAINT fkey_new_orders_1 FOREIGN KEY(no_w_id,no_d_id,no_o_id) REFERENCES orders(o_w_id,o_d_id,o_id); 15 | ALTER TABLE orders ADD CONSTRAINT fkey_orders_1 FOREIGN KEY(o_w_id,o_d_id,o_c_id) REFERENCES customer(c_w_id,c_d_id,c_id); 16 | ALTER TABLE order_line ADD CONSTRAINT fkey_order_line_1 FOREIGN KEY(ol_w_id,ol_d_id,ol_o_id) REFERENCES orders(o_w_id,o_d_id,o_id); 17 | ALTER TABLE order_line ADD CONSTRAINT fkey_order_line_2 FOREIGN KEY(ol_supply_w_id,ol_i_id) REFERENCES stock(s_w_id,s_i_id); 18 | ALTER TABLE stock ADD CONSTRAINT fkey_stock_1 FOREIGN KEY(s_w_id) REFERENCES warehouse(w_id); 19 | ALTER TABLE stock ADD CONSTRAINT fkey_stock_2 FOREIGN KEY(s_i_id) REFERENCES item(i_id); 20 | 21 | 22 | 23 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; 24 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; 25 | -------------------------------------------------------------------------------- /bench-tools/sysbench/sysbench/scripting/lua/src/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.31 2005/04/25 19:24:10 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | #define MEMERRMSG "not enough memory" 17 | 18 | 19 | #define luaM_reallocv(L,b,on,n,e) \ 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ 22 | luaM_toobig(L)) 23 | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) 27 | 28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 30 | #define luaM_newvector(L,n,t) \ 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 32 | 33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 34 | if ((nelems)+1 > (size)) \ 35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 36 | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 39 | 40 | 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 42 | size_t size); 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 45 | size_t size_elem, int limit, 46 | const char *errormsg); 47 | 48 | #endif 49 | 50 | --------------------------------------------------------------------------------